[android] prevent from reloading the location layer drawables on every location update

This commit is contained in:
Łukasz Paczos
2018-09-06 16:40:54 +02:00
committed by Łukasz Paczos
parent caebcd08e3
commit d625993da2
2 changed files with 12 additions and 3 deletions

View File

@@ -836,9 +836,7 @@ public final class LocationComponent {
return;
}
if (isEnabled && isComponentStarted) {
locationLayerController.show();
}
showLocationLayerIfHidden();
if (!fromLastLocation) {
staleStateManager.updateLatestLocationTime();
@@ -850,6 +848,13 @@ public final class LocationComponent {
lastLocation = location;
}
private void showLocationLayerIfHidden() {
boolean isLocationLayerHidden = locationLayerController.isHidden();
if (isEnabled && isComponentStarted && isLocationLayerHidden) {
locationLayerController.show();
}
}
private void updateCompassHeading(float heading) {
locationAnimatorCoordinator.feedNewCompassBearing(heading, mapboxMap.getCameraPosition());
}

View File

@@ -188,6 +188,10 @@ final class LocationLayerController implements MapboxAnimator.OnLayerAnimationsV
}
}
boolean isHidden() {
return isHidden;
}
private void setLayerVisibility(String layerId, boolean visible) {
Layer layer = mapboxMap.getLayer(layerId);
if (layer != null) {