[android] improved gestures management while tracking location

This commit is contained in:
Łukasz Paczos
2018-09-05 19:06:38 +02:00
committed by Łukasz Paczos
parent 907612e93d
commit 8cd86fe1b4
10 changed files with 142 additions and 50 deletions

View File

@@ -15,7 +15,7 @@ import org.mockito.Mockito
import org.robolectric.RobolectricTestRunner
@RunWith(RobolectricTestRunner::class)
class MapboxAnimatorCoordinatorTest {
class LocationAnimatorCoordinatorTest {
private lateinit var locationAnimatorCoordinator: LocationAnimatorCoordinator
private val cameraPosition: CameraPosition = CameraPosition.DEFAULT

View File

@@ -2,6 +2,7 @@ package com.mapbox.mapboxsdk.location;
import android.graphics.PointF;
import com.mapbox.android.gestures.AndroidGesturesManager;
import com.mapbox.android.gestures.MoveGestureDetector;
import com.mapbox.mapboxsdk.camera.CameraPosition;
import com.mapbox.mapboxsdk.camera.CameraUpdate;
@@ -314,8 +315,9 @@ public class LocationCameraControllerTest {
when(mapboxMap.getUiSettings()).thenReturn(mock(UiSettings.class));
MoveGestureDetector moveGestureDetector = mock(MoveGestureDetector.class);
OnCameraMoveInvalidateListener onCameraMoveInvalidateListener = mock(OnCameraMoveInvalidateListener.class);
AndroidGesturesManager androidGesturesManager = mock(AndroidGesturesManager.class);
return new LocationCameraController(mapboxMap, moveGestureDetector,
onCameraTrackingChangedListener, onCameraMoveInvalidateListener);
onCameraTrackingChangedListener, onCameraMoveInvalidateListener, androidGesturesManager);
}
private LocationCameraController buildCamera(MoveGestureDetector moveGestureDetector) {
@@ -323,15 +325,17 @@ public class LocationCameraControllerTest {
when(mapboxMap.getUiSettings()).thenReturn(mock(UiSettings.class));
OnCameraTrackingChangedListener onCameraTrackingChangedListener = mock(OnCameraTrackingChangedListener.class);
OnCameraMoveInvalidateListener onCameraMoveInvalidateListener = mock(OnCameraMoveInvalidateListener.class);
AndroidGesturesManager androidGesturesManager = mock(AndroidGesturesManager.class);
return new LocationCameraController(mapboxMap, moveGestureDetector,
onCameraTrackingChangedListener, onCameraMoveInvalidateListener);
onCameraTrackingChangedListener, onCameraMoveInvalidateListener, androidGesturesManager);
}
private LocationCameraController buildCamera(MapboxMap mapboxMap) {
MoveGestureDetector moveGestureDetector = mock(MoveGestureDetector.class);
OnCameraTrackingChangedListener onCameraTrackingChangedListener = mock(OnCameraTrackingChangedListener.class);
OnCameraMoveInvalidateListener onCameraMoveInvalidateListener = mock(OnCameraMoveInvalidateListener.class);
AndroidGesturesManager androidGesturesManager = mock(AndroidGesturesManager.class);
return new LocationCameraController(mapboxMap, moveGestureDetector,
onCameraTrackingChangedListener, onCameraMoveInvalidateListener);
onCameraTrackingChangedListener, onCameraMoveInvalidateListener, androidGesturesManager);
}
}