-
Notifications
You must be signed in to change notification settings - Fork 319
0.22.0 Migration Guide
- Replace LocationLayerPlugin with LocationComponent
- Consume Sub BannerText in InstructionView
- Added nav-native ETAs
The deprecated InstructionView#update(RouteProgress)
was removed.
To update the InstructionView
(used outside of the NavigationView
as its own component), you need to implement two methods now to ensure the View
is properly updated with the correct data.
Both ProgressChangeListener
and MilestoneEventListener
must be implemented. The reason behind this is because we provide banner instruction updates via the MilestoneEventListener
(which happens ~2 times a step). The ProgressChangeListener
must be implemented as well because it provides the distance remaining data, which is updated every second. Ultimately, this helps with the amount of updates to the TextView
and ImageView
s in the InstructionView
, increasing the UI efficiency.
@Override
public void onProgressChange(Location location, RouteProgress routeProgress) {
instructionView.updateDistanceWith(routeProgress);
}
@Override
public void onMilestoneEvent(RouteProgress routeProgress, String instruction, Milestone milestone) {
instructionView.updateBannerInstructionsWith(milestone);
}
NavigationCamera#updateCameraTrackingEnabled(boolean isEnabled)
was replaced with updateCameraTrackingMode(@NavigationCamera.TrackingMode int trackingMode)
This changes the way you enable and disable the NavigationCamera
. To do so now, you can alternate between different TrackingMode
s:
-
NAVIGATION_TRACKING_MODE_NONE
: camera does not tack the user location (replaces disabled behavior) -
NAVIGATION_TRACKING_MODE_GPS
: camera tracks the user location, with bearing provided by the location update -
NAVIGATION_TRACKING_MODE_NORTH
: camera tracks the user location, with bearing always set to north (0)
// Tracking disabled
camera.updateCameraTrackingMode(NavigationCamera.NAVIGATION_TRACKING_MODE_NONE)
// Tracking enabled
camera.updateCameraTrackingMode(NavigationCamera.NAVIGATION_TRACKING_MODE_GPS)
NavigationCamera#resetCameraPosition()
was replaced with NavigationCamera#resetCameraPositionWith(@TrackingMode int trackingMode)
:
This change was made so that you can not only reset the camera to its last known position, but also begin tracking again with the mode specified in the param passed.
// Moves camera to last known position and begins tracking with bearing 0
camera.resetCameraPositionWith(NavigationCamera.NAVIGATION_TRACKING_MODE_GPS_NORTH)
As a result of these API changes, we also updated NavigationMapboxMap
which can be used with NavigationView#retrieveNavigationMap()
or by itself as shown in ComponentNavigationActivity
. The changes mirror the changes to the NavigationCamera
API itself.