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 @@ -26,12 +26,14 @@ final class LocationLayerCamera implements LocationLayerAnimator.OnCameraAnimati
private boolean adjustFocalPoint;

private final MoveGestureDetector moveGestureDetector;
private final OnCameraMoveInvalidateListener onCameraMoveInvalidateListener;

LocationLayerCamera(
Context context,
MapboxMap mapboxMap,
OnCameraTrackingChangedListener internalCameraTrackingChangedListener,
LocationLayerOptions options) {
LocationLayerOptions options,
OnCameraMoveInvalidateListener onCameraMoveInvalidateListener) {
this.mapboxMap = mapboxMap;
mapboxMap.setGesturesManager(
new PluginsGesturesManager(context), true, true);
Expand All @@ -40,6 +42,7 @@ final class LocationLayerCamera implements LocationLayerAnimator.OnCameraAnimati
mapboxMap.addOnRotateListener(onRotateListener);

this.internalCameraTrackingChangedListener = internalCameraTrackingChangedListener;
this.onCameraMoveInvalidateListener = onCameraMoveInvalidateListener;
initializeOptions(options);
}

Expand All @@ -61,10 +64,12 @@ int getCameraMode() {

private void setBearing(float bearing) {
mapboxMap.moveCamera(CameraUpdateFactory.bearingTo(bearing));
onCameraMoveInvalidateListener.onInvalidateCameraMove();
}

private void setLatLng(LatLng latLng) {
mapboxMap.moveCamera(CameraUpdateFactory.newLatLng(latLng));
onCameraMoveInvalidateListener.onInvalidateCameraMove();
}

@Override
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -501,7 +501,7 @@ private void initialize() {

locationLayer = new LocationLayer(mapView, mapboxMap, options);
locationLayerCamera = new LocationLayerCamera(
mapView.getContext(), mapboxMap, cameraTrackingChangedListener, options);
mapView.getContext(), mapboxMap, cameraTrackingChangedListener, options, onCameraMoveInvalidateListener);
locationLayerAnimator = new LocationLayerAnimator();
locationLayerAnimator.addLayerListener(locationLayer);
locationLayerAnimator.addCameraListener(locationLayerCamera);
Expand Down Expand Up @@ -639,6 +639,13 @@ public void onMapChanged(int change) {
}
};

private OnCameraMoveInvalidateListener onCameraMoveInvalidateListener = new OnCameraMoveInvalidateListener() {
@Override
public void onInvalidateCameraMove() {
onCameraMoveListener.onCameraMove();
}
};

private CompassListener compassListener = new CompassListener() {
@Override
public void onCompassChanged(float userHeading) {
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
package com.mapbox.mapboxsdk.plugins.locationlayer;

interface OnCameraMoveInvalidateListener {

void onInvalidateCameraMove();

}