[android] - remove deprecation notices and code

This commit is contained in:
Tobrun
2018-10-31 15:50:11 +01:00
committed by Tobrun
parent 37a4967149
commit 7882ce1274
21 changed files with 234 additions and 681 deletions

View File

@@ -18,9 +18,6 @@ public class ModuleProviderImpl implements ModuleProvider {
@Override
@Nullable
public TelemetryDefinition obtainTelemetry() {
// TODO remove singleton with next major release,
// this is needed to make static methods on TelemetryImpl
// backwards compatible without breaking semver
return TelemetryImpl.getInstance();
return new TelemetryImpl();
}
}

View File

@@ -1,55 +0,0 @@
package com.mapbox.mapboxsdk.http;
import okhttp3.OkHttpClient;
/**
* Utility class for setting HttpRequest configurations.
*
* @deprecated use {@link com.mapbox.mapboxsdk.module.http.HttpRequestUtil} instead
*/
@Deprecated
public class HttpRequestUtil {
/**
* Set the log state of HttpRequest. Default value is true.
* <p>
* This configuration will outlast the lifecycle of the Map.
* </p>
*
* @param enabled True will enable logging, false will disable
* @deprecated use {@link com.mapbox.mapboxsdk.module.http.HttpRequestUtil#setLogEnabled(boolean)} instead
*/
@Deprecated
public static void setLogEnabled(boolean enabled) {
com.mapbox.mapboxsdk.module.http.HttpRequestUtil.setLogEnabled(enabled);
}
/**
* Enable printing of the request url when an error occurred. Default value is false.
* <p>
* Requires {@link #setLogEnabled(boolean)} to be activated.
* </p>
* <p>
* This configuration will outlast the lifecycle of the Map.
* </p>
*
* @param enabled True will print urls, false will disable
* @deprecated use {@link com.mapbox.mapboxsdk.module.http.HttpRequestUtil#setPrintRequestUrlOnFailure(boolean)}
* instead
*/
@Deprecated
public static void setPrintRequestUrlOnFailure(boolean enabled) {
com.mapbox.mapboxsdk.module.http.HttpRequestUtil.setPrintRequestUrlOnFailure(enabled);
}
/**
* Set the OkHttpClient used for requesting map resources.
*
* @param client the OkHttpClient
* @deprecated use {@link com.mapbox.mapboxsdk.module.http.HttpRequestUtil#setOkHttpClient(OkHttpClient)} instead.
*/
@Deprecated
public static void setOkHttpClient(OkHttpClient client) {
com.mapbox.mapboxsdk.module.http.HttpRequestUtil.setOkHttpClient(client);
}
}

View File

@@ -31,11 +31,6 @@ class CameraChangeDispatcher implements MapboxMap.OnCameraMoveStartedListener, M
private final CopyOnWriteArrayList<OnCameraMoveListener> onCameraMove = new CopyOnWriteArrayList<>();
private final CopyOnWriteArrayList<OnCameraIdleListener> onCameraIdle = new CopyOnWriteArrayList<>();
private OnCameraMoveStartedListener onCameraMoveStartedListener;
private OnCameraMoveCanceledListener onCameraMoveCanceledListener;
private OnCameraMoveListener onCameraMoveListener;
private OnCameraIdleListener onCameraIdleListener;
@Retention(SOURCE)
@IntDef( {MOVE_STARTED, MOVE, MOVE_CANCELED, IDLE})
@interface CameraChange {
@@ -67,26 +62,6 @@ class CameraChangeDispatcher implements MapboxMap.OnCameraMoveStartedListener, M
handler.scheduleMessage(IDLE);
}
@Deprecated
void setOnCameraMoveStartedListener(OnCameraMoveStartedListener onCameraMoveStartedListener) {
this.onCameraMoveStartedListener = onCameraMoveStartedListener;
}
@Deprecated
void setOnCameraMoveCanceledListener(OnCameraMoveCanceledListener onCameraMoveCanceledListener) {
this.onCameraMoveCanceledListener = onCameraMoveCanceledListener;
}
@Deprecated
void setOnCameraMoveListener(OnCameraMoveListener onCameraMoveListener) {
this.onCameraMoveListener = onCameraMoveListener;
}
@Deprecated
void setOnCameraIdleListener(OnCameraIdleListener onCameraIdleListener) {
this.onCameraIdleListener = onCameraIdleListener;
}
void addOnCameraIdleListener(@NonNull OnCameraIdleListener listener) {
onCameraIdle.add(listener);
}
@@ -132,13 +107,6 @@ class CameraChangeDispatcher implements MapboxMap.OnCameraMoveStartedListener, M
return;
}
idle = false;
// deprecated API
if (onCameraMoveStartedListener != null) {
onCameraMoveStartedListener.onCameraMoveStarted(moveStartedReason);
}
// new API
if (!onCameraMoveStarted.isEmpty()) {
for (OnCameraMoveStartedListener cameraMoveStartedListener : onCameraMoveStarted) {
cameraMoveStartedListener.onCameraMoveStarted(moveStartedReason);
@@ -147,12 +115,6 @@ class CameraChangeDispatcher implements MapboxMap.OnCameraMoveStartedListener, M
}
private void executeOnCameraMove() {
// deprecated API
if (onCameraMoveListener != null && !idle) {
onCameraMoveListener.onCameraMove();
}
// new API
if (!onCameraMove.isEmpty() && !idle) {
for (OnCameraMoveListener cameraMoveListener : onCameraMove) {
cameraMoveListener.onCameraMove();
@@ -161,12 +123,6 @@ class CameraChangeDispatcher implements MapboxMap.OnCameraMoveStartedListener, M
}
private void executeOnCameraMoveCancelled() {
// deprecated API
if (onCameraMoveCanceledListener != null && !idle) {
onCameraMoveCanceledListener.onCameraMoveCanceled();
}
// new API
if (!onCameraMoveCanceled.isEmpty() && !idle) {
for (OnCameraMoveCanceledListener cameraMoveCanceledListener : onCameraMoveCanceled) {
cameraMoveCanceledListener.onCameraMoveCanceled();
@@ -179,13 +135,6 @@ class CameraChangeDispatcher implements MapboxMap.OnCameraMoveStartedListener, M
return;
}
idle = true;
// deprecated API
if (onCameraIdleListener != null) {
onCameraIdleListener.onCameraIdle();
}
// new API
if (!onCameraIdle.isEmpty()) {
for (OnCameraIdleListener cameraIdleListener : onCameraIdle) {
cameraIdleListener.onCameraIdle();

View File

@@ -47,12 +47,6 @@ final class MapGestureDetector {
private final AnnotationManager annotationManager;
private final CameraChangeDispatcher cameraChangeDispatcher;
// deprecated map touch API
private MapboxMap.OnMapClickListener onMapClickListener;
private MapboxMap.OnMapLongClickListener onMapLongClickListener;
private MapboxMap.OnFlingListener onFlingListener;
private MapboxMap.OnScrollListener onScrollListener;
// new map touch API
private final CopyOnWriteArrayList<MapboxMap.OnMapClickListener> onMapClickListenerList
= new CopyOnWriteArrayList<>();
@@ -63,9 +57,6 @@ final class MapGestureDetector {
private final CopyOnWriteArrayList<MapboxMap.OnFlingListener> onFlingListenerList
= new CopyOnWriteArrayList<>();
private final CopyOnWriteArrayList<MapboxMap.OnScrollListener> onScrollListenerList
= new CopyOnWriteArrayList<>();
private final CopyOnWriteArrayList<MapboxMap.OnMoveListener> onMoveListenerList
= new CopyOnWriteArrayList<>();
@@ -457,7 +448,6 @@ final class MapGestureDetector {
// Scroll the map
transform.moveBy(-distanceX, -distanceY, 0 /*no duration*/);
notifyOnScrollListeners();
notifyOnMoveListeners(detector);
}
return true;
@@ -920,12 +910,6 @@ final class MapGestureDetector {
}
void notifyOnMapClickListeners(PointF tapPoint) {
// deprecated API
if (onMapClickListener != null) {
onMapClickListener.onMapClick(projection.fromScreenLocation(tapPoint));
}
// new API
for (MapboxMap.OnMapClickListener listener : onMapClickListenerList) {
if (listener.onMapClick(projection.fromScreenLocation(tapPoint))) {
return;
@@ -934,12 +918,6 @@ final class MapGestureDetector {
}
void notifyOnMapLongClickListeners(PointF longClickPoint) {
// deprecated API
if (onMapLongClickListener != null) {
onMapLongClickListener.onMapLongClick(projection.fromScreenLocation(longClickPoint));
}
// new API
for (MapboxMap.OnMapLongClickListener listener : onMapLongClickListenerList) {
if (listener.onMapLongClick(projection.fromScreenLocation(longClickPoint))) {
return;
@@ -948,29 +926,11 @@ final class MapGestureDetector {
}
void notifyOnFlingListeners() {
// deprecated API
if (onFlingListener != null) {
onFlingListener.onFling();
}
// new API
for (MapboxMap.OnFlingListener listener : onFlingListenerList) {
listener.onFling();
}
}
void notifyOnScrollListeners() {
//deprecated API
if (onScrollListener != null) {
onScrollListener.onScroll();
}
// new API
for (MapboxMap.OnScrollListener listener : onScrollListenerList) {
listener.onScroll();
}
}
void notifyOnMoveBeginListeners(MoveGestureDetector detector) {
for (MapboxMap.OnMoveListener listener : onMoveListenerList) {
listener.onMoveBegin(detector);
@@ -1043,22 +1003,6 @@ final class MapGestureDetector {
}
}
void setOnMapClickListener(MapboxMap.OnMapClickListener onMapClickListener) {
this.onMapClickListener = onMapClickListener;
}
void setOnMapLongClickListener(MapboxMap.OnMapLongClickListener onMapLongClickListener) {
this.onMapLongClickListener = onMapLongClickListener;
}
void setOnFlingListener(MapboxMap.OnFlingListener onFlingListener) {
this.onFlingListener = onFlingListener;
}
void setOnScrollListener(MapboxMap.OnScrollListener onScrollListener) {
this.onScrollListener = onScrollListener;
}
void addOnMapClickListener(MapboxMap.OnMapClickListener onMapClickListener) {
onMapClickListenerList.add(onMapClickListener);
}
@@ -1083,14 +1027,6 @@ final class MapGestureDetector {
onFlingListenerList.remove(onFlingListener);
}
void addOnScrollListener(MapboxMap.OnScrollListener onScrollListener) {
onScrollListenerList.add(onScrollListener);
}
void removeOnScrollListener(MapboxMap.OnScrollListener onScrollListener) {
onScrollListenerList.remove(onScrollListener);
}
void addOnMoveListener(MapboxMap.OnMoveListener listener) {
onMoveListenerList.add(listener);
}

View File

@@ -1025,11 +1025,6 @@ public class MapView extends FrameLayout implements NativeMapView.ViewCallback {
private class GesturesManagerInteractionListener implements MapboxMap.OnGesturesManagerInteractionListener {
@Override
public void onSetMapClickListener(MapboxMap.OnMapClickListener listener) {
mapGestureDetector.setOnMapClickListener(listener);
}
@Override
public void onAddMapClickListener(MapboxMap.OnMapClickListener listener) {
mapGestureDetector.addOnMapClickListener(listener);
@@ -1040,11 +1035,6 @@ public class MapView extends FrameLayout implements NativeMapView.ViewCallback {
mapGestureDetector.removeOnMapClickListener(listener);
}
@Override
public void onSetMapLongClickListener(MapboxMap.OnMapLongClickListener listener) {
mapGestureDetector.setOnMapLongClickListener(listener);
}
@Override
public void onAddMapLongClickListener(MapboxMap.OnMapLongClickListener listener) {
mapGestureDetector.addOnMapLongClickListener(listener);
@@ -1055,26 +1045,6 @@ public class MapView extends FrameLayout implements NativeMapView.ViewCallback {
mapGestureDetector.removeOnMapLongClickListener(listener);
}
@Override
public void onSetScrollListener(MapboxMap.OnScrollListener listener) {
mapGestureDetector.setOnScrollListener(listener);
}
@Override
public void onAddScrollListener(MapboxMap.OnScrollListener listener) {
mapGestureDetector.addOnScrollListener(listener);
}
@Override
public void onRemoveScrollListener(MapboxMap.OnScrollListener listener) {
mapGestureDetector.removeOnScrollListener(listener);
}
@Override
public void onSetFlingListener(MapboxMap.OnFlingListener listener) {
mapGestureDetector.setOnFlingListener(listener);
}
@Override
public void onAddFlingListener(MapboxMap.OnFlingListener listener) {
mapGestureDetector.addOnFlingListener(listener);

View File

@@ -1791,29 +1791,6 @@ public final class MapboxMap {
// Map events
//
/**
* Sets a callback that's invoked on every change in camera position.
*
* @param listener The callback that's invoked on every camera change position.
* To unset the callback, use null.
*/
@Deprecated
public void setOnCameraChangeListener(@Nullable OnCameraChangeListener listener) {
transform.setOnCameraChangeListener(listener);
}
/**
* Sets a callback that is invoked when camera movement has ended.
*
* @param listener the listener to notify
* @deprecated use {@link #addOnCameraIdleListener(OnCameraIdleListener)}
* and {@link #removeOnCameraIdleListener(OnCameraIdleListener)} instead
*/
@Deprecated
public void setOnCameraIdleListener(@Nullable OnCameraIdleListener listener) {
cameraChangeDispatcher.setOnCameraIdleListener(listener);
}
/**
* Adds a callback that is invoked when camera movement has ended.
*
@@ -1832,18 +1809,6 @@ public final class MapboxMap {
cameraChangeDispatcher.removeOnCameraIdleListener(listener);
}
/**
* Sets a callback that is invoked when camera movement was cancelled.
*
* @param listener the listener to notify
* @deprecated use {@link #addOnCameraMoveCancelListener(OnCameraMoveCanceledListener)} and
* {@link #removeOnCameraMoveCancelListener(OnCameraMoveCanceledListener)} instead
*/
@Deprecated
public void setOnCameraMoveCancelListener(@Nullable OnCameraMoveCanceledListener listener) {
cameraChangeDispatcher.setOnCameraMoveCanceledListener(listener);
}
/**
* Adds a callback that is invoked when camera movement was cancelled.
*
@@ -1862,18 +1827,6 @@ public final class MapboxMap {
cameraChangeDispatcher.removeOnCameraMoveCancelListener(listener);
}
/**
* Sets a callback that is invoked when camera movement has started.
*
* @param listener the listener to notify
* @deprecated use {@link #addOnCameraMoveStartedListener(OnCameraMoveStartedListener)} and
* {@link #removeOnCameraMoveStartedListener(OnCameraMoveStartedListener)} instead
*/
@Deprecated
public void setOnCameraMoveStartedListener(@Nullable OnCameraMoveStartedListener listener) {
cameraChangeDispatcher.setOnCameraMoveStartedListener(listener);
}
/**
* Adds a callback that is invoked when camera movement has started.
*
@@ -1892,18 +1845,6 @@ public final class MapboxMap {
cameraChangeDispatcher.removeOnCameraMoveStartedListener(listener);
}
/**
* Sets a callback that is invoked when camera position changes.
*
* @param listener the listener to notify
* @deprecated use {@link #addOnCameraMoveListener(OnCameraMoveListener)} and
* {@link #removeOnCameraMoveListener(OnCameraMoveListener)}instead
*/
@Deprecated
public void setOnCameraMoveListener(@Nullable OnCameraMoveListener listener) {
cameraChangeDispatcher.setOnCameraMoveListener(listener);
}
/**
* Adds a callback that is invoked when camera position changes.
*
@@ -1939,48 +1880,6 @@ public final class MapboxMap {
return onFpsChangedListener;
}
/**
* Sets 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.
* @deprecated Use {@link #addOnScrollListener(OnScrollListener)} instead.
*/
@Deprecated
public void setOnScrollListener(@Nullable OnScrollListener listener) {
onGesturesManagerInteractionListener.onSetScrollListener(listener);
}
/**
* Adds a callback that's invoked when the map is scrolled.
*
* @param listener The callback that's invoked when the map is scrolled.
*/
public void addOnScrollListener(@NonNull OnScrollListener listener) {
onGesturesManagerInteractionListener.onAddScrollListener(listener);
}
/**
* Removes a callback that's invoked when the map is scrolled.
*
* @param listener The callback that's invoked when the map is scrolled.
*/
public void removeOnScrollListener(@NonNull OnScrollListener listener) {
onGesturesManagerInteractionListener.onRemoveScrollListener(listener);
}
/**
* Sets 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.
* @deprecated Use {@link #addOnFlingListener(OnFlingListener)} instead.
*/
@Deprecated
public void setOnFlingListener(@Nullable OnFlingListener listener) {
onGesturesManagerInteractionListener.onSetFlingListener(listener);
}
/**
* Adds a callback that's invoked when the map is flinged.
*
@@ -2106,18 +2005,6 @@ public final class MapboxMap {
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.
* To unset the callback, use null.
* @deprecated Use {@link #addOnMapClickListener(OnMapClickListener)} instead.
*/
@Deprecated
public void setOnMapClickListener(@Nullable OnMapClickListener listener) {
onGesturesManagerInteractionListener.onSetMapClickListener(listener);
}
/**
* Adds a callback that's invoked when the user clicks on the map view.
*
@@ -2136,18 +2023,6 @@ public final class MapboxMap {
onGesturesManagerInteractionListener.onRemoveMapClickListener(listener);
}
/**
* Sets 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.
* @deprecated Use {@link #addOnMapLongClickListener(OnMapLongClickListener)} instead.
*/
@Deprecated
public void setOnMapLongClickListener(@Nullable OnMapLongClickListener listener) {
onGesturesManagerInteractionListener.onSetMapLongClickListener(listener);
}
/**
* Adds a callback that's invoked when the user long clicks on the map view.
*
@@ -2325,7 +2200,7 @@ public final class MapboxMap {
/**
* Interface definition for a callback to be invoked when the map is flinged.
*
* @see MapboxMap#setOnFlingListener(OnFlingListener)
* @see MapboxMap#addOnFlingListener(OnFlingListener)
*/
public interface OnFlingListener {
/**
@@ -2334,20 +2209,6 @@ public final class MapboxMap {
void onFling();
}
/**
* Interface definition for a callback to be invoked when the map is scrolled.
*
* @see MapboxMap#setOnScrollListener(OnScrollListener)
* @deprecated Use {@link OnMoveListener} instead.
*/
@Deprecated
public interface OnScrollListener {
/**
* Called when the map is scrolled.
*/
void onScroll();
}
/**
* Interface definition for a callback to be invoked when the map is moved.
*
@@ -2400,25 +2261,6 @@ public final class MapboxMap {
void onShoveEnd(@NonNull ShoveGestureDetector detector);
}
/**
* Interface definition for a callback to be invoked when the camera changes position.
*
* @deprecated Replaced by {@link MapboxMap.OnCameraMoveStartedListener}, {@link MapboxMap.OnCameraMoveListener} and
* {@link MapboxMap.OnCameraIdleListener}. The order in which the deprecated onCameraChange method will be called in
* relation to the methods in the new camera change listeners is undefined.
*/
@Deprecated
public interface OnCameraChangeListener {
/**
* Called after the camera position has changed. During an animation,
* this listener may not be notified of intermediate camera positions.
* It is always called for the final position in the animation.
*
* @param position The CameraPosition at the end of the last camera change.
*/
void onCameraChange(CameraPosition position);
}
/**
* Interface definition for a callback to be invoked for when the camera motion starts.
*/
@@ -2503,26 +2345,15 @@ public final class MapboxMap {
* related to touch and click events.
*/
interface OnGesturesManagerInteractionListener {
void onSetMapClickListener(OnMapClickListener listener);
void onAddMapClickListener(OnMapClickListener listener);
void onRemoveMapClickListener(OnMapClickListener listener);
void onSetMapLongClickListener(OnMapLongClickListener listener);
void onAddMapLongClickListener(OnMapLongClickListener listener);
void onRemoveMapLongClickListener(OnMapLongClickListener listener);
void onSetScrollListener(OnScrollListener listener);
void onAddScrollListener(OnScrollListener listener);
void onRemoveScrollListener(OnScrollListener listener);
void onSetFlingListener(OnFlingListener listener);
void onAddFlingListener(OnFlingListener listener);
void onRemoveFlingListener(OnFlingListener listener);
@@ -2554,7 +2385,7 @@ public final class MapboxMap {
/**
* Interface definition for a callback to be invoked when the user clicks on the map view.
*
* @see MapboxMap#setOnMapClickListener(OnMapClickListener)
* @see MapboxMap#addOnMapClickListener(OnMapClickListener)
*/
public interface OnMapClickListener {
/**
@@ -2570,7 +2401,7 @@ public final class MapboxMap {
/**
* Interface definition for a callback to be invoked when the user long clicks on the map view.
*
* @see MapboxMap#setOnMapLongClickListener(OnMapLongClickListener)
* @see MapboxMap#addOnMapLongClickListener(OnMapLongClickListener)
*/
public interface OnMapLongClickListener {
/**

View File

@@ -1,61 +0,0 @@
package com.mapbox.mapboxsdk.maps;
import com.mapbox.android.telemetry.SessionInterval;
import com.mapbox.mapboxsdk.module.telemetry.TelemetryImpl;
/**
* @deprecated use {@link TelemetryImpl} instead.
*/
@Deprecated
public class Telemetry {
@Deprecated
public static void initialize() {
// no-op
}
/**
* Set the debug logging state of telemetry.
*
* @param debugLoggingEnabled true to enable logging
* @deprecated use {@link TelemetryImpl#updateDebugLoggingEnabled(boolean)} instead
*/
@Deprecated
public static void updateDebugLoggingEnabled(boolean debugLoggingEnabled) {
TelemetryImpl.updateDebugLoggingEnabled(debugLoggingEnabled);
}
/**
* Update the telemetry rotation session id interval
*
* @param interval the selected session interval
* @return true if rotation session id was updated
* @deprecated use {@link TelemetryImpl#setSessionIdRotationInterval(int)} instead
*/
@Deprecated
public static boolean updateSessionIdRotationInterval(SessionInterval interval) {
return TelemetryImpl.updateSessionIdRotationInterval(interval);
}
/**
* Method to be called when an end-user has selected to participate in telemetry collection.
*
* @deprecated use {@link TelemetryImpl#setUserTelemetryRequestState(boolean)}
* with parameter true instead
*/
@Deprecated
public static void enableOnUserRequest() {
TelemetryImpl.enableOnUserRequest();
}
/**
* Method to be called when an end-user has selected to opt-out of telemetry collection.
*
* @deprecated use {@link TelemetryImpl#setUserTelemetryRequestState(boolean)}
* with parameter false instead
*/
@Deprecated
public static void disableOnUserRequest() {
TelemetryImpl.disableOnUserRequest();
}
}

View File

@@ -18,8 +18,7 @@ import static com.mapbox.mapboxsdk.maps.MapboxMap.OnCameraMoveStartedListener;
/**
* Resembles the current Map transformation.
* <p>
* Responsible for synchronising {@link CameraPosition} state and notifying
* {@link com.mapbox.mapboxsdk.maps.MapboxMap.OnCameraChangeListener}.
* Responsible for synchronising {@link CameraPosition} state and notifying camera change listeners.
* </p>
*/
final class Transform implements MapView.OnCameraDidChangeListener {
@@ -34,8 +33,6 @@ final class Transform implements MapView.OnCameraDidChangeListener {
private CameraPosition cameraPosition;
private MapboxMap.CancelableCallback cameraCancelableCallback;
private MapboxMap.OnCameraChangeListener onCameraChangeListener;
private CameraChangeDispatcher cameraChangeDispatcher;
private final MapView.OnCameraDidChangeListener moveByChangeListener = new MapView.OnCameraDidChangeListener() {
@@ -174,9 +171,6 @@ final class Transform implements MapView.OnCameraDidChangeListener {
}
this.cameraPosition = cameraPosition;
if (onCameraChangeListener != null) {
onCameraChangeListener.onCameraChange(this.cameraPosition);
}
}
return cameraPosition;
}
@@ -215,14 +209,6 @@ final class Transform implements MapView.OnCameraDidChangeListener {
nativeMapView.resetNorth();
}
//
// Camera change listener API
//
void setOnCameraChangeListener(@Nullable MapboxMap.OnCameraChangeListener listener) {
this.onCameraChangeListener = listener;
}
//
// non Camera API
//

View File

@@ -2,45 +2,25 @@ package com.mapbox.mapboxsdk.module.telemetry;
import android.content.Context;
import android.support.annotation.NonNull;
import com.mapbox.android.telemetry.AppUserTurnstile;
import com.mapbox.android.telemetry.Event;
import com.mapbox.android.telemetry.MapEventFactory;
import com.mapbox.android.telemetry.MapState;
import com.mapbox.android.telemetry.MapboxTelemetry;
import com.mapbox.android.telemetry.SessionInterval;
import com.mapbox.android.telemetry.TelemetryEnabler;
import com.mapbox.android.telemetry.SessionInterval;
import com.mapbox.mapboxsdk.BuildConfig;
import com.mapbox.mapboxsdk.MapStrictMode;
import com.mapbox.mapboxsdk.Mapbox;
import com.mapbox.mapboxsdk.log.Logger;
import com.mapbox.mapboxsdk.maps.TelemetryDefinition;
import com.mapbox.mapboxsdk.offline.OfflineRegionDefinition;
import com.mapbox.mapboxsdk.offline.OfflineTilePyramidRegionDefinition;
import java.lang.reflect.Field;
public class TelemetryImpl implements TelemetryDefinition {
private static final String TAG = "Mbgl-TelemetryImpl";
private static TelemetryImpl instance;
private MapboxTelemetry telemetry;
/**
* Get a single instance of TelemetryImpl.
*
* @return instance of Telemetry
* @deprecated reference instance from Mapbox.java instead
*/
@Deprecated
public static synchronized TelemetryImpl getInstance() {
if (instance == null) {
instance = new TelemetryImpl();
}
return instance;
}
private TelemetryImpl() {
public TelemetryImpl() {
Context appContext = Mapbox.getApplicationContext();
String accessToken = Mapbox.getAccessToken();
telemetry = new MapboxTelemetry(appContext, accessToken, BuildConfig.MAPBOX_EVENTS_USER_AGENT);
@@ -123,68 +103,4 @@ public class TelemetryImpl implements TelemetryDefinition {
offlineDefinition.getStyleURL())
);
}
/**
* Set the debug logging state of telemetry.
*
* @param debugLoggingEnabled true to enable logging
* @deprecated use {@link #setDebugLoggingEnabled(boolean)} instead
*/
@Deprecated
public static void updateDebugLoggingEnabled(boolean debugLoggingEnabled) {
TelemetryDefinition definition = Mapbox.getTelemetry();
if (definition != null) {
definition.setDebugLoggingEnabled(debugLoggingEnabled);
}
}
/**
* Update the telemetry rotation session id interval
*
* @param interval the selected session interval
* @return true if rotation session id was updated
* @deprecated use {@link #setSessionIdRotationInterval(int)} instead
*/
@Deprecated
public static boolean updateSessionIdRotationInterval(SessionInterval interval) {
try {
Field field = interval.getClass().getDeclaredField("interval");
field.setAccessible(true);
Integer intervalValue = (Integer) field.get(interval);
TelemetryDefinition definition = Mapbox.getTelemetry();
if (definition != null) {
return definition.setSessionIdRotationInterval(intervalValue);
}
} catch (Exception exception) {
Logger.e(TAG, "Exception occurred when updating session id rotation interval", exception);
MapStrictMode.strictModeViolation(exception);
}
return false;
}
/**
* Method to be called when an end-user has selected to participate in telemetry collection.
*
* @deprecated use {@link #setUserTelemetryRequestState(boolean)} with parameter true instead
*/
@Deprecated
public static void enableOnUserRequest() {
TelemetryDefinition definition = Mapbox.getTelemetry();
if (definition != null) {
definition.setUserTelemetryRequestState(true);
}
}
/**
* Method to be called when an end-user has selected to opt-out of telemetry collection.
*
* @deprecated use {@link #setUserTelemetryRequestState(boolean)} with parameter false instead
*/
@Deprecated
public static void disableOnUserRequest() {
TelemetryDefinition definition = Mapbox.getTelemetry();
if (definition != null) {
definition.setUserTelemetryRequestState(false);
}
}
}
}