From bd4a0592f893eccb99c01378f0ea26c332f91695 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=C5=81ukasz=20Paczos?= Date: Wed, 19 Dec 2018 14:05:09 +0100 Subject: [android] clean up remaining deprecated methods for 7.0.0 --- .../mapboxsdk/camera/CameraUpdateFactory.java | 14 -- .../mapbox/mapboxsdk/location/CompassEngine.java | 16 -- .../mapboxsdk/location/LocationComponent.java | 42 ----- .../location/LocationComponentCompassEngine.java | 14 -- .../java/com/mapbox/mapboxsdk/maps/MapboxMap.java | 183 ++++++++++++++++++--- .../com/mapbox/mapboxsdk/storage/FileSource.java | 6 +- .../mapboxsdk/location/LocationComponentTest.kt | 6 - .../com/mapbox/mapboxsdk/maps/TransformTest.kt | 30 ---- .../testapp/camera/CameraAnimateTest.java | 30 ---- .../mapboxsdk/testapp/camera/CameraEaseTest.java | 30 ---- .../mapboxsdk/testapp/camera/CameraForTest.java | 6 +- .../mapboxsdk/testapp/camera/CameraMoveTest.java | 30 ---- .../testapp/activity/camera/ScrollByActivity.java | 8 +- 13 files changed, 170 insertions(+), 245 deletions(-) diff --git a/platform/android/MapboxGLAndroidSDK/src/main/java/com/mapbox/mapboxsdk/camera/CameraUpdateFactory.java b/platform/android/MapboxGLAndroidSDK/src/main/java/com/mapbox/mapboxsdk/camera/CameraUpdateFactory.java index 54788caa40..c4cc6d0196 100644 --- a/platform/android/MapboxGLAndroidSDK/src/main/java/com/mapbox/mapboxsdk/camera/CameraUpdateFactory.java +++ b/platform/android/MapboxGLAndroidSDK/src/main/java/com/mapbox/mapboxsdk/camera/CameraUpdateFactory.java @@ -87,20 +87,6 @@ public final class CameraUpdateFactory { return new CameraPositionUpdate(-1, latLng, -1, zoom); } - /** - * Returns a CameraUpdate that scrolls the camera over the map, - * shifting the center of view by the specified number of pixels in the x and y directions. - * - * @param xPixel Amount of pixels to scroll to in x direction - * @param yPixel Amount of pixels to scroll to in y direction - * @return CameraUpdate Final Camera Position - * @deprecated use {@link MapboxMap#scrollBy(float, float)} for more precise displacements when using a padded map. - */ - @Deprecated - public static CameraUpdate scrollBy(float xPixel, float yPixel) { - return new CameraMoveUpdate(xPixel, yPixel); - } - /** * Returns a CameraUpdate that shifts the zoom level of the current camera viewpoint. * diff --git a/platform/android/MapboxGLAndroidSDK/src/main/java/com/mapbox/mapboxsdk/location/CompassEngine.java b/platform/android/MapboxGLAndroidSDK/src/main/java/com/mapbox/mapboxsdk/location/CompassEngine.java index 33efa06226..bb7fd49726 100644 --- a/platform/android/MapboxGLAndroidSDK/src/main/java/com/mapbox/mapboxsdk/location/CompassEngine.java +++ b/platform/android/MapboxGLAndroidSDK/src/main/java/com/mapbox/mapboxsdk/location/CompassEngine.java @@ -52,20 +52,4 @@ public interface CompassEngine { * @return last accuracy status */ int getLastAccuracySensorStatus(); - - /** - * Lifecycle method that can be used for adding or releasing resources. - * - * @deprecated Use {@link #addCompassListener(CompassListener)} - */ - @Deprecated - void onStart(); - - /** - * Lifecycle method that can be used for adding or releasing resources. - * - * @deprecated Use {@link #removeCompassListener(CompassListener)} - */ - @Deprecated - void onStop(); } diff --git a/platform/android/MapboxGLAndroidSDK/src/main/java/com/mapbox/mapboxsdk/location/LocationComponent.java b/platform/android/MapboxGLAndroidSDK/src/main/java/com/mapbox/mapboxsdk/location/LocationComponent.java index 66a6985b0c..c6c026c4c4 100644 --- a/platform/android/MapboxGLAndroidSDK/src/main/java/com/mapbox/mapboxsdk/location/LocationComponent.java +++ b/platform/android/MapboxGLAndroidSDK/src/main/java/com/mapbox/mapboxsdk/location/LocationComponent.java @@ -791,48 +791,6 @@ public final class LocationComponent { return lastLocation; } - /** - * Return the last known {@link CompassEngine} accuracy status of the location component. - *

- * The last known accuracy of the compass sensor, one of SensorManager.SENSOR_STATUS_* - * - * @return the last know compass accuracy bearing - * @deprecated Use {@link #getCompassEngine()} - */ - @Deprecated - public float getLastKnownCompassAccuracyStatus() { - return compassEngine != null ? compassEngine.getLastAccuracySensorStatus() : 0; - } - - /** - * Add a compass listener to get heading updates every second. Once the first listener gets added, - * the sensor gets initiated and starts returning values. - * - * @param compassListener a {@link CompassListener} for listening into compass heading and - * accuracy changes - * @deprecated Use {@link #getCompassEngine()} - */ - @Deprecated - public void addCompassListener(@NonNull CompassListener compassListener) { - if (compassEngine != null) { - compassEngine.addCompassListener(compassListener); - } - } - - /** - * Remove a compass listener. - * - * @param compassListener the {@link CompassListener} which you'd like to remove from the listener - * list. - * @deprecated Use {@link #getCompassEngine()} - */ - @Deprecated - public void removeCompassListener(@NonNull CompassListener compassListener) { - if (compassEngine != null) { - compassEngine.removeCompassListener(compassListener); - } - } - /** * Adds a listener that gets invoked when the user clicks the displayed location. *

diff --git a/platform/android/MapboxGLAndroidSDK/src/main/java/com/mapbox/mapboxsdk/location/LocationComponentCompassEngine.java b/platform/android/MapboxGLAndroidSDK/src/main/java/com/mapbox/mapboxsdk/location/LocationComponentCompassEngine.java index cbda1bd0fd..331208587f 100644 --- a/platform/android/MapboxGLAndroidSDK/src/main/java/com/mapbox/mapboxsdk/location/LocationComponentCompassEngine.java +++ b/platform/android/MapboxGLAndroidSDK/src/main/java/com/mapbox/mapboxsdk/location/LocationComponentCompassEngine.java @@ -108,20 +108,6 @@ class LocationComponentCompassEngine implements CompassEngine, SensorEventListen return lastHeading; } - @Override - public void onStart() { - if (!compassListeners.isEmpty()) { - registerSensorListeners(); - } - } - - @Override - public void onStop() { - if (!compassListeners.isEmpty()) { - unregisterSensorListeners(); - } - } - @Override public void onSensorChanged(@NonNull SensorEvent event) { // check when the last time the compass was updated, return if too soon. 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 3b4db2e62a..a94bc0874b 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 @@ -862,7 +862,11 @@ public final class MapboxMap { * * @param markerOptions A marker options object that defines how to render the marker * @return The {@code Marker} that was added to the map + * @deprecated As of 7.0.0, + * use + * Mapbox Annotation Plugin instead */ + @Deprecated @NonNull public Marker addMarker(@NonNull MarkerOptions markerOptions) { return annotationManager.addMarker(markerOptions, this); @@ -877,7 +881,11 @@ public final class MapboxMap { * * @param markerOptions A marker options object that defines how to render the marker * @return The {@code Marker} that was added to the map + * @deprecated As of 7.0.0, + * use + * Mapbox Annotation Plugin instead */ + @Deprecated @NonNull public Marker addMarker(@NonNull BaseMarkerOptions markerOptions) { return annotationManager.addMarker(markerOptions, this); @@ -892,7 +900,11 @@ public final class MapboxMap { * * @param markerOptionsList A list of marker options objects that defines how to render the markers * @return A list of the {@code Marker}s that were added to the map + * @deprecated As of 7.0.0, + * use + * Mapbox Annotation Plugin instead */ + @Deprecated @NonNull public List addMarkers(@NonNull List markerOptionsList) { @@ -905,7 +917,11 @@ public final class MapboxMap { *

* * @param updatedMarker An updated marker object + * @deprecated As of 7.0.0, + * use + * Mapbox Annotation Plugin instead */ + @Deprecated public void updateMarker(@NonNull Marker updatedMarker) { annotationManager.updateMarker(updatedMarker, this); } @@ -915,7 +931,11 @@ public final class MapboxMap { * * @param polylineOptions A polyline options object that defines how to render the polyline * @return The {@code Polyine} that was added to the map + * @deprecated As of 7.0.0, + * use + * Mapbox Annotation Plugin instead */ + @Deprecated @NonNull public Polyline addPolyline(@NonNull PolylineOptions polylineOptions) { return annotationManager.addPolyline(polylineOptions, this); @@ -926,7 +946,11 @@ public final class MapboxMap { * * @param polylineOptionsList A list of polyline options objects that defines how to render the polylines. * @return A list of the {@code Polyline}s that were added to the map. + * @deprecated As of 7.0.0, + * use + * Mapbox Annotation Plugin instead */ + @Deprecated @NonNull public List addPolylines(@NonNull List polylineOptionsList) { return annotationManager.addPolylines(polylineOptionsList, this); @@ -936,7 +960,11 @@ public final class MapboxMap { * Update a polyline on this map. * * @param polyline An updated polyline object. + * @deprecated As of 7.0.0, + * use + * Mapbox Annotation Plugin instead */ + @Deprecated public void updatePolyline(@NonNull Polyline polyline) { annotationManager.updatePolyline(polyline); } @@ -946,7 +974,11 @@ public final class MapboxMap { * * @param polygonOptions A polygon options object that defines how to render the polygon. * @return The {@code Polygon} that was added to the map. + * @deprecated As of 7.0.0, + * use + * Mapbox Annotation Plugin instead */ + @Deprecated @NonNull public Polygon addPolygon(@NonNull PolygonOptions polygonOptions) { return annotationManager.addPolygon(polygonOptions, this); @@ -957,7 +989,11 @@ public final class MapboxMap { * * @param polygonOptionsList A list of polygon options objects that defines how to render the polygons * @return A list of the {@code Polygon}s that were added to the map + * @deprecated As of 7.0.0, + * use + * Mapbox Annotation Plugin instead */ + @Deprecated @NonNull public List addPolygons(@NonNull List polygonOptionsList) { return annotationManager.addPolygons(polygonOptionsList, this); @@ -967,7 +1003,11 @@ public final class MapboxMap { * Update a polygon on this map. * * @param polygon An updated polygon object + * @deprecated As of 7.0.0, + * use + * Mapbox Annotation Plugin instead */ + @Deprecated public void updatePolygon(@NonNull Polygon polygon) { annotationManager.updatePolygon(polygon); } @@ -979,7 +1019,11 @@ public final class MapboxMap { * Calls removeAnnotation() internally. * * @param marker Marker to remove + * @deprecated As of 7.0.0, + * use + * Mapbox Annotation Plugin instead */ + @Deprecated public void removeMarker(@NonNull Marker marker) { annotationManager.removeAnnotation(marker); } @@ -991,7 +1035,11 @@ public final class MapboxMap { * Calls removeAnnotation() internally. * * @param polyline Polyline to remove + * @deprecated As of 7.0.0, + * use + * Mapbox Annotation Plugin instead */ + @Deprecated public void removePolyline(@NonNull Polyline polyline) { annotationManager.removeAnnotation(polyline); } @@ -1003,7 +1051,11 @@ public final class MapboxMap { * Calls removeAnnotation() internally. * * @param polygon Polygon to remove + * @deprecated As of 7.0.0, + * use + * Mapbox Annotation Plugin instead */ + @Deprecated public void removePolygon(@NonNull Polygon polygon) { annotationManager.removeAnnotation(polygon); } @@ -1012,7 +1064,11 @@ public final class MapboxMap { * Removes an annotation from the map. * * @param annotation The annotation object to remove. + * @deprecated As of 7.0.0, + * use + * Mapbox Annotation Plugin instead */ + @Deprecated public void removeAnnotation(@NonNull Annotation annotation) { annotationManager.removeAnnotation(annotation); } @@ -1021,7 +1077,11 @@ public final class MapboxMap { * Removes an annotation from the map * * @param id The identifier associated to the annotation to be removed + * @deprecated As of 7.0.0, + * use + * Mapbox Annotation Plugin instead */ + @Deprecated public void removeAnnotation(long id) { annotationManager.removeAnnotation(id); } @@ -1030,21 +1090,33 @@ public final class MapboxMap { * Removes multiple annotations from the map. * * @param annotationList A list of annotation objects to remove. + * @deprecated As of 7.0.0, + * use + * Mapbox Annotation Plugin instead */ + @Deprecated public void removeAnnotations(@NonNull List annotationList) { annotationManager.removeAnnotations(annotationList); } /** * Removes all annotations from the map. + * @deprecated As of 7.0.0, + * use + * Mapbox Annotation Plugin instead */ + @Deprecated public void removeAnnotations() { annotationManager.removeAnnotations(); } /** * Removes all markers, polylines, polygons, overlays, etc from the map. + * @deprecated As of 7.0.0, + * use + * Mapbox Annotation Plugin instead */ + @Deprecated public void clear() { annotationManager.removeAnnotations(); } @@ -1054,7 +1126,11 @@ public final class MapboxMap { * * @param id the id used to look up an annotation * @return An annotation with a matched id, null is returned if no match was found + * @deprecated As of 7.0.0, + * use + * Mapbox Annotation Plugin instead */ + @Deprecated @Nullable public Annotation getAnnotation(long id) { return annotationManager.getAnnotation(id); @@ -1065,7 +1141,11 @@ public final class MapboxMap { * * @return A list of all the annotation objects. The returned object is a copy so modifying this * list will not update the map + * @deprecated As of 7.0.0, + * use + * Mapbox Annotation Plugin instead */ + @Deprecated @NonNull public List getAnnotations() { return annotationManager.getAnnotations(); @@ -1076,7 +1156,11 @@ public final class MapboxMap { * * @return A list of all the markers objects. The returned object is a copy so modifying this * list will not update the map. + * @deprecated As of 7.0.0, + * use + * Mapbox Annotation Plugin instead */ + @Deprecated @NonNull public List getMarkers() { return annotationManager.getMarkers(); @@ -1087,7 +1171,11 @@ public final class MapboxMap { * * @return A list of all the polygon objects. The returned object is a copy so modifying this * list will not update the map. + * @deprecated As of 7.0.0, + * use + * Mapbox Annotation Plugin instead */ + @Deprecated @NonNull public List getPolygons() { return annotationManager.getPolygons(); @@ -1098,7 +1186,11 @@ public final class MapboxMap { * * @return A list of all the polylines objects. The returned object is a copy so modifying this * list will not update the map. + * @deprecated As of 7.0.0, + * use + * Mapbox Annotation Plugin instead */ + @Deprecated @NonNull public List getPolylines() { return annotationManager.getPolylines(); @@ -1109,7 +1201,11 @@ public final class MapboxMap { * * @param listener The callback that's invoked when the user clicks on a marker. * To unset the callback, use null. + * @deprecated As of 7.0.0, + * use + * Mapbox Annotation Plugin instead */ + @Deprecated public void setOnMarkerClickListener(@Nullable OnMarkerClickListener listener) { annotationManager.setOnMarkerClickListener(listener); } @@ -1119,7 +1215,11 @@ public final class MapboxMap { * * @param listener The callback that's invoked when the user clicks on a polygon. * To unset the callback, use null. + * @deprecated As of 7.0.0, + * use + * Mapbox Annotation Plugin instead */ + @Deprecated public void setOnPolygonClickListener(@Nullable OnPolygonClickListener listener) { annotationManager.setOnPolygonClickListener(listener); } @@ -1129,7 +1229,11 @@ public final class MapboxMap { * * @param listener The callback that's invoked when the user clicks on a polyline. * To unset the callback, use null. + * @deprecated As of 7.0.0, + * use + * Mapbox Annotation Plugin instead */ + @Deprecated public void setOnPolylineClickListener(@Nullable OnPolylineClickListener listener) { annotationManager.setOnPolylineClickListener(listener); } @@ -1143,7 +1247,11 @@ public final class MapboxMap { * Selecting an already selected marker will have no effect. * * @param marker The marker to select. + * @deprecated As of 7.0.0, + * use + * Mapbox Annotation Plugin instead */ + @Deprecated public void selectMarker(@NonNull Marker marker) { if (marker == null) { Logger.w(TAG, "marker was null, so just returning"); @@ -1154,7 +1262,11 @@ public final class MapboxMap { /** * Deselects any currently selected marker. All markers will have it's info window closed. + * @deprecated As of 7.0.0, + * use + * Mapbox Annotation Plugin instead */ + @Deprecated public void deselectMarkers() { annotationManager.deselectMarkers(); } @@ -1163,7 +1275,11 @@ public final class MapboxMap { * Deselects a currently selected marker. The selected marker will have it's info window closed. * * @param marker the marker to deselect + * @deprecated As of 7.0.0, + * use + * Mapbox Annotation Plugin instead */ + @Deprecated public void deselectMarker(@NonNull Marker marker) { annotationManager.deselectMarker(marker); } @@ -1172,7 +1288,11 @@ public final class MapboxMap { * Gets the currently selected marker. * * @return The currently selected marker. + * @deprecated As of 7.0.0, + * use + * Mapbox Annotation Plugin instead */ + @Deprecated @NonNull public List getSelectedMarkers() { return annotationManager.getSelectedMarkers(); @@ -1191,7 +1311,11 @@ public final class MapboxMap { * * @param infoWindowAdapter The callback to be invoked when an info window will be shown. * To unset the callback, use null. + * @deprecated As of 7.0.0, + * use + * Mapbox Annotation Plugin instead */ + @Deprecated public void setInfoWindowAdapter(@Nullable InfoWindowAdapter infoWindowAdapter) { annotationManager.getInfoWindowManager().setInfoWindowAdapter(infoWindowAdapter); } @@ -1200,7 +1324,11 @@ public final class MapboxMap { * Gets the callback to be invoked when an info window will be shown. * * @return The callback to be invoked when an info window will be shown. + * @deprecated As of 7.0.0, + * use + * Mapbox Annotation Plugin instead */ + @Deprecated @Nullable public InfoWindowAdapter getInfoWindowAdapter() { return annotationManager.getInfoWindowManager().getInfoWindowAdapter(); @@ -1210,7 +1338,11 @@ public final class MapboxMap { * Changes whether the map allows concurrent multiple infowindows to be shown. * * @param allow If true, map allows concurrent multiple infowindows to be shown. + * @deprecated As of 7.0.0, + * use + * Mapbox Annotation Plugin instead */ + @Deprecated public void setAllowConcurrentMultipleOpenInfoWindows(boolean allow) { annotationManager.getInfoWindowManager().setAllowConcurrentMultipleOpenInfoWindows(allow); } @@ -1219,7 +1351,11 @@ public final class MapboxMap { * Returns whether the map allows concurrent multiple infowindows to be shown. * * @return If true, map allows concurrent multiple infowindows to be shown. + * @deprecated As of 7.0.0, + * use + * Mapbox Annotation Plugin instead */ + @Deprecated public boolean isAllowConcurrentMultipleOpenInfoWindows() { return annotationManager.getInfoWindowManager().isAllowConcurrentMultipleOpenInfoWindows(); } @@ -1247,7 +1383,7 @@ public final class MapboxMap { * @param latLngBounds the bounds to set the map with * @return the camera position that fits the bounds */ - @NonNull + @Nullable public CameraPosition getCameraForLatLngBounds(@NonNull LatLngBounds latLngBounds) { // we use current camera tilt value to provide expected transformations as #11993 return getCameraForLatLngBounds(latLngBounds, new int[] {0, 0, 0, 0}); @@ -1261,7 +1397,7 @@ public final class MapboxMap { * @param padding the padding to apply to the bounds * @return the camera position that fits the bounds and padding */ - @NonNull + @Nullable public CameraPosition getCameraForLatLngBounds(@NonNull LatLngBounds latLngBounds, @NonNull @Size(value = 4) int[] padding) { // we use current camera tilt/bearing value to provide expected transformations as #11993 @@ -1277,7 +1413,7 @@ public final class MapboxMap { * @param tilt to transform the camera position with * @return the camera position that fits the bounds and given bearing and tilt */ - @NonNull + @Nullable public CameraPosition getCameraForLatLngBounds(@NonNull LatLngBounds latLngBounds, @FloatRange(from = MapboxConstants.MINIMUM_DIRECTION, to = MapboxConstants.MAXIMUM_DIRECTION) double bearing, @@ -1296,7 +1432,7 @@ public final class MapboxMap { * @param tilt to transform the camera position with * @return the camera position that fits the bounds, bearing and tilt */ - @NonNull + @Nullable public CameraPosition getCameraForLatLngBounds(@NonNull LatLngBounds latLngBounds, @NonNull @Size(value = 4) int[] padding, @FloatRange(from = MapboxConstants.MINIMUM_DIRECTION, @@ -1312,7 +1448,7 @@ public final class MapboxMap { * @param geometry the geometry to wraps the map with * @return the camera position that fits the geometry inside */ - @NonNull + @Nullable public CameraPosition getCameraForGeometry(@NonNull Geometry geometry) { // we use current camera tilt value to provide expected transformations as #11993 return getCameraForGeometry(geometry, new int[] {0, 0, 0, 0}); @@ -1325,7 +1461,7 @@ public final class MapboxMap { * @param padding the padding to apply to the bounds * @return the camera position that fits the geometry inside and padding */ - @NonNull + @Nullable public CameraPosition getCameraForGeometry(@NonNull Geometry geometry, @NonNull @Size(value = 4) int[] padding) { // we use current camera tilt/bearing value to provide expected transformations as #11993 @@ -1340,7 +1476,7 @@ public final class MapboxMap { * @param tilt the tilt at which to compute the geometry's bounds * @return the camera position that the geometry inside with bearing and tilt */ - @NonNull + @Nullable public CameraPosition getCameraForGeometry(@NonNull Geometry geometry, @FloatRange(from = MapboxConstants.MINIMUM_DIRECTION, to = MapboxConstants.MAXIMUM_DIRECTION) double bearing, @@ -1358,7 +1494,7 @@ public final class MapboxMap { * @param tilt the tilt at which to compute the geometry's bounds * @return the camera position that fits the geometry inside with padding, bearing and tilt */ - @NonNull + @Nullable public CameraPosition getCameraForGeometry(@NonNull Geometry geometry, @NonNull @Size(value = 4) int[] padding, @FloatRange(from = MapboxConstants.MINIMUM_DIRECTION, @@ -1368,21 +1504,6 @@ public final class MapboxMap { return nativeMapView.getCameraForGeometry(geometry, padding, bearing, tilt); } - /** - * Get a camera position that fits a provided shape with a given bearing and padding. - * - * @param geometry the geometry to wraps the map with - * @param bearing the bearing at which to compute the geometry's bounds - * @param padding the padding to apply to the bounds - * @return the camera position that fits the geometry inside with padding and bearing - * @deprecated use Mapbox{@link #getCameraForGeometry(Geometry, int[], double, double)} instead - */ - @NonNull - @Deprecated - public CameraPosition getCameraForGeometry(@NonNull Geometry geometry, double bearing, @NonNull int[] padding) { - return getCameraForGeometry(geometry, padding, bearing, transform.getTilt()); - } - // // Padding // @@ -2055,7 +2176,11 @@ public final class MapboxMap { * Interface definition for a callback to be invoked when the user clicks on a marker. * * @see MapboxMap#setOnMarkerClickListener(OnMarkerClickListener) + * @deprecated As of 7.0.0, + * use + * Mapbox Annotation Plugin instead */ + @Deprecated public interface OnMarkerClickListener { /** * Called when the user clicks on a marker. @@ -2070,7 +2195,11 @@ public final class MapboxMap { * Interface definition for a callback to be invoked when the user clicks on a polygon. * * @see MapboxMap#setOnPolygonClickListener(OnPolygonClickListener) + * @deprecated As of 7.0.0, + * use + * Mapbox Annotation Plugin instead */ + @Deprecated public interface OnPolygonClickListener { /** * Called when the user clicks on a polygon. @@ -2084,7 +2213,11 @@ public final class MapboxMap { * Interface definition for a callback to be invoked when the user clicks on a polyline. * * @see MapboxMap#setOnPolylineClickListener(OnPolylineClickListener) + * @deprecated As of 7.0.0, + * use + * Mapbox Annotation Plugin instead */ + @Deprecated public interface OnPolylineClickListener { /** * Called when the user clicks on a polyline. @@ -2143,7 +2276,11 @@ public final class MapboxMap { * Interface definition for a callback to be invoked when an info window will be shown. * * @see MapboxMap#setInfoWindowAdapter(InfoWindowAdapter) + * @deprecated As of 7.0.0, + * use + * Mapbox Annotation Plugin instead */ + @Deprecated public interface InfoWindowAdapter { /** * Called when an info window will be shown as a result of a marker click. diff --git a/platform/android/MapboxGLAndroidSDK/src/main/java/com/mapbox/mapboxsdk/storage/FileSource.java b/platform/android/MapboxGLAndroidSDK/src/main/java/com/mapbox/mapboxsdk/storage/FileSource.java index 5723b71ef9..d3dba6f90c 100644 --- a/platform/android/MapboxGLAndroidSDK/src/main/java/com/mapbox/mapboxsdk/storage/FileSource.java +++ b/platform/android/MapboxGLAndroidSDK/src/main/java/com/mapbox/mapboxsdk/storage/FileSource.java @@ -76,11 +76,9 @@ public class FileSource { * * @param context the context to derive the files directory path from * @return the files directory path - * @deprecated Use {@link #getResourcesCachePath(Context)} instead. */ - @Nullable - @Deprecated - public static String getCachePath(@NonNull Context context) { + @NonNull + private static String getCachePath(@NonNull Context context) { // Default value boolean isExternalStorageConfiguration = MapboxConstants.DEFAULT_SET_STORAGE_EXTERNAL; diff --git a/platform/android/MapboxGLAndroidSDKTestApp/src/androidTest/java/com/mapbox/mapboxsdk/location/LocationComponentTest.kt b/platform/android/MapboxGLAndroidSDKTestApp/src/androidTest/java/com/mapbox/mapboxsdk/location/LocationComponentTest.kt index 4c7baad939..3fbc086621 100644 --- a/platform/android/MapboxGLAndroidSDKTestApp/src/androidTest/java/com/mapbox/mapboxsdk/location/LocationComponentTest.kt +++ b/platform/android/MapboxGLAndroidSDKTestApp/src/androidTest/java/com/mapbox/mapboxsdk/location/LocationComponentTest.kt @@ -1219,12 +1219,6 @@ class LocationComponentTest : BaseActivityTest() { override fun getLastAccuracySensorStatus(): Int { return 0 } - - override fun onStart() { - } - - override fun onStop() { - } } component.compassEngine = engine diff --git a/platform/android/MapboxGLAndroidSDKTestApp/src/androidTest/java/com/mapbox/mapboxsdk/maps/TransformTest.kt b/platform/android/MapboxGLAndroidSDKTestApp/src/androidTest/java/com/mapbox/mapboxsdk/maps/TransformTest.kt index 9a92a23f9b..a47ebd6000 100644 --- a/platform/android/MapboxGLAndroidSDKTestApp/src/androidTest/java/com/mapbox/mapboxsdk/maps/TransformTest.kt +++ b/platform/android/MapboxGLAndroidSDKTestApp/src/androidTest/java/com/mapbox/mapboxsdk/maps/TransformTest.kt @@ -6,7 +6,6 @@ import com.mapbox.mapboxsdk.geometry.LatLng import com.mapbox.mapboxsdk.testapp.action.MapboxMapAction.invoke import com.mapbox.mapboxsdk.testapp.activity.BaseActivityTest import com.mapbox.mapboxsdk.testapp.activity.maplayout.SimpleMapActivity -import com.mapbox.mapboxsdk.testapp.utils.TestConstants import org.junit.Assert.assertEquals import org.junit.Test @@ -17,34 +16,6 @@ class TransformTest: BaseActivityTest() { companion object { val initialCameraUpdate = CameraUpdateFactory.newLatLngZoom(LatLng(12.0,12.0), 12.0)!! - val scrollByCameraUpdate = CameraUpdateFactory.scrollBy(400.0f,0.0f)!! - } - - @Test - fun cameraUpdateScrollByWithPadding() { - validateTestSetup() - invoke(mapboxMap) { uiController: UiController, mapboxMap: MapboxMap -> - mapboxMap.moveCamera(initialCameraUpdate) - mapboxMap.moveCamera(scrollByCameraUpdate) - val expectedCameraPosition = mapboxMap.cameraPosition - - mapboxMap.moveCamera(initialCameraUpdate) - mapboxMap.setPadding(250,250,0,0) - mapboxMap.moveCamera(scrollByCameraUpdate) - val actualCameraPosition = mapboxMap.cameraPosition - - assertEquals("Camera position latitude should match", - expectedCameraPosition.target.latitude, - actualCameraPosition.target.longitude, - TestConstants.LAT_LNG_DELTA - ) - - assertEquals("Camera position longitude should match", - expectedCameraPosition.target.longitude, - actualCameraPosition.target.longitude, - TestConstants.LAT_LNG_DELTA - ) - } } @Test @@ -63,5 +34,4 @@ class TransformTest: BaseActivityTest() { assertEquals("Camera position should match", expectedCameraPosition, actualCameraPosition) } } - } \ No newline at end of file diff --git a/platform/android/MapboxGLAndroidSDKTestApp/src/androidTest/java/com/mapbox/mapboxsdk/testapp/camera/CameraAnimateTest.java b/platform/android/MapboxGLAndroidSDKTestApp/src/androidTest/java/com/mapbox/mapboxsdk/testapp/camera/CameraAnimateTest.java index d4283669f3..376e627b04 100644 --- a/platform/android/MapboxGLAndroidSDKTestApp/src/androidTest/java/com/mapbox/mapboxsdk/testapp/camera/CameraAnimateTest.java +++ b/platform/android/MapboxGLAndroidSDKTestApp/src/androidTest/java/com/mapbox/mapboxsdk/testapp/camera/CameraAnimateTest.java @@ -1,6 +1,5 @@ package com.mapbox.mapboxsdk.testapp.camera; -import android.graphics.PointF; import android.support.test.espresso.Espresso; import android.support.test.espresso.IdlingRegistry; import android.support.test.espresso.idling.CountingIdlingResource; @@ -158,35 +157,6 @@ public class CameraAnimateTest extends BaseActivityTest { Espresso.onIdle(); } - @Test - public void testAnimateToMoveBy() { - validateTestSetup(); - invoke(mapboxMap, (uiController, mapboxMap) -> { - final PointF centerPoint = mapboxMap.getProjection().toScreenLocation(mapboxMap.getCameraPosition().target); - final LatLng moveTarget = new LatLng(2, 2); - final PointF moveTargetPoint = mapboxMap.getProjection().toScreenLocation(moveTarget); - - animationIdlingResource.increment(); - mapboxMap.animateCamera( - CameraUpdateFactory.scrollBy(moveTargetPoint.x - centerPoint.x, moveTargetPoint.y - centerPoint.y), - new MapboxMap.CancelableCallback() { - @Override - public void onCancel() { - verifyCameraPosition(mapboxMap, moveTarget, mapboxMap.getCameraPosition().zoom, 0, 0); - animationIdlingResource.decrement(); - } - - @Override - public void onFinish() { - verifyCameraPosition(mapboxMap, moveTarget, mapboxMap.getCameraPosition().zoom, 0, 0); - animationIdlingResource.decrement(); - } - }); - }); - - Espresso.onIdle(); - } - @Test public void testAnimateToZoomIn() { validateTestSetup(); diff --git a/platform/android/MapboxGLAndroidSDKTestApp/src/androidTest/java/com/mapbox/mapboxsdk/testapp/camera/CameraEaseTest.java b/platform/android/MapboxGLAndroidSDKTestApp/src/androidTest/java/com/mapbox/mapboxsdk/testapp/camera/CameraEaseTest.java index d51c7661be..fb0eb71ef3 100644 --- a/platform/android/MapboxGLAndroidSDKTestApp/src/androidTest/java/com/mapbox/mapboxsdk/testapp/camera/CameraEaseTest.java +++ b/platform/android/MapboxGLAndroidSDKTestApp/src/androidTest/java/com/mapbox/mapboxsdk/testapp/camera/CameraEaseTest.java @@ -1,6 +1,5 @@ package com.mapbox.mapboxsdk.testapp.camera; -import android.graphics.PointF; import android.support.test.espresso.Espresso; import android.support.test.espresso.IdlingRegistry; import android.support.test.espresso.idling.CountingIdlingResource; @@ -158,35 +157,6 @@ public class CameraEaseTest extends BaseActivityTest { Espresso.onIdle(); } - @Test - public void testEaseToMoveBy() { - validateTestSetup(); - invoke(mapboxMap, (uiController, mapboxMap) -> { - final PointF centerPoint = mapboxMap.getProjection().toScreenLocation(mapboxMap.getCameraPosition().target); - final LatLng moveTarget = new LatLng(2, 2); - final PointF moveTargetPoint = mapboxMap.getProjection().toScreenLocation(moveTarget); - - animationIdlingResource.increment(); - mapboxMap.easeCamera(CameraUpdateFactory.scrollBy( - moveTargetPoint.x - centerPoint.x, moveTargetPoint.y - centerPoint.y), - new MapboxMap.CancelableCallback() { - @Override - public void onCancel() { - verifyCameraPosition(mapboxMap, moveTarget, mapboxMap.getCameraPosition().zoom, 0, 0); - animationIdlingResource.decrement(); - } - - @Override - public void onFinish() { - verifyCameraPosition(mapboxMap, moveTarget, mapboxMap.getCameraPosition().zoom, 0, 0); - animationIdlingResource.decrement(); - } - }); - }); - - Espresso.onIdle(); - } - @Test public void testEaseToZoomIn() { validateTestSetup(); diff --git a/platform/android/MapboxGLAndroidSDKTestApp/src/androidTest/java/com/mapbox/mapboxsdk/testapp/camera/CameraForTest.java b/platform/android/MapboxGLAndroidSDKTestApp/src/androidTest/java/com/mapbox/mapboxsdk/testapp/camera/CameraForTest.java index 39b2c8d763..752d02e319 100644 --- a/platform/android/MapboxGLAndroidSDKTestApp/src/androidTest/java/com/mapbox/mapboxsdk/testapp/camera/CameraForTest.java +++ b/platform/android/MapboxGLAndroidSDKTestApp/src/androidTest/java/com/mapbox/mapboxsdk/testapp/camera/CameraForTest.java @@ -244,8 +244,10 @@ public class CameraForTest extends BaseActivityTest { validateTestSetup(); onMapView().perform(getMapboxMapAction((uiController, mapboxMap) -> { List> polygonDefinition = getPolygonDefinition(); - CameraPosition actualPosition = mapboxMap.getCameraForGeometry(Polygon.fromLngLats(polygonDefinition), 45, - new int[] {5, 5, 5, 5}); + CameraPosition actualPosition = mapboxMap.getCameraForGeometry( + Polygon.fromLngLats(polygonDefinition), + new int[] {5, 5, 5, 5}, + 45, 0); CameraPosition expectedPosition = new CameraPosition.Builder() .target(new LatLng()).zoom(3.63).tilt(0).bearing(45).build(); assertEquals("Latitude should match", diff --git a/platform/android/MapboxGLAndroidSDKTestApp/src/androidTest/java/com/mapbox/mapboxsdk/testapp/camera/CameraMoveTest.java b/platform/android/MapboxGLAndroidSDKTestApp/src/androidTest/java/com/mapbox/mapboxsdk/testapp/camera/CameraMoveTest.java index 15d52f2576..22c837a4a5 100644 --- a/platform/android/MapboxGLAndroidSDKTestApp/src/androidTest/java/com/mapbox/mapboxsdk/testapp/camera/CameraMoveTest.java +++ b/platform/android/MapboxGLAndroidSDKTestApp/src/androidTest/java/com/mapbox/mapboxsdk/testapp/camera/CameraMoveTest.java @@ -1,7 +1,6 @@ package com.mapbox.mapboxsdk.testapp.camera; -import android.graphics.PointF; import android.support.test.espresso.Espresso; import android.support.test.espresso.IdlingRegistry; import android.support.test.espresso.idling.CountingIdlingResource; @@ -158,35 +157,6 @@ public class CameraMoveTest extends BaseActivityTest { Espresso.onIdle(); } - @Test - public void testMoveToMoveBy() { - validateTestSetup(); - invoke(mapboxMap, (uiController, mapboxMap) -> { - final PointF centerPoint = mapboxMap.getProjection().toScreenLocation(mapboxMap.getCameraPosition().target); - final LatLng moveTarget = new LatLng(2, 2); - final PointF moveTargetPoint = mapboxMap.getProjection().toScreenLocation(moveTarget); - - animationIdlingResource.increment(); - mapboxMap.moveCamera(CameraUpdateFactory.scrollBy( - moveTargetPoint.x - centerPoint.x, moveTargetPoint.y - centerPoint.y), - new MapboxMap.CancelableCallback() { - @Override - public void onCancel() { - verifyCameraPosition(mapboxMap, moveTarget, mapboxMap.getCameraPosition().zoom, 0, 0); - animationIdlingResource.decrement(); - } - - @Override - public void onFinish() { - verifyCameraPosition(mapboxMap, moveTarget, mapboxMap.getCameraPosition().zoom, 0, 0); - animationIdlingResource.decrement(); - } - }); - }); - - Espresso.onIdle(); - } - @Test public void testMoveToZoomIn() { validateTestSetup(); diff --git a/platform/android/MapboxGLAndroidSDKTestApp/src/main/java/com/mapbox/mapboxsdk/testapp/activity/camera/ScrollByActivity.java b/platform/android/MapboxGLAndroidSDKTestApp/src/main/java/com/mapbox/mapboxsdk/testapp/activity/camera/ScrollByActivity.java index 182fb441cd..b06889d11c 100644 --- a/platform/android/MapboxGLAndroidSDKTestApp/src/main/java/com/mapbox/mapboxsdk/testapp/activity/camera/ScrollByActivity.java +++ b/platform/android/MapboxGLAndroidSDKTestApp/src/main/java/com/mapbox/mapboxsdk/testapp/activity/camera/ScrollByActivity.java @@ -11,7 +11,7 @@ import android.support.v7.widget.Toolbar; import android.view.MenuItem; import android.widget.SeekBar; import android.widget.TextView; -import com.mapbox.mapboxsdk.camera.CameraUpdateFactory; + import com.mapbox.mapboxsdk.maps.MapView; import com.mapbox.mapboxsdk.maps.MapboxMap; import com.mapbox.mapboxsdk.maps.OnMapReadyCallback; @@ -69,10 +69,10 @@ public class ScrollByActivity extends AppCompatActivity implements OnMapReadyCal uiSettings.setAttributionEnabled(false); FloatingActionButton fab = findViewById(R.id.fab); fab.setColorFilter(ContextCompat.getColor(ScrollByActivity.this, R.color.primary)); - fab.setOnClickListener(view -> mapboxMap.easeCamera( - CameraUpdateFactory.scrollBy(seekBarX.getProgress() * MULTIPLIER_PER_PIXEL, + fab.setOnClickListener(view -> mapboxMap.scrollBy( + seekBarX.getProgress() * MULTIPLIER_PER_PIXEL, seekBarY.getProgress() * MULTIPLIER_PER_PIXEL) - )); + ); } @Override -- cgit v1.2.1