Skip to content

Commit 9ad3a8d

Browse files
author
Cameron Mace
authored
Release location layer 0.5.0-beta.1 (#390)
* release 0.5.0 * Fixed some misses while rebasing * revert version * Changelog updates
1 parent f50d8d5 commit 9ad3a8d

4 files changed

Lines changed: 31 additions & 7 deletions

File tree

.github/mbx-plugins-logo.png

-44.1 KB
Loading

plugin-locationlayer/CHANGELOG.md

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,14 @@
22

33
Mapbox welcomes participation and contributions from everyone.
44

5-
### 0.5.0 - TBD
5+
### 0.5.0-beta.1 - March 29, 2018
6+
- Update Map SDK to 6.0.0-beta.4 [#384](https://github.com/mapbox/mapbox-plugins-android/pull/384)
7+
- Added Camera and tracking modes [#294](https://github.com/mapbox/mapbox-plugins-android/pull/294)
8+
- Added Location layer `onLongClickListener` [#313](https://github.com/mapbox/mapbox-plugins-android/pull/313)
9+
- Add padding APIs to LocationLayerOptions [#313](https://github.com/mapbox/mapbox-plugins-android/pull/313)
10+
- Improved enabling/disabling layers [#308](https://github.com/mapbox/mapbox-plugins-android/pull/308)
11+
- LocationEngine listens to updates after resetting [#307](https://github.com/mapbox/mapbox-plugins-android/pull/307)
12+
- Add ProGuard consumer rules file [#373](https://github.com/mapbox/mapbox-plugins-android/pull/373)
613
- Fixed icon elevation still showing even when set to zero in some cases [#356](https://github.com/mapbox/mapbox-plugins-android/pull/356)
714
- Location layer accuracy visibility issue fix [#306](https://github.com/mapbox/mapbox-plugins-android/pull/306)
815

plugin-locationlayer/src/main/java/com/mapbox/mapboxsdk/plugins/locationlayer/LocationLayer.java

Lines changed: 17 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -57,6 +57,7 @@
5757
import static com.mapbox.mapboxsdk.style.layers.PropertyFactory.iconAllowOverlap;
5858
import static com.mapbox.mapboxsdk.style.layers.PropertyFactory.iconIgnorePlacement;
5959
import static com.mapbox.mapboxsdk.style.layers.PropertyFactory.iconImage;
60+
import static com.mapbox.mapboxsdk.style.layers.PropertyFactory.iconOffset;
6061
import static com.mapbox.mapboxsdk.style.layers.PropertyFactory.iconRotate;
6162
import static com.mapbox.mapboxsdk.style.layers.PropertyFactory.iconRotationAlignment;
6263
import static com.mapbox.mapboxsdk.style.layers.PropertyFactory.iconSize;
@@ -117,12 +118,14 @@ void setRenderMode(@RenderMode.Mode int renderMode) {
117118
switch (renderMode) {
118119
case RenderMode.NORMAL:
119120
styleForeground(options, isStale);
121+
setLayerVisibility(SHADOW_LAYER, true);
120122
setLayerVisibility(FOREGROUND_LAYER, true);
121123
setLayerVisibility(BACKGROUND_LAYER, true);
122124
setLayerVisibility(ACCURACY_LAYER, true);
123125
break;
124126
case RenderMode.COMPASS:
125127
styleForeground(options, isStale);
128+
setLayerVisibility(SHADOW_LAYER, true);
126129
setLayerVisibility(FOREGROUND_LAYER, true);
127130
setLayerVisibility(BACKGROUND_LAYER, true);
128131
setLayerVisibility(ACCURACY_LAYER, true);
@@ -164,7 +167,7 @@ private void addLayers() {
164167
addSymbolLayer(SHADOW_LAYER, BACKGROUND_LAYER);
165168
addSymbolLayer(BACKGROUND_LAYER, FOREGROUND_LAYER);
166169
addSymbolLayer(FOREGROUND_LAYER, null);
167-
addSymbolLayer(LocationLayerConstants.BEARING_LAYER, null);
170+
addSymbolLayer(BEARING_LAYER, null);
168171
addAccuracyLayer();
169172
}
170173

@@ -211,6 +214,18 @@ void updateAccuracyRadius(Location location) {
211214
}
212215
}
213216

217+
void updateForegroundOffset(double tilt) {
218+
layerMap.get(FOREGROUND_LAYER).setProperties(
219+
iconOffset(new Float[] {0f, (float) (-0.05 * tilt)}));
220+
layerMap.get(SHADOW_LAYER).setProperties(
221+
iconOffset(new Float[] {0f, (float) (0.05 * tilt)}));
222+
}
223+
224+
void updateForegroundBearing(float bearing) {
225+
layerMap.get(FOREGROUND_LAYER).setProperties(iconRotate(bearing));
226+
layerMap.get(SHADOW_LAYER).setProperties(iconRotate(bearing));
227+
}
228+
214229
private float calculateZoomLevelRadius(Location location) {
215230
if (location == null) {
216231
return 0;
@@ -337,7 +352,7 @@ public void onNewGpsBearingValue(float gpsBearing) {
337352
@Override
338353
public void onNewCompassBearingValue(float compassBearing) {
339354
if (renderMode == RenderMode.COMPASS) {
340-
setLayerBearing(LocationLayerConstants.BEARING_LAYER, compassBearing);
355+
setLayerBearing(BEARING_LAYER, compassBearing);
341356
}
342357
}
343358
}

plugin-locationlayer/src/main/java/com/mapbox/mapboxsdk/plugins/locationlayer/LocationLayerPlugin.java

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -577,15 +577,17 @@ private void setLastCompassHeading() {
577577

578578
private OnCameraMoveListener onCameraMoveListener = new OnCameraMoveListener() {
579579

580-
private double lastZoom;
580+
private CameraPosition lastCameraPosition;
581581

582582
@Override
583583
public void onCameraMove() {
584-
double zoom = mapboxMap.getCameraPosition().zoom;
585-
if (zoom != lastZoom) {
584+
CameraPosition position = mapboxMap.getCameraPosition();
585+
if (position.equals(lastCameraPosition)) {
586586
locationLayer.updateAccuracyRadius(getLastKnownLocation());
587+
locationLayer.updateForegroundOffset(position.tilt);
588+
locationLayer.updateForegroundBearing((float) position.bearing);
587589
}
588-
lastZoom = zoom;
590+
lastCameraPosition = position;
589591
}
590592
};
591593

0 commit comments

Comments
 (0)