Skip to content

Commit

Permalink
Map + Location Animators (#293)
Browse files Browse the repository at this point in the history
* 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
  • Loading branch information
danesfeder authored Mar 28, 2018
1 parent e2c85f5 commit f50d8d5
Show file tree
Hide file tree
Showing 45 changed files with 2,377 additions and 1,112 deletions.
2 changes: 2 additions & 0 deletions app/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,8 @@ android {

buildTypes {
debug {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
testCoverageEnabled true
}
release {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@
import com.mapbox.mapboxsdk.camera.CameraUpdateFactory;
import com.mapbox.mapboxsdk.constants.Style;
import com.mapbox.mapboxsdk.maps.MapboxMap;
import com.mapbox.mapboxsdk.plugins.locationlayer.modes.RenderMode;
import com.mapbox.mapboxsdk.plugins.testapp.activity.location.LocationLayerModesActivity;
import com.mapbox.mapboxsdk.style.layers.Property;
import com.mapbox.mapboxsdk.style.layers.SymbolLayer;
Expand All @@ -38,7 +39,6 @@
import static com.mapbox.mapboxsdk.plugins.locationlayer.LocationLayerConstants.FOREGROUND_LAYER;
import static com.mapbox.mapboxsdk.plugins.locationlayer.LocationLayerConstants.FOREGROUND_STALE_ICON;
import static com.mapbox.mapboxsdk.plugins.locationlayer.LocationLayerConstants.LOCATION_SOURCE;
import static com.mapbox.mapboxsdk.plugins.locationlayer.LocationLayerConstants.NAVIGATION_LAYER;
import static org.hamcrest.Matchers.equalTo;
import static org.hamcrest.Matchers.not;
import static org.junit.Assert.assertEquals;
Expand Down Expand Up @@ -91,7 +91,7 @@ public void locationSourceAdded() throws Exception {
@Override
public void onLocationLayerAction(LocationLayerPlugin locationLayerPlugin, MapboxMap mapboxMap,
UiController uiController, Context context) {
locationLayerPlugin.setLocationLayerEnabled(LocationLayerMode.TRACKING);
locationLayerPlugin.setRenderMode(RenderMode.NORMAL);
assertTrue(mapboxMap.getSource(LOCATION_SOURCE) != null);
}
});
Expand All @@ -103,7 +103,7 @@ public void locationTrackingLayersAdded() throws Exception {
@Override
public void onLocationLayerAction(LocationLayerPlugin locationLayerPlugin, MapboxMap mapboxMap,
UiController uiController, Context context) {
locationLayerPlugin.setLocationLayerEnabled(LocationLayerMode.TRACKING);
locationLayerPlugin.setRenderMode(RenderMode.NORMAL);
assertTrue(mapboxMap.getLayer(ACCURACY_LAYER) != null);
assertTrue(mapboxMap.getLayer(BACKGROUND_LAYER) != null);
assertTrue(mapboxMap.getLayer(FOREGROUND_LAYER) != null);
Expand All @@ -117,7 +117,7 @@ public void locationBearingLayersAdded() throws Exception {
@Override
public void onLocationLayerAction(LocationLayerPlugin locationLayerPlugin, MapboxMap mapboxMap,
UiController uiController, Context context) {
locationLayerPlugin.setLocationLayerEnabled(LocationLayerMode.COMPASS);
locationLayerPlugin.setRenderMode(RenderMode.COMPASS);
assertTrue(mapboxMap.getLayer(ACCURACY_LAYER) != null);
assertTrue(mapboxMap.getLayer(BACKGROUND_LAYER) != null);
assertTrue(mapboxMap.getLayer(FOREGROUND_LAYER) != null);
Expand All @@ -132,8 +132,8 @@ public void locationNavigationLayersAdded() throws Exception {
@Override
public void onLocationLayerAction(LocationLayerPlugin locationLayerPlugin, MapboxMap mapboxMap,
UiController uiController, Context context) {
locationLayerPlugin.setLocationLayerEnabled(LocationLayerMode.COMPASS);
assertTrue(mapboxMap.getLayer(NAVIGATION_LAYER) != null);
locationLayerPlugin.setRenderMode(RenderMode.COMPASS);
assertTrue(mapboxMap.getLayer(FOREGROUND_LAYER) != null);
}
});
}
Expand All @@ -144,9 +144,9 @@ public void locationLayerModeCorrectlySetToNone() throws Exception {
@Override
public void onLocationLayerAction(LocationLayerPlugin locationLayerPlugin, MapboxMap mapboxMap,
UiController uiController, Context context) {
locationLayerPlugin.setLocationLayerEnabled(LocationLayerMode.TRACKING);
locationLayerPlugin.setRenderMode(RenderMode.NORMAL);
assertTrue(mapboxMap.getLayer(FOREGROUND_LAYER) != null);
locationLayerPlugin.setLocationLayerEnabled(LocationLayerMode.NONE);
locationLayerPlugin.setLocationLayerEnabled(false);
assertTrue(mapboxMap.getLayer(FOREGROUND_LAYER).getVisibility().getValue()
.equals(Property.NONE));
}
Expand All @@ -159,11 +159,11 @@ public void onMapChangeLocationLayerRedrawn() throws Exception {
@Override
public void onLocationLayerAction(LocationLayerPlugin locationLayerPlugin, MapboxMap mapboxMap,
UiController uiController, Context context) {
locationLayerPlugin.setLocationLayerEnabled(LocationLayerMode.TRACKING);
locationLayerPlugin.setRenderMode(RenderMode.NORMAL);
assertTrue(mapboxMap.getLayer(FOREGROUND_LAYER) != null);
mapboxMap.setStyleUrl(Style.SATELLITE);
uiController.loopMainThreadForAtLeast(500);
assertEquals(locationLayerPlugin.getLocationLayerMode(), LocationLayerMode.TRACKING);
assertEquals(locationLayerPlugin.getRenderMode(), RenderMode.NORMAL);
assertTrue(mapboxMap.getLayer(FOREGROUND_LAYER) != null);
assertTrue(mapboxMap.getLayer(FOREGROUND_LAYER).getVisibility().getValue()
.equals(Property.VISIBLE));
Expand All @@ -181,11 +181,11 @@ public void whenStaleTimeSet_iconsDoChangeAtAppropriateTime() throws Exception {
@Override
public void onLocationLayerAction(LocationLayerPlugin locationLayerPlugin, MapboxMap mapboxMap,
UiController uiController, Context context) {
locationLayerPlugin.setLocationLayerEnabled(LocationLayerMode.TRACKING);
locationLayerPlugin.setRenderMode(RenderMode.NORMAL);
SymbolLayer symbolLayer = mapboxMap.getLayerAs(FOREGROUND_LAYER);
assert symbolLayer != null;
assertThat(symbolLayer.getIconImage().getValue(), equalTo(FOREGROUND_ICON));
locationLayerPlugin.applyStyle(LocationLayerOptions.builder(context).staleStateDelay(400).build());
locationLayerPlugin.applyStyle(LocationLayerOptions.builder(context).staleStateTimeout(400).build());
locationLayerPlugin.forceLocationUpdate(location);
uiController.loopMainThreadForAtLeast(500);
assertThat(symbolLayer.getIconImage().getValue(), equalTo(FOREGROUND_STALE_ICON));
Expand All @@ -199,8 +199,8 @@ public void whenDrawableChanged_continuesUsingStaleIcons() throws Exception {
@Override
public void onLocationLayerAction(LocationLayerPlugin locationLayerPlugin, MapboxMap mapboxMap,
UiController uiController, Context context) {
locationLayerPlugin.setLocationLayerEnabled(LocationLayerMode.TRACKING);
locationLayerPlugin.applyStyle(LocationLayerOptions.builder(context).staleStateDelay(100).build());
locationLayerPlugin.setRenderMode(RenderMode.NORMAL);
locationLayerPlugin.applyStyle(LocationLayerOptions.builder(context).staleStateTimeout(100).build());
locationLayerPlugin.forceLocationUpdate(location);
uiController.loopMainThreadForAtLeast(200);
rule.getActivity().toggleStyle();
Expand All @@ -215,9 +215,10 @@ public void onLocationLayerAction(LocationLayerPlugin locationLayerPlugin, Mapbo
public void whenMapCameraInitializesTilted_iconsGetPlacedWithCorrectOffset() throws Exception {
executeLocationLayerTest((locationLayerPlugin, mapboxMap, uiController, context) -> {
mapboxMap.moveCamera(CameraUpdateFactory.newCameraPosition(new CameraPosition.Builder().tilt(60).build()));
locationLayerPlugin.setLocationLayerEnabled(LocationLayerMode.TRACKING);
locationLayerPlugin.setRenderMode(RenderMode.NORMAL);
locationLayerPlugin.forceLocationUpdate(location);
SymbolLayer layer = mapboxMap.getLayerAs(FOREGROUND_LAYER);
uiController.loopMainThreadForAtLeast(200);
Float[] value = layer.getIconOffset().getValue();
Assert.assertEquals((-0.05 * 60), value[1], 0.1);
});
Expand Down
Loading

0 comments on commit f50d8d5

Please sign in to comment.