Skip to content

Conversation

@danesfeder
Copy link
Contributor

NavigationLauncherOptions now requires a DirectionsRoute every time you build an instance.

This PR updates NavigationActivity to always provide the original route stored in SharedPreferences. This is okay because, when initializing, the NavigationViewModel ignores the route provided if it's already running (after rotation it will be already running because the view model survives rotation).

@danesfeder danesfeder added bug Defect to be fixed. navigation-ui labels May 31, 2018
@danesfeder danesfeder added this to the 0.14.0 milestone May 31, 2018
@danesfeder danesfeder self-assigned this May 31, 2018
}

private static void storeRouteOptions(NavigationLauncherOptions options, SharedPreferences.Editor editor) {
if (options.directionsRoute() != null) {
Copy link
Contributor

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) {
Copy link
Contributor

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();
Copy link
Contributor

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();
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

same here

@danesfeder danesfeder force-pushed the dan-options-rotation branch from 14cef8f to 954867c Compare May 31, 2018 17:01
@danesfeder danesfeder merged commit 1c808c6 into master May 31, 2018
@danesfeder danesfeder deleted the dan-options-rotation branch May 31, 2018 17:22
@danesfeder danesfeder mentioned this pull request May 31, 2018
13 tasks
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

bug Defect to be fixed.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants