invoke cancelable callback when zoom/tilt while tracking is ignored
This commit is contained in:
@@ -739,14 +739,15 @@ public final class LocationComponent {
|
||||
@Nullable MapboxMap.CancelableCallback callback) {
|
||||
checkActivationState();
|
||||
if (!isLayerReady) {
|
||||
notifyUnsuccessfulCameraOperation(callback, null);
|
||||
return;
|
||||
} else if (getCameraMode() == CameraMode.NONE) {
|
||||
Logger.e(TAG, String.format("%s%s",
|
||||
notifyUnsuccessfulCameraOperation(callback, String.format("%s%s",
|
||||
"LocationComponent#zoomWhileTracking method can only be used",
|
||||
" when a camera mode other than CameraMode#NONE is engaged."));
|
||||
return;
|
||||
} else if (locationCameraController.isTransitioning()) {
|
||||
Logger.e(TAG,
|
||||
notifyUnsuccessfulCameraOperation(callback,
|
||||
"LocationComponent#zoomWhileTracking method call is ignored because the camera mode is transitioning");
|
||||
return;
|
||||
}
|
||||
@@ -817,14 +818,15 @@ public final class LocationComponent {
|
||||
@Nullable MapboxMap.CancelableCallback callback) {
|
||||
checkActivationState();
|
||||
if (!isLayerReady) {
|
||||
notifyUnsuccessfulCameraOperation(callback, null);
|
||||
return;
|
||||
} else if (getCameraMode() == CameraMode.NONE) {
|
||||
Logger.e(TAG, String.format("%s%s",
|
||||
notifyUnsuccessfulCameraOperation(callback, String.format("%s%s",
|
||||
"LocationComponent#tiltWhileTracking method can only be used",
|
||||
" when a camera mode other than CameraMode#NONE is engaged."));
|
||||
return;
|
||||
} else if (locationCameraController.isTransitioning()) {
|
||||
Logger.e(TAG,
|
||||
notifyUnsuccessfulCameraOperation(callback,
|
||||
"LocationComponent#tiltWhileTracking method call is ignored because the camera mode is transitioning");
|
||||
return;
|
||||
}
|
||||
@@ -1607,6 +1609,17 @@ public final class LocationComponent {
|
||||
}
|
||||
}
|
||||
|
||||
private void notifyUnsuccessfulCameraOperation(@Nullable MapboxMap.CancelableCallback callback,
|
||||
@Nullable String msg) {
|
||||
if (msg != null) {
|
||||
Logger.e(TAG, msg);
|
||||
}
|
||||
|
||||
if (callback != null) {
|
||||
callback.onCancel();
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns whether the location component is activated.
|
||||
*
|
||||
|
||||
Reference in New Issue
Block a user