summaryrefslogtreecommitdiff
path: root/platform/android/MapboxGLAndroidSDK/src/main
diff options
context:
space:
mode:
Diffstat (limited to 'platform/android/MapboxGLAndroidSDK/src/main')
-rw-r--r--platform/android/MapboxGLAndroidSDK/src/main/java/com/mapbox/mapboxsdk/location/LocationCameraController.java4
-rw-r--r--platform/android/MapboxGLAndroidSDK/src/main/java/com/mapbox/mapboxsdk/location/LocationLayerController.java79
2 files changed, 42 insertions, 41 deletions
diff --git a/platform/android/MapboxGLAndroidSDK/src/main/java/com/mapbox/mapboxsdk/location/LocationCameraController.java b/platform/android/MapboxGLAndroidSDK/src/main/java/com/mapbox/mapboxsdk/location/LocationCameraController.java
index d22f7a8514..79d2e02bf1 100644
--- a/platform/android/MapboxGLAndroidSDK/src/main/java/com/mapbox/mapboxsdk/location/LocationCameraController.java
+++ b/platform/android/MapboxGLAndroidSDK/src/main/java/com/mapbox/mapboxsdk/location/LocationCameraController.java
@@ -102,6 +102,10 @@ final class LocationCameraController {
long transitionDuration,
@Nullable Double zoom, @Nullable Double bearing, @Nullable Double tilt,
@Nullable OnLocationCameraTransitionListener internalTransitionListener) {
+ if (this.cameraMode == cameraMode) {
+ return;
+ }
+
final boolean wasTracking = isLocationTracking();
this.cameraMode = cameraMode;
diff --git a/platform/android/MapboxGLAndroidSDK/src/main/java/com/mapbox/mapboxsdk/location/LocationLayerController.java b/platform/android/MapboxGLAndroidSDK/src/main/java/com/mapbox/mapboxsdk/location/LocationLayerController.java
index c0c6017cd6..b18a7c4742 100644
--- a/platform/android/MapboxGLAndroidSDK/src/main/java/com/mapbox/mapboxsdk/location/LocationLayerController.java
+++ b/platform/android/MapboxGLAndroidSDK/src/main/java/com/mapbox/mapboxsdk/location/LocationLayerController.java
@@ -111,11 +111,8 @@ final class LocationLayerController {
removeLayers();
addLayers();
if (isHidden) {
- for (String layerId : layerSet) {
- setLayerVisibility(layerId, false);
- }
+ hide();
}
- setRenderMode(renderMode);
}
this.options = options;
@@ -131,49 +128,24 @@ final class LocationLayerController {
styleAccuracy(options.accuracyAlpha(), options.accuracyColor());
styleScaling(options);
determineIconsSource(options);
+
+ if (!isHidden) {
+ show();
+ }
}
void setRenderMode(@RenderMode.Mode int renderMode) {
- int previousMode = this.renderMode;
+ if (this.renderMode == renderMode) {
+ return;
+ }
this.renderMode = renderMode;
if (!isHidden) {
- boolean isStale = locationFeature.getBooleanProperty(PROPERTY_LOCATION_STALE);
- switch (renderMode) {
- case RenderMode.NORMAL:
- styleForeground(options);
- setLayerVisibility(SHADOW_LAYER, true);
- setLayerVisibility(FOREGROUND_LAYER, true);
- setLayerVisibility(BACKGROUND_LAYER, true);
- setLayerVisibility(ACCURACY_LAYER, !isStale);
- setLayerVisibility(BEARING_LAYER, false);
- break;
- case RenderMode.COMPASS:
- styleForeground(options);
- setLayerVisibility(SHADOW_LAYER, true);
- setLayerVisibility(FOREGROUND_LAYER, true);
- setLayerVisibility(BACKGROUND_LAYER, true);
- setLayerVisibility(ACCURACY_LAYER, !isStale);
- setLayerVisibility(BEARING_LAYER, true);
- break;
- case RenderMode.GPS:
- styleForeground(options);
- setLayerVisibility(SHADOW_LAYER, false);
- setLayerVisibility(FOREGROUND_LAYER, true);
- setLayerVisibility(BACKGROUND_LAYER, true);
- setLayerVisibility(ACCURACY_LAYER, false);
- setLayerVisibility(BEARING_LAYER, false);
- break;
- default:
- break;
- }
-
- determineIconsSource(options);
- }
-
- if (previousMode != renderMode) {
- internalRenderModeChangedListener.onRenderModeChanged(renderMode);
+ styleForeground(options);
+ show();
}
+ determineIconsSource(options);
+ internalRenderModeChangedListener.onRenderModeChanged(renderMode);
}
int getRenderMode() {
@@ -186,7 +158,32 @@ final class LocationLayerController {
void show() {
isHidden = false;
- setRenderMode(renderMode);
+ boolean isStale = locationFeature.getBooleanProperty(PROPERTY_LOCATION_STALE);
+ switch (renderMode) {
+ case RenderMode.NORMAL:
+ setLayerVisibility(SHADOW_LAYER, true);
+ setLayerVisibility(FOREGROUND_LAYER, true);
+ setLayerVisibility(BACKGROUND_LAYER, true);
+ setLayerVisibility(ACCURACY_LAYER, !isStale);
+ setLayerVisibility(BEARING_LAYER, false);
+ break;
+ case RenderMode.COMPASS:
+ setLayerVisibility(SHADOW_LAYER, true);
+ setLayerVisibility(FOREGROUND_LAYER, true);
+ setLayerVisibility(BACKGROUND_LAYER, true);
+ setLayerVisibility(ACCURACY_LAYER, !isStale);
+ setLayerVisibility(BEARING_LAYER, true);
+ break;
+ case RenderMode.GPS:
+ setLayerVisibility(SHADOW_LAYER, false);
+ setLayerVisibility(FOREGROUND_LAYER, true);
+ setLayerVisibility(BACKGROUND_LAYER, true);
+ setLayerVisibility(ACCURACY_LAYER, false);
+ setLayerVisibility(BEARING_LAYER, false);
+ break;
+ default:
+ break;
+ }
}
void hide() {