diff options
author | Łukasz Paczos <lukas.paczos@gmail.com> | 2019-01-21 18:34:46 +0100 |
---|---|---|
committer | Łukasz Paczos <lukas.paczos@gmail.com> | 2019-01-21 18:34:46 +0100 |
commit | a4377705e7475fb0eca42d6a235f5c9e9a6b7404 (patch) | |
tree | a04f0cdc6f0dc201eb9a1b176dd1781cd3fe2b0c | |
parent | d0e7326e5d42dbed0792c535fd4f25b920b057f0 (diff) | |
download | qtlocation-mapboxgl-upstream/lp-fix-location-compass-regression.tar.gz |
[android] restore location layer visibility with new "layer-below"upstream/lp-fix-location-compass-regression
2 files changed, 24 insertions, 0 deletions
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 c97713cfb5..f5d92ae810 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 @@ -107,6 +107,7 @@ final class LocationLayerController implements MapboxAnimator.OnLayerAnimationsV if (layerBelow == null || !layerBelow.equals(newLayerBelowOption)) { removeLayers(); addLayers(newLayerBelowOption); + setRenderMode(renderMode); } } diff --git a/platform/android/MapboxGLAndroidSDKTestApp/src/androidTest/java/com/mapbox/mapboxsdk/location/LocationLayerControllerTest.kt b/platform/android/MapboxGLAndroidSDKTestApp/src/androidTest/java/com/mapbox/mapboxsdk/location/LocationLayerControllerTest.kt index 44126647c0..248e8dc481 100644 --- a/platform/android/MapboxGLAndroidSDKTestApp/src/androidTest/java/com/mapbox/mapboxsdk/location/LocationLayerControllerTest.kt +++ b/platform/android/MapboxGLAndroidSDKTestApp/src/androidTest/java/com/mapbox/mapboxsdk/location/LocationLayerControllerTest.kt @@ -388,6 +388,29 @@ class LocationLayerControllerTest : EspressoTest() { executeComponentTest(componentAction) } + @Test + fun applyStyle_layerBelow_restoreLayerVisibility() { + val componentAction = object : LocationComponentAction.OnPerformLocationComponentAction { + override fun onLocationComponentAction(component: LocationComponent, mapboxMap: MapboxMap, + uiController: UiController, context: Context) { + component.activateLocationComponent(context, mapboxMap.style!!,false) + component.isLocationComponentEnabled = true + component.forceLocationUpdate(location) + mapboxMap.waitForLayer(uiController, location, FOREGROUND_LAYER) + uiController.loopMainThreadForAtLeast(150) + + component.applyStyle(LocationComponentOptions.builder(context).layerBelow("road-label").build()) + + assertThat(mapboxMap.isLayerVisible(FOREGROUND_LAYER), `is`(true)) + assertThat(mapboxMap.isLayerVisible(BACKGROUND_LAYER), `is`(true)) + assertThat(mapboxMap.isLayerVisible(SHADOW_LAYER), `is`(true)) + assertThat(mapboxMap.isLayerVisible(ACCURACY_LAYER), `is`(true)) + assertThat(mapboxMap.isLayerVisible(BEARING_LAYER), `is`(false)) + } + } + executeComponentTest(componentAction) + } + @After override fun afterTest() { super.afterTest() |