summaryrefslogtreecommitdiff
path: root/platform/android/MapboxGLAndroidSDK/src/main/java/com/mapbox/mapboxsdk/location/LocationComponent.java
diff options
context:
space:
mode:
authorTobrun <tobrun.van.nuland@gmail.com>2018-12-07 19:25:29 +0200
committerTobrun <tobrun@mapbox.com>2018-12-10 19:09:07 +0100
commit1b7b4d47dc724761725a9fbf6ef4b9a23294d502 (patch)
tree41d94c57e3f2d2cb4990db020284fad1f438ceff /platform/android/MapboxGLAndroidSDK/src/main/java/com/mapbox/mapboxsdk/location/LocationComponent.java
parentef59c9d0b70d651f04b4465bcd5c6c4181c704f9 (diff)
downloadqtlocation-mapboxgl-1b7b4d47dc724761725a9fbf6ef4b9a23294d502.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.java10
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();
}