summaryrefslogtreecommitdiff
path: root/platform/android/MapboxGLAndroidSDK/src/main/java/com/mapbox/mapboxsdk/maps/MapboxMap.java
diff options
context:
space:
mode:
Diffstat (limited to 'platform/android/MapboxGLAndroidSDK/src/main/java/com/mapbox/mapboxsdk/maps/MapboxMap.java')
-rw-r--r--platform/android/MapboxGLAndroidSDK/src/main/java/com/mapbox/mapboxsdk/maps/MapboxMap.java33
1 files changed, 29 insertions, 4 deletions
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 e03358158f..fa34e5b1f7 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
@@ -12,6 +12,7 @@ import android.support.annotation.Size;
import android.support.annotation.UiThread;
import android.text.TextUtils;
import android.view.View;
+
import com.mapbox.android.gestures.AndroidGesturesManager;
import com.mapbox.android.gestures.MoveGestureDetector;
import com.mapbox.android.gestures.RotateGestureDetector;
@@ -63,6 +64,7 @@ public final class MapboxMap {
private final CameraChangeDispatcher cameraChangeDispatcher;
private final OnGesturesManagerInteractionListener onGesturesManagerInteractionListener;
private final List<Style.OnStyleLoaded> awaitingStyleGetters = new ArrayList<>();
+ private final List<OnDeveloperAnimationListener> developerAnimationStartedListeners;
@Nullable
private Style.OnStyleLoaded styleLoadedCallback;
@@ -79,13 +81,15 @@ public final class MapboxMap {
private boolean debugActive;
MapboxMap(NativeMap map, Transform transform, UiSettings ui, Projection projection,
- OnGesturesManagerInteractionListener listener, CameraChangeDispatcher cameraChangeDispatcher) {
+ OnGesturesManagerInteractionListener listener, CameraChangeDispatcher cameraChangeDispatcher,
+ List<OnDeveloperAnimationListener> developerAnimationStartedListeners) {
this.nativeMapView = map;
this.uiSettings = ui;
this.projection = projection;
this.transform = transform;
this.onGesturesManagerInteractionListener = listener;
this.cameraChangeDispatcher = cameraChangeDispatcher;
+ this.developerAnimationStartedListeners = developerAnimationStartedListeners;
}
void initialise(@NonNull Context context, @NonNull MapboxMapOptions options) {
@@ -414,6 +418,7 @@ public final class MapboxMap {
*/
public final void moveCamera(@NonNull final CameraUpdate update,
@Nullable final MapboxMap.CancelableCallback callback) {
+ notifyDeveloperAnimationListeners();
transform.moveCamera(MapboxMap.this, update, callback);
}
@@ -522,10 +527,10 @@ public final class MapboxMap {
final int durationMs,
final boolean easingInterpolator,
@Nullable final MapboxMap.CancelableCallback callback) {
-
if (durationMs <= 0) {
throw new IllegalArgumentException("Null duration passed into easeCamera");
}
+ notifyDeveloperAnimationListeners();
transform.easeCamera(MapboxMap.this, update, durationMs, easingInterpolator, callback);
}
@@ -596,7 +601,7 @@ public final class MapboxMap {
if (durationMs <= 0) {
throw new IllegalArgumentException("Null duration passed into animateCamera");
}
-
+ notifyDeveloperAnimationListeners();
transform.animateCamera(MapboxMap.this, update, durationMs, callback);
}
@@ -608,7 +613,7 @@ public final class MapboxMap {
* @param y Amount of pixels to scroll to in y direction
*/
public void scrollBy(float x, float y) {
- nativeMapView.moveBy(x, y, 0);
+ scrollBy(x, y, 0);
}
/**
@@ -620,6 +625,7 @@ public final class MapboxMap {
* @param duration Amount of time the scrolling should take
*/
public void scrollBy(float x, float y, long duration) {
+ notifyDeveloperAnimationListeners();
nativeMapView.moveBy(x, y, duration);
}
@@ -631,6 +637,7 @@ public final class MapboxMap {
* Resets the map view to face north.
*/
public void resetNorth() {
+ notifyDeveloperAnimationListeners();
transform.resetNorth();
}
@@ -643,6 +650,7 @@ public final class MapboxMap {
* @param duration The duration of the transformation
*/
public void setFocalBearing(double bearing, float focalX, float focalY, long duration) {
+ notifyDeveloperAnimationListeners();
transform.setBearing(bearing, focalX, focalY, duration);
}
@@ -2342,6 +2350,17 @@ public final class MapboxMap {
void onSnapshotReady(@NonNull Bitmap snapshot);
}
+ /**
+ * Internal use.
+ */
+ public interface OnDeveloperAnimationListener {
+
+ /**
+ * Notifies listener when a developer invoked animation is about to start.
+ */
+ void onDeveloperAnimationStarted();
+ }
+
//
// Used for instrumentation testing
//
@@ -2349,4 +2368,10 @@ public final class MapboxMap {
Transform getTransform() {
return transform;
}
+
+ private void notifyDeveloperAnimationListeners() {
+ for (OnDeveloperAnimationListener listener : developerAnimationStartedListeners) {
+ listener.onDeveloperAnimationStarted();
+ }
+ }
}