[android] prevent from reloading the location layer drawables on every location update
This commit is contained in:
committed by
Łukasz Paczos
parent
caebcd08e3
commit
d625993da2
@@ -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());
|
||||
}
|
||||
|
||||
@@ -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) {
|
||||
|
||||
Reference in New Issue
Block a user