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.java404
1 files changed, 68 insertions, 336 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 cbd3842a02..5e36dd0f78 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
@@ -4,7 +4,6 @@ import android.content.Context;
import android.graphics.Bitmap;
import android.graphics.PointF;
import android.graphics.RectF;
-import android.location.Location;
import android.os.Bundle;
import android.support.annotation.FloatRange;
import android.support.annotation.IntRange;
@@ -16,7 +15,6 @@ import android.text.TextUtils;
import android.view.View;
import android.view.ViewGroup;
-import com.mapbox.android.core.location.LocationEngine;
import com.mapbox.android.gestures.AndroidGesturesManager;
import com.mapbox.android.gestures.MoveGestureDetector;
import com.mapbox.android.gestures.RotateGestureDetector;
@@ -39,13 +37,10 @@ import com.mapbox.mapboxsdk.camera.CameraPosition;
import com.mapbox.mapboxsdk.camera.CameraUpdate;
import com.mapbox.mapboxsdk.camera.CameraUpdateFactory;
import com.mapbox.mapboxsdk.constants.MapboxConstants;
-import com.mapbox.mapboxsdk.constants.MyBearingTracking;
-import com.mapbox.mapboxsdk.constants.MyLocationTracking;
import com.mapbox.mapboxsdk.constants.Style;
import com.mapbox.mapboxsdk.geometry.LatLng;
import com.mapbox.mapboxsdk.geometry.LatLngBounds;
-import com.mapbox.mapboxsdk.maps.widgets.MyLocationViewSettings;
-import com.mapbox.mapboxsdk.style.layers.Filter;
+import com.mapbox.mapboxsdk.style.expressions.Expression;
import com.mapbox.mapboxsdk.style.layers.Layer;
import com.mapbox.mapboxsdk.style.light.Light;
import com.mapbox.mapboxsdk.style.sources.Source;
@@ -71,26 +66,21 @@ public final class MapboxMap {
private final NativeMapView nativeMapView;
private final UiSettings uiSettings;
- private final TrackingSettings trackingSettings;
private final Projection projection;
private final Transform transform;
private final AnnotationManager annotationManager;
- private final MyLocationViewSettings myLocationViewSettings;
private final CameraChangeDispatcher cameraChangeDispatcher;
private final OnGesturesManagerInteractionListener onGesturesManagerInteractionListener;
private MapboxMap.OnFpsChangedListener onFpsChangedListener;
- private PointF focalPoint;
- MapboxMap(NativeMapView map, Transform transform, UiSettings ui, TrackingSettings tracking,
- MyLocationViewSettings myLocationView, Projection projection, OnGesturesManagerInteractionListener listener,
- AnnotationManager annotations, CameraChangeDispatcher cameraChangeDispatcher) {
+ MapboxMap(NativeMapView map, Transform transform, UiSettings ui, Projection projection,
+ OnGesturesManagerInteractionListener listener, AnnotationManager annotations,
+ CameraChangeDispatcher cameraChangeDispatcher) {
this.nativeMapView = map;
this.uiSettings = ui;
- this.trackingSettings = tracking;
this.projection = projection;
- this.myLocationViewSettings = myLocationView;
this.annotationManager = annotations.bind(this);
this.transform = transform;
this.onGesturesManagerInteractionListener = listener;
@@ -100,8 +90,6 @@ public final class MapboxMap {
void initialise(@NonNull Context context, @NonNull MapboxMapOptions options) {
transform.initialise(this, options);
uiSettings.initialise(context, options);
- myLocationViewSettings.initialise(options);
- trackingSettings.initialise(options);
// Map configuration
setDebugActive(options.getDebugActive());
@@ -115,8 +103,7 @@ public final class MapboxMap {
*/
void onStart() {
nativeMapView.update();
- trackingSettings.onStart();
- if (TextUtils.isEmpty(nativeMapView.getStyleUrl())) {
+ if (TextUtils.isEmpty(nativeMapView.getStyleUrl()) && TextUtils.isEmpty(nativeMapView.getStyleJson())) {
// if user hasn't loaded a Style yet
nativeMapView.setStyleUrl(Style.MAPBOX_STREETS);
}
@@ -126,7 +113,6 @@ public final class MapboxMap {
* Called when the hosting Activity/Fragment onStop() method is called.
*/
void onStop() {
- trackingSettings.onStop();
}
/**
@@ -138,9 +124,7 @@ public final class MapboxMap {
outState.putParcelable(MapboxConstants.STATE_CAMERA_POSITION, transform.getCameraPosition());
outState.putBoolean(MapboxConstants.STATE_DEBUG_ACTIVE, nativeMapView.getDebug());
outState.putString(MapboxConstants.STATE_STYLE_URL, nativeMapView.getStyleUrl());
- trackingSettings.onSaveInstanceState(outState);
uiSettings.onSaveInstanceState(outState);
- myLocationViewSettings.onSaveInstanceState(outState);
}
/**
@@ -151,9 +135,7 @@ public final class MapboxMap {
void onRestoreInstanceState(Bundle savedInstanceState) {
final CameraPosition cameraPosition = savedInstanceState.getParcelable(MapboxConstants.STATE_CAMERA_POSITION);
- myLocationViewSettings.onRestoreInstanceState(savedInstanceState);
uiSettings.onRestoreInstanceState(savedInstanceState);
- trackingSettings.onRestoreInstanceState(savedInstanceState);
if (cameraPosition != null) {
moveCamera(CameraUpdateFactory.newCameraPosition(
@@ -173,6 +155,7 @@ public final class MapboxMap {
* Called before the OnMapReadyCallback is invoked.
*/
void onPreMapReady() {
+ invalidateCameraPosition();
annotationManager.reloadMarkers();
annotationManager.adjustTopOffsetPixels(this);
}
@@ -192,7 +175,6 @@ public final class MapboxMap {
* Called when the region is changing or has changed.
*/
void onUpdateRegionChange() {
- trackingSettings.update();
annotationManager.update();
}
@@ -560,38 +542,6 @@ public final class MapboxMap {
}
//
- // TrackingSettings
- //
-
- /**
- * Gets the tracking interface settings for the map.
- *
- * @return the TrackingSettings asssociated with this map
- * @deprecated use location layer plugin from
- * https://github.com/mapbox/mapbox-plugins-android/tree/master/plugin-locationlayer instead.
- */
- @Deprecated
- public TrackingSettings getTrackingSettings() {
- return trackingSettings;
- }
-
- //
- // MyLocationViewSettings
- //
-
- /**
- * Gets the settings of the user location for the map.
- *
- * @return the MyLocationViewSettings associated with this map
- * @deprecated use location layer plugin from
- * https://github.com/mapbox/mapbox-plugins-android/tree/master/plugin-locationlayer instead.
- */
- @Deprecated
- public MyLocationViewSettings getMyLocationViewSettings() {
- return myLocationViewSettings;
- }
-
- //
// Projection
//
@@ -606,7 +556,7 @@ public final class MapboxMap {
}
//
- //
+ // Light
//
/**
@@ -624,47 +574,6 @@ public final class MapboxMap {
//
/**
- * Moves the center of the screen to a latitude and longitude specified by a LatLng object. This centers the
- * camera on the LatLng object.
- *
- * @param latLng Target location to change to
- */
- public void setLatLng(@NonNull LatLng latLng) {
- nativeMapView.setLatLng(latLng);
- }
-
- /**
- * Moves the camera viewpoint to a particular zoom level.
- *
- * @param zoom Zoom level to change to
- */
- public void setZoom(@FloatRange(from = MapboxConstants.MINIMUM_ZOOM, to = MapboxConstants.MAXIMUM_ZOOM) double zoom) {
- if (focalPoint == null) {
- focalPoint = new PointF(nativeMapView.getWidth() / 2, nativeMapView.getHeight() / 2);
- }
- nativeMapView.setZoom(zoom, focalPoint, 0);
- }
-
- /**
- * Moves the camera viewpoint angle to a particular angle in degrees.
- *
- * @param tilt Tilt angle to change to
- */
- public void setTilt(@FloatRange(from = MapboxConstants.MINIMUM_TILT, to = MapboxConstants.MAXIMUM_TILT) double tilt) {
- nativeMapView.setPitch(tilt, 0);
- }
-
- /**
- * Moves the camera viewpoint direction to a particular angle in degrees.
- *
- * @param bearing Direction angle to change to
- */
- public void setBearing(@FloatRange(from = MapboxConstants.MINIMUM_DIRECTION, to = MapboxConstants.MAXIMUM_DIRECTION)
- double bearing) {
- nativeMapView.setBearing(bearing);
- }
-
- /**
* Cancels ongoing animations.
* <p>
* This invokes the {@link CancelableCallback} for ongoing camera updates.
@@ -791,11 +700,6 @@ public final class MapboxMap {
* unless specified within {@link CameraUpdate}. A callback can be used to be notified when
* easing the camera stops. If {@link #getCameraPosition()} is called during the animation, it
* will return the current location of the camera in flight.
- * <p>
- * Note that this will cancel location tracking mode if enabled. You can change this behaviour by calling
- * {@link com.mapbox.mapboxsdk.maps.TrackingSettings#setDismissLocationTrackingOnGesture(boolean)} with false before
- * invoking this method and calling it with true in the {@link CancelableCallback#onFinish()}.
- * </p>
*
* @param update The change that should be applied to the camera.
* @param durationMs The duration of the animation in milliseconds. This must be strictly
@@ -817,11 +721,6 @@ public final class MapboxMap {
* unless specified within {@link CameraUpdate}. A callback can be used to be notified when
* easing the camera stops. If {@link #getCameraPosition()} is called during the animation, it
* will return the current location of the camera in flight.
- * <p>
- * Note that this will cancel location tracking mode if enabled. You can change this behaviour by calling
- * {@link com.mapbox.mapboxsdk.maps.TrackingSettings#setDismissLocationTrackingOnGesture(boolean)} with false before
- * invoking this method and calling it with true in the {@link CancelableCallback#onFinish()}.
- * </p>
*
* @param update The change that should be applied to the camera.
* @param durationMs The duration of the animation in milliseconds. This must be strictly
@@ -917,7 +816,7 @@ public final class MapboxMap {
/**
* Invalidates the current camera position by reconstructing it from mbgl
*/
- void invalidateCameraPosition() {
+ private void invalidateCameraPosition() {
CameraPosition cameraPosition = transform.invalidateCameraPosition();
if (cameraPosition != null) {
transform.updateCameraPosition(cameraPosition);
@@ -1652,19 +1551,8 @@ public final class MapboxMap {
* @return the camera position that fits the bounds and padding
*/
public CameraPosition getCameraForLatLngBounds(@Nullable LatLngBounds latLngBounds, int[] padding) {
- // calculate and set additional bounds padding
- int[] mapPadding = getPadding();
- for (int i = 0; i < padding.length; i++) {
- padding[i] = mapPadding[i] + padding[i];
- }
- projection.setContentPadding(padding, myLocationViewSettings.getPadding());
-
// get padded camera position from LatLngBounds
- CameraPosition cameraPosition = nativeMapView.getCameraForLatLngBounds(latLngBounds);
-
- // reset map padding
- setPadding(mapPadding);
- return cameraPosition;
+ return nativeMapView.getCameraForLatLngBounds(latLngBounds, padding);
}
/**
@@ -1676,19 +1564,8 @@ public final class MapboxMap {
* @return the camera position that fits the bounds and padding
*/
public CameraPosition getCameraForGeometry(Geometry geometry, double bearing, int[] padding) {
- // calculate and set additional bounds padding
- int[] mapPadding = getPadding();
- for (int i = 0; i < padding.length; i++) {
- padding[i] = mapPadding[i] + padding[i];
- }
- projection.setContentPadding(padding, myLocationViewSettings.getPadding());
-
- // get padded camera position from LatLngBounds
- CameraPosition cameraPosition = nativeMapView.getCameraForGeometry(geometry, bearing);
-
- // reset map padding
- setPadding(mapPadding);
- return cameraPosition;
+ // get padded camera position from Geometry
+ return nativeMapView.getCameraForGeometry(geometry, bearing, padding);
}
//
@@ -1697,13 +1574,13 @@ public final class MapboxMap {
/**
* <p>
- * Sets the distance from the edges of the map view’s frame to the edges of the map
- * view’s logical viewport.
+ * Sets the distance from the edges of the map view&#x27;s frame to the edges of the map
+ * view&#x27s logical viewport.
* </p>
* <p>
* When the value of this property is equal to {0,0,0,0}, viewport
- * properties such as `centerCoordinate` assume a viewport that matches the map
- * view’s frame. Otherwise, those properties are inset, excluding part of the
+ * properties such as &#x27;centerCoordinate&#x27; assume a viewport that matches the map
+ * view&#x27;s frame. Otherwise, those properties are inset, excluding part of the
* frame from the viewport. For instance, if the only the top edge is inset, the
* map center is effectively shifted downward.
* </p>
@@ -1718,7 +1595,7 @@ public final class MapboxMap {
}
private void setPadding(int[] padding) {
- projection.setContentPadding(padding, myLocationViewSettings.getPadding());
+ projection.setContentPadding(padding);
uiSettings.invalidate();
}
@@ -1763,7 +1640,7 @@ public final class MapboxMap {
*
* @param listener the listener to notify
*/
- public void addOnCameraIdleListener(@Nullable OnCameraIdleListener listener) {
+ public void addOnCameraIdleListener(@NonNull OnCameraIdleListener listener) {
cameraChangeDispatcher.addOnCameraIdleListener(listener);
}
@@ -1772,7 +1649,7 @@ public final class MapboxMap {
*
* @param listener the listener to remove
*/
- public void removeOnCameraIdleListener(@Nullable OnCameraIdleListener listener) {
+ public void removeOnCameraIdleListener(@NonNull OnCameraIdleListener listener) {
cameraChangeDispatcher.removeOnCameraIdleListener(listener);
}
@@ -1793,7 +1670,7 @@ public final class MapboxMap {
*
* @param listener the listener to notify
*/
- public void addOnCameraMoveCancelListener(@Nullable OnCameraMoveCanceledListener listener) {
+ public void addOnCameraMoveCancelListener(@NonNull OnCameraMoveCanceledListener listener) {
cameraChangeDispatcher.addOnCameraMoveCancelListener(listener);
}
@@ -1802,7 +1679,7 @@ public final class MapboxMap {
*
* @param listener the listener to remove
*/
- public void removeOnCameraMoveCancelListener(@Nullable OnCameraMoveCanceledListener listener) {
+ public void removeOnCameraMoveCancelListener(@NonNull OnCameraMoveCanceledListener listener) {
cameraChangeDispatcher.removeOnCameraMoveCancelListener(listener);
}
@@ -1823,7 +1700,7 @@ public final class MapboxMap {
*
* @param listener the listener to notify
*/
- public void addOnCameraMoveStartedListener(@Nullable OnCameraMoveStartedListener listener) {
+ public void addOnCameraMoveStartedListener(@NonNull OnCameraMoveStartedListener listener) {
cameraChangeDispatcher.addOnCameraMoveStartedListener(listener);
}
@@ -1832,7 +1709,7 @@ public final class MapboxMap {
*
* @param listener the listener to remove
*/
- public void removeOnCameraMoveStartedListener(@Nullable OnCameraMoveStartedListener listener) {
+ public void removeOnCameraMoveStartedListener(@NonNull OnCameraMoveStartedListener listener) {
cameraChangeDispatcher.removeOnCameraMoveStartedListener(listener);
}
@@ -1853,7 +1730,7 @@ public final class MapboxMap {
*
* @param listener the listener to notify
*/
- public void addOnCameraMoveListener(@Nullable OnCameraMoveListener listener) {
+ public void addOnCameraMoveListener(@NonNull OnCameraMoveListener listener) {
cameraChangeDispatcher.addOnCameraMoveListener(listener);
}
@@ -1862,7 +1739,7 @@ public final class MapboxMap {
*
* @param listener the listener to remove
*/
- public void removeOnCameraMoveListener(@Nullable OnCameraMoveListener listener) {
+ public void removeOnCameraMoveListener(@NonNull OnCameraMoveListener listener) {
cameraChangeDispatcher.removeOnCameraMoveListener(listener);
}
@@ -1898,9 +1775,8 @@ public final class MapboxMap {
* Adds a callback that's invoked when the map is scrolled.
*
* @param listener The callback that's invoked when the map is scrolled.
- * To unset the callback, use null.
*/
- public void addOnScrollListener(@Nullable OnScrollListener listener) {
+ public void addOnScrollListener(@NonNull OnScrollListener listener) {
onGesturesManagerInteractionListener.onAddScrollListener(listener);
}
@@ -1908,9 +1784,8 @@ public final class MapboxMap {
* Removes a callback that's invoked when the map is scrolled.
*
* @param listener The callback that's invoked when the map is scrolled.
- * To unset the callback, use null.
*/
- public void removeOnScrollListener(@Nullable OnScrollListener listener) {
+ public void removeOnScrollListener(@NonNull OnScrollListener listener) {
onGesturesManagerInteractionListener.onRemoveScrollListener(listener);
}
@@ -1930,9 +1805,8 @@ public final class MapboxMap {
* Adds a callback that's invoked when the map is flinged.
*
* @param listener The callback that's invoked when the map is flinged.
- * To unset the callback, use null.
*/
- public void addOnFlingListener(@Nullable OnFlingListener listener) {
+ public void addOnFlingListener(@NonNull OnFlingListener listener) {
onGesturesManagerInteractionListener.onAddFlingListener(listener);
}
@@ -1940,9 +1814,8 @@ public final class MapboxMap {
* Removes a callback that's invoked when the map is flinged.
*
* @param listener The callback that's invoked when the map is flinged.
- * To unset the callback, use null.
*/
- public void removeOnFlingListener(@Nullable OnFlingListener listener) {
+ public void removeOnFlingListener(@NonNull OnFlingListener listener) {
onGesturesManagerInteractionListener.onRemoveFlingListener(listener);
}
@@ -1951,7 +1824,7 @@ public final class MapboxMap {
*
* @param listener The callback that's invoked when the map is moved.
*/
- public void addOnMoveListener(OnMoveListener listener) {
+ public void addOnMoveListener(@NonNull OnMoveListener listener) {
onGesturesManagerInteractionListener.onAddMoveListener(listener);
}
@@ -1960,7 +1833,7 @@ public final class MapboxMap {
*
* @param listener The callback that's invoked when the map is moved.
*/
- public void removeOnMoveListener(OnMoveListener listener) {
+ public void removeOnMoveListener(@NonNull OnMoveListener listener) {
onGesturesManagerInteractionListener.onRemoveMoveListener(listener);
}
@@ -1969,7 +1842,7 @@ public final class MapboxMap {
*
* @param listener The callback that's invoked when the map is rotated.
*/
- public void addOnRotateListener(OnRotateListener listener) {
+ public void addOnRotateListener(@NonNull OnRotateListener listener) {
onGesturesManagerInteractionListener.onAddRotateListener(listener);
}
@@ -1978,7 +1851,7 @@ public final class MapboxMap {
*
* @param listener The callback that's invoked when the map is rotated.
*/
- public void removeOnRotateListener(OnRotateListener listener) {
+ public void removeOnRotateListener(@NonNull OnRotateListener listener) {
onGesturesManagerInteractionListener.onRemoveRotateListener(listener);
}
@@ -1987,7 +1860,7 @@ public final class MapboxMap {
*
* @param listener The callback that's invoked when the map is scaled.
*/
- public void addOnScaleListener(OnScaleListener listener) {
+ public void addOnScaleListener(@NonNull OnScaleListener listener) {
onGesturesManagerInteractionListener.onAddScaleListener(listener);
}
@@ -1996,7 +1869,7 @@ public final class MapboxMap {
*
* @param listener The callback that's invoked when the map is scaled.
*/
- public void removeOnScaleListener(OnScaleListener listener) {
+ public void removeOnScaleListener(@NonNull OnScaleListener listener) {
onGesturesManagerInteractionListener.onRemoveScaleListener(listener);
}
@@ -2005,7 +1878,7 @@ public final class MapboxMap {
*
* @param listener The callback that's invoked when the map is tilted.
*/
- public void addOnShoveListener(OnShoveListener listener) {
+ public void addOnShoveListener(@NonNull OnShoveListener listener) {
onGesturesManagerInteractionListener.onAddShoveListener(listener);
}
@@ -2014,22 +1887,30 @@ public final class MapboxMap {
*
* @param listener The callback that's invoked when the map is tilted.
*/
- public void removeOnShoveListener(OnShoveListener listener) {
+ public void removeOnShoveListener(@NonNull OnShoveListener listener) {
onGesturesManagerInteractionListener.onRemoveShoveListener(listener);
}
/**
- * Sets a custom {@link AndroidGesturesManager} to handle {@link android.view.MotionEvent}s registered by the map.
+ * Sets a custom {@link AndroidGesturesManager} to handle {@link android.view.MotionEvent}s
+ * registered by the {@link MapView}.
*
- * @param androidGesturesManager Gestures manager that interprets gestures based on the motion events.
+ * @param androidGesturesManager Gestures manager that interprets gestures based on the motion events.
+ * @param attachDefaultListeners If true, pre-defined listeners will be attach
+ * to change map based on {@link AndroidGesturesManager} callbacks.
+ * @param setDefaultMutuallyExclusives If true, pre-defined mutually exclusive gesture sets
+ * will be added to the passed gestures manager.
* @see <a href="https://github.com/mapbox/mapbox-gestures-android">mapbox-gestures-android library</a>
*/
- public void setGesturesManager(AndroidGesturesManager androidGesturesManager) {
- onGesturesManagerInteractionListener.setGesturesManager(androidGesturesManager);
+ public void setGesturesManager(AndroidGesturesManager androidGesturesManager, boolean attachDefaultListeners,
+ boolean setDefaultMutuallyExclusives) {
+ onGesturesManagerInteractionListener.setGesturesManager(
+ androidGesturesManager, attachDefaultListeners, setDefaultMutuallyExclusives);
}
/**
- * Get current {@link AndroidGesturesManager} that handles {@link android.view.MotionEvent}s registered by the map.
+ * Get current {@link AndroidGesturesManager} that handles {@link android.view.MotionEvent}s
+ * registered by the {@link MapView}
*
* @return Current gestures manager.
*/
@@ -2038,6 +1919,13 @@ public final class MapboxMap {
}
/**
+ * Interrupts any ongoing gesture velocity animations.
+ */
+ public void cancelAllVelocityAnimations() {
+ onGesturesManagerInteractionListener.cancelAllVelocityAnimations();
+ }
+
+ /**
* Sets a callback that's invoked when the user clicks on the map view.
*
* @param listener The callback that's invoked when the user clicks on the map view.
@@ -2053,9 +1941,8 @@ public final class MapboxMap {
* Adds a callback that's invoked when the user clicks on the map view.
*
* @param listener The callback that's invoked when the user clicks on the map view.
- * To unset the callback, use null.
*/
- public void addOnMapClickListener(@Nullable OnMapClickListener listener) {
+ public void addOnMapClickListener(@NonNull OnMapClickListener listener) {
onGesturesManagerInteractionListener.onAddMapClickListener(listener);
}
@@ -2063,9 +1950,8 @@ public final class MapboxMap {
* Removes a callback that's invoked when the user clicks on the map view.
*
* @param listener The callback that's invoked when the user clicks on the map view.
- * To unset the callback, use null.
*/
- public void removeOnMapClickListener(@Nullable OnMapClickListener listener) {
+ public void removeOnMapClickListener(@NonNull OnMapClickListener listener) {
onGesturesManagerInteractionListener.onRemoveMapClickListener(listener);
}
@@ -2085,9 +1971,8 @@ public final class MapboxMap {
* Adds a callback that's invoked when the user long clicks on the map view.
*
* @param listener The callback that's invoked when the user long clicks on the map view.
- * To unset the callback, use null.
*/
- public void addOnMapLongClickListener(@Nullable OnMapLongClickListener listener) {
+ public void addOnMapLongClickListener(@NonNull OnMapLongClickListener listener) {
onGesturesManagerInteractionListener.onAddMapLongClickListener(listener);
}
@@ -2095,9 +1980,8 @@ public final class MapboxMap {
* Removes a callback that's invoked when the user long clicks on the map view.
*
* @param listener The callback that's invoked when the user long clicks on the map view.
- * To unset the callback, use null.
*/
- public void removeOnMapLongClickListener(@Nullable OnMapLongClickListener listener) {
+ public void removeOnMapLongClickListener(@NonNull OnMapLongClickListener listener) {
onGesturesManagerInteractionListener.onRemoveMapLongClickListener(listener);
}
@@ -2159,107 +2043,6 @@ public final class MapboxMap {
}
//
- // User location
- //
-
- /**
- * Returns the status of the my-location layer.
- *
- * @return True if the my-location layer is enabled, false otherwise.
- * @deprecated use location layer plugin from
- * https://github.com/mapbox/mapbox-plugins-android/tree/master/plugin-locationlayer instead.
- */
- @Deprecated
- public boolean isMyLocationEnabled() {
- return trackingSettings.isMyLocationEnabled();
- }
-
- /**
- * <p>
- * Enables or disables the my-location layer.
- * While enabled, the my-location layer continuously draws an indication of a user's current
- * location and bearing.
- * </p>
- * In order to use the my-location layer feature you need to request permission for either
- * android.Manifest.permission#ACCESS_COARSE_LOCATION or android.Manifest.permission#ACCESS_FINE_LOCATION.
- *
- * @param enabled True to enable; false to disable.
- * @deprecated use location layer plugin from
- * https://github.com/mapbox/mapbox-plugins-android/tree/master/plugin-locationlayer instead.
- */
- @Deprecated
- public void setMyLocationEnabled(boolean enabled) {
- trackingSettings.setMyLocationEnabled(enabled);
- }
-
- /**
- * Returns the currently displayed user location, or null if there is no location data available.
- *
- * @return The currently displayed user location.
- * @deprecated use location layer plugin from
- * https://github.com/mapbox/mapbox-plugins-android/tree/master/plugin-locationlayer instead.
- */
- @Nullable
- @Deprecated
- public Location getMyLocation() {
- return trackingSettings.getMyLocation();
- }
-
- /**
- * Sets a callback that's invoked when the the My Location view
- * (which signifies the user's location) changes location.
- *
- * @param listener The callback that's invoked when the user clicks on a marker.
- * To unset the callback, use null.
- * @deprecated use location layer plugin from
- * https://github.com/mapbox/mapbox-plugins-android/tree/master/plugin-locationlayer instead.
- */
- @Deprecated
- public void setOnMyLocationChangeListener(@Nullable MapboxMap.OnMyLocationChangeListener
- listener) {
- trackingSettings.setOnMyLocationChangeListener(listener);
- }
-
- /**
- * Replaces the location source of the my-location layer.
- *
- * @param locationSource A {@link LocationEngine} location source to use in the my-location layer.
- * @deprecated use location layer plugin from
- * https://github.com/mapbox/mapbox-plugins-android/tree/master/plugin-locationlayer instead.
- */
- @Deprecated
- public void setLocationSource(@Nullable LocationEngine locationSource) {
- trackingSettings.setLocationSource(locationSource);
- }
-
- /**
- * Sets a callback that's invoked when the location tracking mode changes.
- *
- * @param listener The callback that's invoked when the location tracking mode changes.
- * To unset the callback, use null.
- * @deprecated use location layer plugin from
- * https://github.com/mapbox/mapbox-plugins-android/tree/master/plugin-locationlayer instead.
- */
- @Deprecated
- public void setOnMyLocationTrackingModeChangeListener(
- @Nullable MapboxMap.OnMyLocationTrackingModeChangeListener listener) {
- trackingSettings.setOnMyLocationTrackingModeChangeListener(listener);
- }
-
- /**
- * Sets a callback that's invoked when the bearing tracking mode changes.
- *
- * @param listener The callback that's invoked when the bearing tracking mode changes.
- * To unset the callback, use null.
- * @deprecated use location layer plugin from
- * https://github.com/mapbox/mapbox-plugins-android/tree/master/plugin-locationlayer instead.
- */
- @Deprecated
- public void setOnMyBearingTrackingModeChangeListener(@Nullable OnMyBearingTrackingModeChangeListener listener) {
- trackingSettings.setOnMyBearingTrackingModeChangeListener(listener);
- }
-
- //
// Invalidate
//
@@ -2289,13 +2072,13 @@ public final class MapboxMap {
* Queries the map for rendered features
*
* @param coordinates the point to query
- * @param filter filters the returned features
+ * @param filter filters the returned features with an expression
* @param layerIds optionally - only query these layers
* @return the list of feature
*/
@NonNull
public List<Feature> queryRenderedFeatures(@NonNull PointF coordinates,
- @Nullable Filter.Statement filter,
+ @Nullable Expression filter,
@Nullable String... layerIds) {
return nativeMapView.queryRenderedFeatures(coordinates, layerIds, filter);
}
@@ -2317,26 +2100,17 @@ public final class MapboxMap {
* Queries the map for rendered features
*
* @param coordinates the box to query
- * @param filter filters the returned features
+ * @param filter filters the returned features with an expression
* @param layerIds optionally - only query these layers
* @return the list of feature
*/
@NonNull
public List<Feature> queryRenderedFeatures(@NonNull RectF coordinates,
- @Nullable Filter.Statement filter,
+ @Nullable Expression filter,
@Nullable String... layerIds) {
return nativeMapView.queryRenderedFeatures(coordinates, layerIds, filter);
}
- FocalPointChangeListener createFocalPointChangeListener() {
- return new FocalPointChangeListener() {
- @Override
- public void onFocalPointChanged(PointF pointF) {
- focalPoint = pointF;
- }
- };
- }
-
//
// Interfaces
//
@@ -2564,7 +2338,10 @@ public final class MapboxMap {
AndroidGesturesManager getGesturesManager();
- void setGesturesManager(AndroidGesturesManager gesturesManager);
+ void setGesturesManager(AndroidGesturesManager gesturesManager, boolean attachDefaultListeners,
+ boolean setDefaultMutuallyExclusives);
+
+ void cancelAllVelocityAnimations();
}
/**
@@ -2837,51 +2614,6 @@ public final class MapboxMap {
}
/**
- * Interface definition for a callback to be invoked when the the My Location view changes location.
- *
- * @see MapboxMap#setOnMyLocationChangeListener(OnMyLocationChangeListener)
- */
- public interface OnMyLocationChangeListener {
- /**
- * Called when the location of the My Location view has changed
- * (be it latitude/longitude, bearing or accuracy).
- *
- * @param location The current location of the My Location view The type of map change event.
- */
- void onMyLocationChange(@Nullable Location location);
- }
-
- /**
- * Interface definition for a callback to be invoked when the the My Location tracking mode changes.
- *
- * @see TrackingSettings#setMyLocationTrackingMode(int)
- */
- public interface OnMyLocationTrackingModeChangeListener {
-
- /**
- * Called when the tracking mode of My Location tracking has changed
- *
- * @param myLocationTrackingMode the current active location tracking mode
- */
- void onMyLocationTrackingModeChange(@MyLocationTracking.Mode int myLocationTrackingMode);
- }
-
- /**
- * Interface definition for a callback to be invoked when the the My Location tracking mode changes.
- *
- * @see TrackingSettings#setMyLocationTrackingMode(int)
- */
- public interface OnMyBearingTrackingModeChangeListener {
-
- /**
- * Called when the tracking mode of My Bearing tracking has changed
- *
- * @param myBearingTrackingMode the current active bearing tracking mode
- */
- void onMyBearingTrackingModeChange(@MyBearingTracking.Mode int myBearingTrackingMode);
- }
-
- /**
* Interface definition for a callback to be invoked when a task is complete or cancelled.
*/
public interface CancelableCallback {