- Notifications
You must be signed in to change notification settings - Fork320
0.22.0 Migration Guide
- Replace LocationLayerPlugin with LocationComponent
- Consume Sub BannerText in InstructionView
- Added nav-native ETAs
The deprecatedInstructionView#update(RouteProgress)was removed.
To update theInstructionView (used outside of theNavigationView as its own component), you need to implement two methods now to ensure theView is properly updated with the correct data.
BothProgressChangeListener andMilestoneEventListener must be implemented. The reason behind this is because we provide banner instruction updates via theMilestoneEventListener (which happens ~2 times a step). TheProgressChangeListener 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 theTextView andImageViews in theInstructionView, increasing the UI efficiency.
@Overridepublic void onProgressChange(Location location, RouteProgress routeProgress) { instructionView.updateDistanceWith(routeProgress);}@Overridepublic void onMilestoneEvent(RouteProgress routeProgress, String instruction, Milestone milestone) { instructionView.updateBannerInstructionsWith(milestone);}NavigationCamera#updateCameraTrackingEnabled(boolean isEnabled) wasreplaced withupdateCameraTrackingMode(@NavigationCamera.TrackingMode int trackingMode)
This changes the way you enable and disable theNavigationCamera. To do so now, you can alternate between differentTrackingModes:
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 updateNAVIGATION_TRACKING_MODE_NORTH: camera tracks the user location, with bearing always set to north (0)
// Tracking disabledcamera.updateCameraTrackingMode(NavigationCamera.NAVIGATION_TRACKING_MODE_NONE)// Tracking enabled camera.updateCameraTrackingMode(NavigationCamera.NAVIGATION_TRACKING_MODE_GPS)NavigationCamera#resetCameraPosition()was replaced withNavigationCamera#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 0camera.resetCameraPositionWith(NavigationCamera.NAVIGATION_TRACKING_MODE_GPS_NORTH)As a result of these API changes, we also updatedNavigationMapboxMap which can be used withNavigationView#retrieveNavigationMap() or by itself as shown inComponentNavigationActivity. The changes mirror the changes to theNavigationCamera API itself.