From aa9e6c59bb04f49360d5e7f0e19884206deb20ff Mon Sep 17 00:00:00 2001 From: Tobrun Date: Fri, 7 Dec 2018 19:25:29 +0200 Subject: [android] - optimise loaded style for location component, expose isFullyLoaded --- .../java/com/mapbox/mapboxsdk/location/LocationComponent.java | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) (limited to 'platform/android/MapboxGLAndroidSDK/src/main/java/com/mapbox/mapboxsdk/location/LocationComponent.java') 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 2391d6a86e..59ce2a900e 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 @@ -854,7 +854,8 @@ public final class LocationComponent { */ public void onFinishLoadingStyle() { if (isComponentInitialized) { - locationLayerController.initializeComponents(options); + style = mapboxMap.getStyle(); + locationLayerController.initializeComponents(style, options); locationCameraController.initializeOptions(options); onLocationLayerStart(); } @@ -913,7 +914,10 @@ public final class LocationComponent { if (isComponentInitialized) { return; } - isComponentInitialized = true; + + if (!style.isFullyLoaded()) { + throw new IllegalStateException("Style hasn't fully loaded yet, can't initialize LocationComponent."); + } this.style = style; this.options = options; @@ -946,6 +950,8 @@ public final class LocationComponent { setRenderMode(RenderMode.NORMAL); setCameraMode(CameraMode.NONE); + isComponentInitialized = true; + onLocationLayerStart(); } -- cgit v1.2.1