Skip to content
This repository has been archived by the owner on Aug 8, 2023. It is now read-only.

Commit

Permalink
[android] - remove deprecation notices and code
Browse files Browse the repository at this point in the history
  • Loading branch information
tobrun committed Nov 1, 2018
1 parent ca21ced commit ba57fd4
Show file tree
Hide file tree
Showing 21 changed files with 234 additions and 681 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -18,9 +18,6 @@ public HttpRequest createHttpRequest() {
@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();
}
}

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -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 {
Expand Down Expand Up @@ -67,26 +62,6 @@ public void onCameraIdle() {
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);
}
Expand Down Expand Up @@ -132,13 +107,6 @@ private void executeOnCameraMoveStarted() {
return;
}
idle = false;

// deprecated API
if (onCameraMoveStartedListener != null) {
onCameraMoveStartedListener.onCameraMoveStarted(moveStartedReason);
}

// new API
if (!onCameraMoveStarted.isEmpty()) {
for (OnCameraMoveStartedListener cameraMoveStartedListener : onCameraMoveStarted) {
cameraMoveStartedListener.onCameraMoveStarted(moveStartedReason);
Expand All @@ -147,12 +115,6 @@ private void executeOnCameraMoveStarted() {
}

private void executeOnCameraMove() {
// deprecated API
if (onCameraMoveListener != null && !idle) {
onCameraMoveListener.onCameraMove();
}

// new API
if (!onCameraMove.isEmpty() && !idle) {
for (OnCameraMoveListener cameraMoveListener : onCameraMove) {
cameraMoveListener.onCameraMove();
Expand All @@ -161,12 +123,6 @@ private void executeOnCameraMove() {
}

private void executeOnCameraMoveCancelled() {
// deprecated API
if (onCameraMoveCanceledListener != null && !idle) {
onCameraMoveCanceledListener.onCameraMoveCanceled();
}

// new API
if (!onCameraMoveCanceled.isEmpty() && !idle) {
for (OnCameraMoveCanceledListener cameraMoveCanceledListener : onCameraMoveCanceled) {
cameraMoveCanceledListener.onCameraMoveCanceled();
Expand All @@ -179,13 +135,6 @@ private void executeOnCameraIdle() {
return;
}
idle = true;

// deprecated API
if (onCameraIdleListener != null) {
onCameraIdleListener.onCameraIdle();
}

// new API
if (!onCameraIdle.isEmpty()) {
for (OnCameraIdleListener cameraIdleListener : onCameraIdle) {
cameraIdleListener.onCameraIdle();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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<>();
Expand All @@ -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<>();

Expand Down Expand Up @@ -457,7 +448,6 @@ public boolean onMove(MoveGestureDetector detector, float distanceX, float dista
// Scroll the map
transform.moveBy(-distanceX, -distanceY, 0 /*no duration*/);

notifyOnScrollListeners();
notifyOnMoveListeners(detector);
}
return true;
Expand Down Expand Up @@ -920,12 +910,6 @@ private boolean isZoomValid(double mapZoom) {
}

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;
Expand All @@ -934,12 +918,6 @@ void notifyOnMapClickListeners(PointF tapPoint) {
}

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;
Expand All @@ -948,29 +926,11 @@ void notifyOnMapLongClickListeners(PointF longClickPoint) {
}

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);
Expand Down Expand Up @@ -1043,22 +1003,6 @@ void notifyOnShoveEndListeners(ShoveGestureDetector detector) {
}
}

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);
}
Expand All @@ -1083,14 +1027,6 @@ void removeOnFlingListener(MapboxMap.OnFlingListener onFlingListener) {
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);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -1025,11 +1025,6 @@ private void onDestroy() {

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);
Expand All @@ -1040,11 +1035,6 @@ public void onRemoveMapClickListener(MapboxMap.OnMapClickListener listener) {
mapGestureDetector.removeOnMapClickListener(listener);
}

@Override
public void onSetMapLongClickListener(MapboxMap.OnMapLongClickListener listener) {
mapGestureDetector.setOnMapLongClickListener(listener);
}

@Override
public void onAddMapLongClickListener(MapboxMap.OnMapLongClickListener listener) {
mapGestureDetector.addOnMapLongClickListener(listener);
Expand All @@ -1055,26 +1045,6 @@ public void onRemoveMapLongClickListener(MapboxMap.OnMapLongClickListener listen
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);
Expand Down
Loading

0 comments on commit ba57fd4

Please sign in to comment.