Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,8 @@

final class LocationLayerAnimator {

private static final int ONE_SECOND = 1000;

private final List<OnLayerAnimationsValuesChangeListener> layerListeners = new ArrayList<>();
private final List<OnCameraAnimationsValuesChangeListener> cameraListeners = new ArrayList<>();

Expand Down Expand Up @@ -58,6 +60,10 @@ void feedNewLocation(@NonNull Location newLocation, @NonNull CameraPosition curr
locationUpdateTimestamp = SystemClock.elapsedRealtime();
}

if (invalidUpdateInterval()) {
return;
}

LatLng previousLayerLatLng = getPreviousLayerLatLng();
float previousLayerBearing = getPreviousLayerGpsBearing();
LatLng previousCameraLatLng = currentCameraPosition.target;
Expand Down Expand Up @@ -179,6 +185,10 @@ void cancelAllAnimations() {
cancelCameraCompassAnimations();
}

private boolean invalidUpdateInterval() {
return (SystemClock.elapsedRealtime() - locationUpdateTimestamp) < ONE_SECOND;
}

private LatLng getPreviousLayerLatLng() {
LatLng previousLatLng;
if (layerLatLngAnimator != null) {
Expand Down

This file was deleted.

This file was deleted.

This file was deleted.