Skip to content

Commit f50d8d5

Browse files
authored
Map + Location Animators (#293)
* Add initial animators * Add Camera and Tracking Modes (#294) * Add style / tracking modes for camera integration * Fix broken tests * API tweaks and example update * Update with Render / Camera Modes (#297) * Update with render / camera modes * Update camera with mode manager and cancel animation check * Update method compass name * Add animator class (#302) * initial LocationLayerPlugin cleanup * added the animator class * animator implementation in the LocationLayer * reworked location layer camera * added Animator to LocationLayerPlugin * adjusted location activities * animator order fix * last values ordering fix * string fixes * Fix GPS layer * using previous animated value when starting a new one * small tweaks * setting accuracy ring only if using the right mode * Cleanup stale runnable (#304) * only update the location layer accuracy when not in RenderMode.GPS (#306) * Improve enabling/disabling location layer plugin (#308) * LocationLayerPlugin Javadoc (#309) * Clean up and javadoc * Updates per review * LocationEngine listening to updates after resetting (#307) * [location-layer-plugin] - improve setting location engine * [location-layer-plugin] - attaching location engine listener when resetting the engine * Add max / min zoom and padding APIs (#313) * Clean up and javadoc * Add long click listener * Add max / min zoom and padding APIs * Fix javadoc * Add default values to options * Gestures logic for camera tracking, new telemetry library (#327) * [location-layer-plugin] - bumped maps SDK to 6.x * [location-layer-plugin] - style options initialization fixes * [location-layer-plugin] - added gestures handling implementation * Update dependencies * Add missing long click listener * [location-layer] - fix crash on startup * Add initial animators * Add Camera and Tracking Modes (#294) * Add style / tracking modes for camera integration * Fix broken tests * API tweaks and example update * Update with Render / Camera Modes (#297) * Update with render / camera modes * Update camera with mode manager and cancel animation check * Update method compass name * Add animator class (#302) * initial LocationLayerPlugin cleanup * added the animator class * animator implementation in the LocationLayer * reworked location layer camera * added Animator to LocationLayerPlugin * adjusted location activities * animator order fix * last values ordering fix * string fixes * Fix GPS layer * using previous animated value when starting a new one * small tweaks * setting accuracy ring only if using the right mode * Cleanup stale runnable (#304) * only update the location layer accuracy when not in RenderMode.GPS (#306) * Improve enabling/disabling location layer plugin (#308) * LocationLayerPlugin Javadoc (#309) * Clean up and javadoc * Updates per review * LocationEngine listening to updates after resetting (#307) * [location-layer-plugin] - improve setting location engine * [location-layer-plugin] - attaching location engine listener when resetting the engine * Add max / min zoom and padding APIs (#313) * Clean up and javadoc * Add long click listener * Add max / min zoom and padding APIs * Fix javadoc * Add default values to options * Gestures logic for camera tracking, new telemetry library (#327) * [location-layer-plugin] - bumped maps SDK to 6.x * [location-layer-plugin] - style options initialization fixes * [location-layer-plugin] - added gestures handling implementation * Update dependencies * Add missing long click listener * [location-layer] - fix crash on startup * updated branch to latest on master * Fixed checkstyle error * fixed up ui test * use old mas lib for geojson plugin * Animator Updates (#349) * Add initial animators * Add Camera and Tracking Modes (#294) * Add style / tracking modes for camera integration * Fix broken tests * API tweaks and example update * Update with Render / Camera Modes (#297) * Update with render / camera modes * Update camera with mode manager and cancel animation check * Update method compass name * Add animator class (#302) * initial LocationLayerPlugin cleanup * added the animator class * animator implementation in the LocationLayer * reworked location layer camera * added Animator to LocationLayerPlugin * adjusted location activities * animator order fix * last values ordering fix * string fixes * Fix GPS layer * using previous animated value when starting a new one * small tweaks * setting accuracy ring only if using the right mode * Cleanup stale runnable (#304) * only update the location layer accuracy when not in RenderMode.GPS (#306) * Improve enabling/disabling location layer plugin (#308) * LocationLayerPlugin Javadoc (#309) * Clean up and javadoc * Updates per review * LocationEngine listening to updates after resetting (#307) * [location-layer-plugin] - improve setting location engine * [location-layer-plugin] - attaching location engine listener when resetting the engine * Add max / min zoom and padding APIs (#313) * Clean up and javadoc * Add long click listener * Add max / min zoom and padding APIs * Fix javadoc * Add default values to options * Gestures logic for camera tracking, new telemetry library (#327) * [location-layer-plugin] - bumped maps SDK to 6.x * [location-layer-plugin] - style options initialization fixes * [location-layer-plugin] - added gestures handling implementation * Update dependencies * Add missing long click listener * [location-layer] - fix crash on startup * Smooth bearing animation * Add separate camera animators * Fix camera transitions between animators * Add reset function for switching camera modes * Add gps north functionality to camera animator * Camera transition updates * [location-layer-plugin] - fixed camera tracking callbacks * [location-layer-plugin] - decreased default max zoom * [location-layer-plugin] - saving state in LocationLayerModesActivity * update maps sdk to latest beta (#384) * update maps sdk to latest beta * fixed checkstyle * Gestures thresholds adjustments (#386) * [location-layer-plugin] - fixed gestures threshold * [location-layer-plugin] - layer drawable updates adjustments * Fix order of interpolator expression (#388) * [android] - fix order of interpolator * [location-layer-plugin] - fine tuned scale values * Update feature import * fixup geojson * fixup checkstyle
1 parent e2c85f5 commit f50d8d5

45 files changed

Lines changed: 2377 additions & 1112 deletions

File tree

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

app/build.gradle

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,8 @@ android {
1414

1515
buildTypes {
1616
debug {
17+
minifyEnabled false
18+
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
1719
testCoverageEnabled true
1820
}
1921
release {

app/src/androidTest/java/com/mapbox/mapboxsdk/plugins/locationlayer/LocationLayerTest.java

Lines changed: 16 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,7 @@
1313
import com.mapbox.mapboxsdk.camera.CameraUpdateFactory;
1414
import com.mapbox.mapboxsdk.constants.Style;
1515
import com.mapbox.mapboxsdk.maps.MapboxMap;
16+
import com.mapbox.mapboxsdk.plugins.locationlayer.modes.RenderMode;
1617
import com.mapbox.mapboxsdk.plugins.testapp.activity.location.LocationLayerModesActivity;
1718
import com.mapbox.mapboxsdk.style.layers.Property;
1819
import com.mapbox.mapboxsdk.style.layers.SymbolLayer;
@@ -38,7 +39,6 @@
3839
import static com.mapbox.mapboxsdk.plugins.locationlayer.LocationLayerConstants.FOREGROUND_LAYER;
3940
import static com.mapbox.mapboxsdk.plugins.locationlayer.LocationLayerConstants.FOREGROUND_STALE_ICON;
4041
import static com.mapbox.mapboxsdk.plugins.locationlayer.LocationLayerConstants.LOCATION_SOURCE;
41-
import static com.mapbox.mapboxsdk.plugins.locationlayer.LocationLayerConstants.NAVIGATION_LAYER;
4242
import static org.hamcrest.Matchers.equalTo;
4343
import static org.hamcrest.Matchers.not;
4444
import static org.junit.Assert.assertEquals;
@@ -91,7 +91,7 @@ public void locationSourceAdded() throws Exception {
9191
@Override
9292
public void onLocationLayerAction(LocationLayerPlugin locationLayerPlugin, MapboxMap mapboxMap,
9393
UiController uiController, Context context) {
94-
locationLayerPlugin.setLocationLayerEnabled(LocationLayerMode.TRACKING);
94+
locationLayerPlugin.setRenderMode(RenderMode.NORMAL);
9595
assertTrue(mapboxMap.getSource(LOCATION_SOURCE) != null);
9696
}
9797
});
@@ -103,7 +103,7 @@ public void locationTrackingLayersAdded() throws Exception {
103103
@Override
104104
public void onLocationLayerAction(LocationLayerPlugin locationLayerPlugin, MapboxMap mapboxMap,
105105
UiController uiController, Context context) {
106-
locationLayerPlugin.setLocationLayerEnabled(LocationLayerMode.TRACKING);
106+
locationLayerPlugin.setRenderMode(RenderMode.NORMAL);
107107
assertTrue(mapboxMap.getLayer(ACCURACY_LAYER) != null);
108108
assertTrue(mapboxMap.getLayer(BACKGROUND_LAYER) != null);
109109
assertTrue(mapboxMap.getLayer(FOREGROUND_LAYER) != null);
@@ -117,7 +117,7 @@ public void locationBearingLayersAdded() throws Exception {
117117
@Override
118118
public void onLocationLayerAction(LocationLayerPlugin locationLayerPlugin, MapboxMap mapboxMap,
119119
UiController uiController, Context context) {
120-
locationLayerPlugin.setLocationLayerEnabled(LocationLayerMode.COMPASS);
120+
locationLayerPlugin.setRenderMode(RenderMode.COMPASS);
121121
assertTrue(mapboxMap.getLayer(ACCURACY_LAYER) != null);
122122
assertTrue(mapboxMap.getLayer(BACKGROUND_LAYER) != null);
123123
assertTrue(mapboxMap.getLayer(FOREGROUND_LAYER) != null);
@@ -132,8 +132,8 @@ public void locationNavigationLayersAdded() throws Exception {
132132
@Override
133133
public void onLocationLayerAction(LocationLayerPlugin locationLayerPlugin, MapboxMap mapboxMap,
134134
UiController uiController, Context context) {
135-
locationLayerPlugin.setLocationLayerEnabled(LocationLayerMode.COMPASS);
136-
assertTrue(mapboxMap.getLayer(NAVIGATION_LAYER) != null);
135+
locationLayerPlugin.setRenderMode(RenderMode.COMPASS);
136+
assertTrue(mapboxMap.getLayer(FOREGROUND_LAYER) != null);
137137
}
138138
});
139139
}
@@ -144,9 +144,9 @@ public void locationLayerModeCorrectlySetToNone() throws Exception {
144144
@Override
145145
public void onLocationLayerAction(LocationLayerPlugin locationLayerPlugin, MapboxMap mapboxMap,
146146
UiController uiController, Context context) {
147-
locationLayerPlugin.setLocationLayerEnabled(LocationLayerMode.TRACKING);
147+
locationLayerPlugin.setRenderMode(RenderMode.NORMAL);
148148
assertTrue(mapboxMap.getLayer(FOREGROUND_LAYER) != null);
149-
locationLayerPlugin.setLocationLayerEnabled(LocationLayerMode.NONE);
149+
locationLayerPlugin.setLocationLayerEnabled(false);
150150
assertTrue(mapboxMap.getLayer(FOREGROUND_LAYER).getVisibility().getValue()
151151
.equals(Property.NONE));
152152
}
@@ -159,11 +159,11 @@ public void onMapChangeLocationLayerRedrawn() throws Exception {
159159
@Override
160160
public void onLocationLayerAction(LocationLayerPlugin locationLayerPlugin, MapboxMap mapboxMap,
161161
UiController uiController, Context context) {
162-
locationLayerPlugin.setLocationLayerEnabled(LocationLayerMode.TRACKING);
162+
locationLayerPlugin.setRenderMode(RenderMode.NORMAL);
163163
assertTrue(mapboxMap.getLayer(FOREGROUND_LAYER) != null);
164164
mapboxMap.setStyleUrl(Style.SATELLITE);
165165
uiController.loopMainThreadForAtLeast(500);
166-
assertEquals(locationLayerPlugin.getLocationLayerMode(), LocationLayerMode.TRACKING);
166+
assertEquals(locationLayerPlugin.getRenderMode(), RenderMode.NORMAL);
167167
assertTrue(mapboxMap.getLayer(FOREGROUND_LAYER) != null);
168168
assertTrue(mapboxMap.getLayer(FOREGROUND_LAYER).getVisibility().getValue()
169169
.equals(Property.VISIBLE));
@@ -181,11 +181,11 @@ public void whenStaleTimeSet_iconsDoChangeAtAppropriateTime() throws Exception {
181181
@Override
182182
public void onLocationLayerAction(LocationLayerPlugin locationLayerPlugin, MapboxMap mapboxMap,
183183
UiController uiController, Context context) {
184-
locationLayerPlugin.setLocationLayerEnabled(LocationLayerMode.TRACKING);
184+
locationLayerPlugin.setRenderMode(RenderMode.NORMAL);
185185
SymbolLayer symbolLayer = mapboxMap.getLayerAs(FOREGROUND_LAYER);
186186
assert symbolLayer != null;
187187
assertThat(symbolLayer.getIconImage().getValue(), equalTo(FOREGROUND_ICON));
188-
locationLayerPlugin.applyStyle(LocationLayerOptions.builder(context).staleStateDelay(400).build());
188+
locationLayerPlugin.applyStyle(LocationLayerOptions.builder(context).staleStateTimeout(400).build());
189189
locationLayerPlugin.forceLocationUpdate(location);
190190
uiController.loopMainThreadForAtLeast(500);
191191
assertThat(symbolLayer.getIconImage().getValue(), equalTo(FOREGROUND_STALE_ICON));
@@ -199,8 +199,8 @@ public void whenDrawableChanged_continuesUsingStaleIcons() throws Exception {
199199
@Override
200200
public void onLocationLayerAction(LocationLayerPlugin locationLayerPlugin, MapboxMap mapboxMap,
201201
UiController uiController, Context context) {
202-
locationLayerPlugin.setLocationLayerEnabled(LocationLayerMode.TRACKING);
203-
locationLayerPlugin.applyStyle(LocationLayerOptions.builder(context).staleStateDelay(100).build());
202+
locationLayerPlugin.setRenderMode(RenderMode.NORMAL);
203+
locationLayerPlugin.applyStyle(LocationLayerOptions.builder(context).staleStateTimeout(100).build());
204204
locationLayerPlugin.forceLocationUpdate(location);
205205
uiController.loopMainThreadForAtLeast(200);
206206
rule.getActivity().toggleStyle();
@@ -215,9 +215,10 @@ public void onLocationLayerAction(LocationLayerPlugin locationLayerPlugin, Mapbo
215215
public void whenMapCameraInitializesTilted_iconsGetPlacedWithCorrectOffset() throws Exception {
216216
executeLocationLayerTest((locationLayerPlugin, mapboxMap, uiController, context) -> {
217217
mapboxMap.moveCamera(CameraUpdateFactory.newCameraPosition(new CameraPosition.Builder().tilt(60).build()));
218-
locationLayerPlugin.setLocationLayerEnabled(LocationLayerMode.TRACKING);
218+
locationLayerPlugin.setRenderMode(RenderMode.NORMAL);
219219
locationLayerPlugin.forceLocationUpdate(location);
220220
SymbolLayer layer = mapboxMap.getLayerAs(FOREGROUND_LAYER);
221+
uiController.loopMainThreadForAtLeast(200);
221222
Float[] value = layer.getIconOffset().getValue();
222223
Assert.assertEquals((-0.05 * 60), value[1], 0.1);
223224
});

0 commit comments

Comments
 (0)