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

Refactor of language change listener #52

Merged
merged 4 commits into from
Aug 20, 2016
Merged

Refactor of language change listener #52

merged 4 commits into from
Aug 20, 2016

Conversation

PaulRashidi
Copy link
Contributor

No description provided.

void onChanged(@NonNull Language newLangauge) {
Intent intent = getIntent();
finish();
startActivity(intent);
Copy link
Contributor Author

@PaulRashidi PaulRashidi Aug 20, 2016

Choose a reason for hiding this comment

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

This change is what makes the screen stop flickering. Instead of restarting the same activity and causing a re-render the code gracefully finishing then starts a new instance of the activity.

Copy link
Contributor

Choose a reason for hiding this comment

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

interesting, so my understanding was that finish() leads to onDestroy(), which may be cleaning up state that was created in onCreate(). and then startActivity() runs onStart(), but not necessarily onCreate(), which seems like it would be a problem, but i guess that finish() + startActivity() results in onCreate() being called? idk.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

finish() eventually leads to onDestroy(). I'm starting a new instance of the same activity and relying on the normal activity transitions to provide a nicer UX than before. Instead, I could have notified the adapter of the changes, but since the selection of a new language is effectively an Android Config change I wanted the whole activity (incl NavBar) to re-pull resources.

@aaronj1335
Copy link
Contributor

:shipit: i'll go ahead and merge.

@aaronj1335 aaronj1335 merged commit 502be10 into g11x:master Aug 20, 2016
aaronj1335 added a commit that referenced this pull request Aug 20, 2016
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