-
Notifications
You must be signed in to change notification settings - Fork 319
Always provide DirectionsRoute in NavigationActivity #980
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
| } | ||
|
|
||
| private static void storeRouteOptions(NavigationLauncherOptions options, SharedPreferences.Editor editor) { | ||
| if (options.directionsRoute() != null) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
why remove null check?
|
|
||
| private void extractRouteFromOptions(NavigationViewOptions options) { | ||
| DirectionsRoute route = options.directionsRoute(); | ||
| if (route != null) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
why remove null check?
| @Override | ||
| public void onStart() { | ||
| requestAudioFocus(); | ||
| instructionQueue.remove(); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
You can just do instructionQueue.poll which is the empty-safe version of remove
| if (isMapboxPlayer) { | ||
| androidSpeechPlayer.play(instructionQueue.peek().getAnnouncement()); | ||
| } else { | ||
| instructionQueue.remove(); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
same here
14cef8f to
954867c
Compare
NavigationLauncherOptionsnow requires aDirectionsRouteevery time you build an instance.This PR updates
NavigationActivityto always provide the original route stored inSharedPreferences. This is okay because, when initializing, theNavigationViewModelignores the route provided if it's already running (after rotation it will be already running because the view model survives rotation).