From 99e35f0c6e995c5d39ea96e779659e3b31f9e5e2 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=C5=81ukasz=20Paczos?= Date: Mon, 21 Jan 2019 18:34:46 +0100 Subject: [android] restore location layer visibility with new "layer-below" --- .../location/LocationLayerController.java | 1 + .../location/LocationLayerControllerTest.kt | 23 ++++++++++++++++++++++ 2 files changed, 24 insertions(+) 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() -- cgit v1.2.1