Skip to content
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

Add tunnels functionality #1392

Merged
merged 1 commit into from
Oct 16, 2018
Merged

Add tunnels functionality #1392

merged 1 commit into from
Oct 16, 2018

Conversation

Guardiola31337
Copy link
Contributor

@Guardiola31337 Guardiola31337 commented Oct 4, 2018

Fixes #835

TODOs

  • Noticed that in the EmbeddedNavigationActivity and FragmentNavigationActivity examples from the test app voice instructions are "duplicated" after recreating the Activity

@Guardiola31337 Guardiola31337 added ⚠️ DO NOT MERGE PR should not be merged! ✓ ready for review needs discussion Can't be started in current state, needs clarification. labels Oct 4, 2018
@Guardiola31337 Guardiola31337 self-assigned this Oct 4, 2018
@Guardiola31337 Guardiola31337 force-pushed the pg-tunnels branch 2 times, most recently from 7d99640 to cdac640 Compare October 4, 2018 16:50
@Guardiola31337
Copy link
Contributor Author

In order to keep this as simple as possible I went ahead and removed the TunnelListener option altogether. That means, less confusion to clients and less complexity on our side - avoiding any tech debt that this might cause.

I've edited OP to reflect this.

cc @danesfeder @devotaaabel

@Guardiola31337 Guardiola31337 removed needs discussion Can't be started in current state, needs clarification. ⚠️ DO NOT MERGE PR should not be merged! labels Oct 4, 2018
Copy link
Contributor

@danesfeder danesfeder left a comment

Choose a reason for hiding this comment

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

@Guardiola31337 this is looking good, but I was wondering, would it be a good idea to contain all of the client logic needed for setting up night mode in a public class that they may use? Just a thought, I think it would make developers' lives a lot easier if we included something like this that they could use in their Activity or Fragment

@@ -132,6 +132,7 @@ protected void onDestroy() {
navigationView.onDestroy();
if (isFinishing()) {
saveNightModeToPreferences(AppCompatDelegate.MODE_NIGHT_AUTO);
AppCompatDelegate.setDefaultNightMode(AppCompatDelegate.MODE_NIGHT_AUTO);
Copy link
Contributor

Choose a reason for hiding this comment

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

Does setting this before the Activity is destroyed still allow it to be considered on re-creation?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Yes it does. Mainly because this is "per app" and in the test app closing any activity redirects you to the MainActivity i.e. the night mode is kept if you reopen the Activity.

@Guardiola31337
Copy link
Contributor Author

@danesfeder

would it be a good idea to contain all of the client logic needed for setting up night mode in a public class that they may use? Just a thought, I think it would make developers' lives a lot easier if we included something like this that they could use in their Activity or Fragment

IMO If you're referring to extracting the AppCompatDelegate.setDefaultNightMode and the SharedPreferences related code, these are Android implementation details so I don't see a great benefit of exposing from our side. In any case, let me know what you'd include in that convenience class and we can discuss further.

@Guardiola31337
Copy link
Contributor Author

@danesfeder I followed up on all your comments / concerns / questions. Ready for another round 👀

Copy link
Contributor

@danesfeder danesfeder left a comment

Choose a reason for hiding this comment

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

@Guardiola31337 some minor cleanup / comments - this is looking good, thanks for addressing my questions.

@@ -214,6 +215,15 @@ public void userOffRoute(Location location) {

@Override
public void onProgressChange(Location location, RouteProgress routeProgress) {
boolean inTunnel = routeProgress.inTunnel();
Copy link
Contributor

Choose a reason for hiding this comment

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

This chunk of logic can be extracted into a private method. Maybe we can think of better naming for isInTunnel vs. inTunnel - it's a little confusing to determine which variable is coming from where.

@@ -44,6 +52,11 @@ public View onCreateView(@NonNull LayoutInflater inflater, @Nullable ViewGroup c
@Override
public void onViewCreated(@NonNull View view, @Nullable Bundle savedInstanceState) {
super.onViewCreated(view, savedInstanceState);
if (wasNavigationStopped()) {
Copy link
Contributor

Choose a reason for hiding this comment

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

For readability when the Fragment is being created, this can be extracted into a private method

@Override
public void onProgressChange(Location location, RouteProgress routeProgress) {
boolean isInTunnel = routeProgress.inTunnel();
boolean wasInTunnel = wasInTunnel();
Copy link
Contributor

Choose a reason for hiding this comment

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

I like the variable naming here - if possible, let's us the same naming in RerouteActivity

@Guardiola31337
Copy link
Contributor Author

@danesfeder this is updated and ready for another round 👀

Copy link
Contributor

@danesfeder danesfeder left a comment

Choose a reason for hiding this comment

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

@Guardiola31337 looks good, thanks for addressing the feedback

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants