From 1ceea72e6da786537cf3f4038ce56b602c12bfa8 Mon Sep 17 00:00:00 2001 From: Tobrun Date: Wed, 19 Sep 2018 16:30:32 +0200 Subject: [android] - remove MarkerView API --- .../java/com/mapbox/mapboxsdk/maps/MapboxMap.java | 256 +-------------------- 1 file changed, 1 insertion(+), 255 deletions(-) (limited to 'platform/android/MapboxGLAndroidSDK/src/main/java/com/mapbox/mapboxsdk/maps/MapboxMap.java') 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 f986d9d96c..58fc66407f 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 @@ -11,10 +11,8 @@ import android.support.annotation.NonNull; import android.support.annotation.Nullable; import android.support.annotation.Size; import android.support.annotation.UiThread; -import android.support.v4.util.Pools; import android.text.TextUtils; import android.view.View; -import android.view.ViewGroup; import com.mapbox.android.gestures.AndroidGesturesManager; import com.mapbox.android.gestures.MoveGestureDetector; @@ -26,11 +24,8 @@ import com.mapbox.geojson.Geometry; import com.mapbox.mapboxsdk.MapStrictMode; import com.mapbox.mapboxsdk.annotations.Annotation; import com.mapbox.mapboxsdk.annotations.BaseMarkerOptions; -import com.mapbox.mapboxsdk.annotations.BaseMarkerViewOptions; import com.mapbox.mapboxsdk.annotations.Marker; import com.mapbox.mapboxsdk.annotations.MarkerOptions; -import com.mapbox.mapboxsdk.annotations.MarkerView; -import com.mapbox.mapboxsdk.annotations.MarkerViewManager; import com.mapbox.mapboxsdk.annotations.Polygon; import com.mapbox.mapboxsdk.annotations.PolygonOptions; import com.mapbox.mapboxsdk.annotations.Polyline; @@ -172,22 +167,11 @@ public final class MapboxMap { * Called before the OnMapReadyCallback is invoked. */ void onPreMapReady() { - invalidateCameraPosition(); + transform.invalidateCameraPosition(); annotationManager.reloadMarkers(); annotationManager.adjustTopOffsetPixels(this); } - /** - * Called when the OnMapReadyCallback has finished executing. - *

- * Invalidation of the camera position is required to update the added components in - * OnMapReadyCallback with the correct transformation. - *

- */ - void onPostMapReady() { - invalidateCameraPosition(); - } - /** * Called when the map will start loading style. */ @@ -857,16 +841,6 @@ public final class MapboxMap { transform.animateCamera(MapboxMap.this, update, durationMs, callback); } - /** - * Invalidates the current camera position by reconstructing it from mbgl - */ - private void invalidateCameraPosition() { - CameraPosition cameraPosition = transform.invalidateCameraPosition(); - if (cameraPosition != null) { - transform.updateCameraPosition(cameraPosition); - } - } - /** * Scrolls the camera over the map, shifting the center of view by the specified number of pixels in the x and y * directions. @@ -1185,85 +1159,6 @@ public final class MapboxMap { return annotationManager.addMarker(markerOptions, this); } - /** - *

- * Adds a marker to this map. - *

- * The marker's icon is rendered on the map at the location {@code Marker.position}. - * If {@code Marker.title} is defined, the map shows an info box with the marker's title and snippet. - * - * @param markerOptions A marker options object that defines how to render the marker - * @return The {@code Marker} that was added to the map - * @deprecated Use a {@link com.mapbox.mapboxsdk.style.layers.SymbolLayer} instead. An example of converting Android - * SDK views to be used as a symbol see https://github - * .com/mapbox/mapbox-gl-native/blob/68f32bc104422207c64da8d90e8411b138d87f04/platform/android - * /MapboxGLAndroidSDKTestApp/src/main/java/com/mapbox/mapboxsdk/testapp/activity/style/SymbolGeneratorActivity.java - */ - @NonNull - @Deprecated - public MarkerView addMarker(@NonNull BaseMarkerViewOptions markerOptions) { - return annotationManager.addMarker(markerOptions, this, null); - } - - /** - *

- * Adds a marker to this map. - *

- * The marker's icon is rendered on the map at the location {@code Marker.position}. - * If {@code Marker.title} is defined, the map shows an info box with the marker's title and snippet. - * - * @param markerOptions A marker options object that defines how to render the marker - * @param onMarkerViewAddedListener Callback invoked when the View has been added to the map - * @return The {@code Marker} that was added to the map - * @deprecated Use a {@link com.mapbox.mapboxsdk.style.layers.SymbolLayer} instead. An example of converting Android - * SDK views to be used as a symbol see https://github - * .com/mapbox/mapbox-gl-native/blob/68f32bc104422207c64da8d90e8411b138d87f04/platform/android - * /MapboxGLAndroidSDKTestApp/src/main/java/com/mapbox/mapboxsdk/testapp/activity/style/SymbolGeneratorActivity.java - */ - @Deprecated - @NonNull - public MarkerView addMarker(@NonNull BaseMarkerViewOptions markerOptions, - final MarkerViewManager.OnMarkerViewAddedListener onMarkerViewAddedListener) { - return annotationManager.addMarker(markerOptions, this, onMarkerViewAddedListener); - } - - /** - * Adds multiple markersViews to this map. - *

- * The marker's icon is rendered on the map at the location {@code Marker.position}. - * If {@code Marker.title} is defined, the map shows an info box with the marker's title and snippet. - *

- * - * @param markerViewOptions A list of markerView options objects that defines how to render the markers - * @return A list of the {@code MarkerView}s that were added to the map - * @deprecated Use a {@link com.mapbox.mapboxsdk.style.layers.SymbolLayer} instead. An example of converting Android - * SDK views to be used as a symbol see https://github - * .com/mapbox/mapbox-gl-native/blob/68f32bc104422207c64da8d90e8411b138d87f04/platform/android - * /MapboxGLAndroidSDKTestApp/src/main/java/com/mapbox/mapboxsdk/testapp/activity/style/SymbolGeneratorActivity.java - */ - @NonNull - @Deprecated - public List addMarkerViews(@NonNull List markerViewOptions) { - return annotationManager.addMarkerViews(markerViewOptions, this); - } - - /** - * Returns markerViews found inside of a rectangle on this map. - * - * @param rect the rectangular area on the map to query for markerViews - * @return A list of the markerViews that were found in the rectangle - * @deprecated Use a {@link com.mapbox.mapboxsdk.style.layers.SymbolLayer} instead. An example of converting Android - * SDK views to be used as a symbol see https://github - * .com/mapbox/mapbox-gl-native/blob/68f32bc104422207c64da8d90e8411b138d87f04/platform/android - * /MapboxGLAndroidSDKTestApp/src/main/java/com/mapbox/mapboxsdk/testapp/activity/style/SymbolGeneratorActivity.java - */ - @NonNull - @Deprecated - public List getMarkerViewsInRect(@NonNull RectF rect) { - return annotationManager.getMarkerViewsInRect(rect); - } - /** *

* Adds multiple markers to this map. @@ -1559,16 +1454,6 @@ public final class MapboxMap { return annotationManager.getSelectedMarkers(); } - /** - * Get the MarkerViewManager associated to the MapView. - * - * @return the associated MarkerViewManager - */ - @NonNull - public MarkerViewManager getMarkerViewManager() { - return annotationManager.getMarkerViewManager(); - } - // // InfoWindow // @@ -2543,145 +2428,6 @@ public final class MapboxMap { View getInfoWindow(@NonNull Marker marker); } - /** - * Interface definition for a callback to be invoked when an MarkerView will be shown. - * - * @param the instance type of MarkerView - * @deprecated Use a {@link com.mapbox.mapboxsdk.style.layers.SymbolLayer} instead. An example of converting Android - * SDK views to be used as a symbol see https://github - * .com/mapbox/mapbox-gl-native/blob/68f32bc104422207c64da8d90e8411b138d87f04/platform/android - * /MapboxGLAndroidSDKTestApp/src/main/java/com/mapbox/mapboxsdk/testapp/activity/style/SymbolGeneratorActivity.java - */ - @Deprecated - public abstract static class MarkerViewAdapter { - - private Context context; - private final Class persistentClass; - @NonNull - private final Pools.SimplePool viewReusePool; - - /** - * Create an instance of MarkerViewAdapter. - * - * @param context the context associated to a MapView - */ - public MarkerViewAdapter(Context context, Class persistentClass) { - this.context = context; - this.persistentClass = persistentClass; - viewReusePool = new Pools.SimplePool<>(10000); - } - - /** - * Called when an MarkerView will be added to the MapView. - * - * @param marker the model representing the MarkerView - * @param convertView the reusable view - * @param parent the parent ViewGroup of the convertview - * @return the View that is adapted to the contents of MarkerView - */ - @Nullable - public abstract View getView(@NonNull U marker, @Nullable View convertView, @NonNull ViewGroup parent); - - /** - * Called when an MarkerView is removed from the MapView or the View object is going to be reused. - *

- * This method should be used to reset an animated view back to it's original state for view reuse. - *

- *

- * Returning true indicates you want to the view reuse to be handled automatically. - * Returning false indicates you want to perform an animation and you are required calling - * {@link #releaseView(View)} yourself. - *

- * - * @param marker the model representing the MarkerView - * @param convertView the reusable view - * @return true if you want reuse to occur automatically, false if you want to manage this yourself. - */ - public boolean prepareViewForReuse(@NonNull MarkerView marker, @NonNull View convertView) { - return true; - } - - /** - * Called when a MarkerView is selected from the MapView. - *

- * Returning true from this method indicates you want to move the MarkerView to the selected state. - * Returning false indicates you want to animate the View first an manually select the MarkerView when appropriate. - *

- * - * @param marker the model representing the MarkerView - * @param convertView the reusable view - * @param reselectionFromRecycling indicates if the onSelect callback is the initial selection - * callback or that selection occurs due to recreation of selected marker - * @return true if you want to select the Marker immediately, false if you want to manage this yourself. - */ - public boolean onSelect(@NonNull U marker, @NonNull View convertView, boolean reselectionFromRecycling) { - return true; - } - - /** - * Called when a MarkerView is deselected from the MapView. - * - * @param marker the model representing the MarkerView - * @param convertView the reusable view - */ - public void onDeselect(@NonNull U marker, @NonNull View convertView) { - } - - /** - * Returns the generic type of the used MarkerView. - * - * @return the generic type - */ - public final Class getMarkerClass() { - return persistentClass; - } - - /** - * Returns the pool used to store reusable Views. - * - * @return the pool associated to this adapter - */ - @NonNull - public final Pools.SimplePool getViewReusePool() { - return viewReusePool; - } - - /** - * Returns the context associated to the hosting MapView. - * - * @return the context used - */ - public final Context getContext() { - return context; - } - - /** - * Release a View to the ViewPool. - * - * @param view the view to be released - */ - public final void releaseView(View view) { - view.setVisibility(View.GONE); - viewReusePool.release(view); - } - } - - /** - * Interface definition for a callback to be invoked when the user clicks on a MarkerView. - */ - public interface OnMarkerViewClickListener { - - /** - * Called when the user clicks on a MarkerView. - * - * @param marker the MarkerView associated to the clicked View - * @param view the clicked View - * @param adapter the adapter used to adapt the MarkerView to the View - * @return If true the listener has consumed the event and the info window will not be shown - */ - boolean onMarkerClick(@NonNull Marker marker, @NonNull View view, @NonNull MarkerViewAdapter adapter); - } - /** * Interface definition for a callback to be invoked when a task is complete or cancelled. */ -- cgit v1.2.1