diff options
Diffstat (limited to 'platform')
2 files changed, 12 insertions, 3 deletions
diff --git a/platform/android/MapboxGLAndroidSDK/src/main/java/com/mapbox/mapboxsdk/location/LocationComponent.java b/platform/android/MapboxGLAndroidSDK/src/main/java/com/mapbox/mapboxsdk/location/LocationComponent.java index 0503c5e9dc..01ef314bf4 100644 --- a/platform/android/MapboxGLAndroidSDK/src/main/java/com/mapbox/mapboxsdk/location/LocationComponent.java +++ b/platform/android/MapboxGLAndroidSDK/src/main/java/com/mapbox/mapboxsdk/location/LocationComponent.java @@ -836,9 +836,7 @@ public final class LocationComponent { return; } - if (isEnabled && isComponentStarted) { - locationLayerController.show(); - } + showLocationLayerIfHidden(); if (!fromLastLocation) { staleStateManager.updateLatestLocationTime(); @@ -850,6 +848,13 @@ public final class LocationComponent { lastLocation = location; } + private void showLocationLayerIfHidden() { + boolean isLocationLayerHidden = locationLayerController.isHidden(); + if (isEnabled && isComponentStarted && isLocationLayerHidden) { + locationLayerController.show(); + } + } + private void updateCompassHeading(float heading) { locationAnimatorCoordinator.feedNewCompassBearing(heading, mapboxMap.getCameraPosition()); } 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 75826f911b..da3144eea1 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 @@ -188,6 +188,10 @@ final class LocationLayerController implements MapboxAnimator.OnLayerAnimationsV } } + boolean isHidden() { + return isHidden; + } + private void setLayerVisibility(String layerId, boolean visible) { Layer layer = mapboxMap.getLayer(layerId); if (layer != null) { |