diff options
author | Tobrun <tobrun.van.nuland@gmail.com> | 2018-12-07 19:25:29 +0200 |
---|---|---|
committer | Tobrun <tobrun@mapbox.com> | 2018-12-10 16:59:50 +0100 |
commit | aa9e6c59bb04f49360d5e7f0e19884206deb20ff (patch) | |
tree | ec772695ca86fee43c22bb07cfd1b95f8fe77a53 /platform/android/MapboxGLAndroidSDK/src/main/java/com/mapbox/mapboxsdk/location/LocationComponent.java | |
parent | 8eaff9ce13b1a16bf347d27fde2d9ebfdd8665a4 (diff) | |
download | qtlocation-mapboxgl-aa9e6c59bb04f49360d5e7f0e19884206deb20ff.tar.gz |
[android] - optimise loaded style for location component, expose isFullyLoaded
Diffstat (limited to 'platform/android/MapboxGLAndroidSDK/src/main/java/com/mapbox/mapboxsdk/location/LocationComponent.java')
-rw-r--r-- | platform/android/MapboxGLAndroidSDK/src/main/java/com/mapbox/mapboxsdk/location/LocationComponent.java | 10 |
1 files changed, 8 insertions, 2 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 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(); } |