diff --git a/platform/android/MapboxGLAndroidSDK/src/main/java/com/mapbox/mapboxsdk/maps/MapboxMap.java b/platform/android/MapboxGLAndroidSDK/src/main/java/com/mapbox/mapboxsdk/maps/MapboxMap.java index 432dc0ae8a0..9ab883c133f 100644 --- a/platform/android/MapboxGLAndroidSDK/src/main/java/com/mapbox/mapboxsdk/maps/MapboxMap.java +++ b/platform/android/MapboxGLAndroidSDK/src/main/java/com/mapbox/mapboxsdk/maps/MapboxMap.java @@ -247,12 +247,10 @@ public final void moveCamera(CameraUpdate update) { public final void moveCamera(CameraUpdate update, MapboxMap.CancelableCallback callback) { mCameraPosition = update.getCameraPosition(this); mMapView.jumpTo(mCameraPosition.bearing, mCameraPosition.target, mCameraPosition.tilt, mCameraPosition.zoom); - if (mOnCameraChangeListener != null) { - mOnCameraChangeListener.onCameraChange(mCameraPosition); - } if (callback != null) { callback.onFinish(); } + invalidateCameraPosition(); } /** @@ -295,17 +293,15 @@ public void onCancel() { if (callback != null) { callback.onCancel(); } + invalidateCameraPosition(); } @Override public void onFinish() { - if (mOnCameraChangeListener != null) { - mOnCameraChangeListener.onCameraChange(mCameraPosition); - } - if (callback != null) { callback.onFinish(); } + invalidateCameraPosition(); } }); } @@ -365,6 +361,7 @@ public void onCancel() { if (callback != null) { callback.onCancel(); } + invalidateCameraPosition(); } @Override @@ -376,6 +373,7 @@ public void onFinish() { if (callback != null) { callback.onFinish(); } + invalidateCameraPosition(); } }); } @@ -395,7 +393,12 @@ private long getDurationNano(long durationMs) { */ private void invalidateCameraPosition() { mInvalidCameraPosition = false; - mCameraPosition = mMapView.invalidateCameraPosition(); + + CameraPosition cameraPosition = mMapView.invalidateCameraPosition(); + if (cameraPosition != null) { + mCameraPosition = cameraPosition; + } + if (mOnCameraChangeListener != null) { mOnCameraChangeListener.onCameraChange(mCameraPosition); }