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

Remove NavigationViewModel as lifecycle observer #643

Merged
merged 2 commits into from
Jan 11, 2018

Conversation

danesfeder
Copy link
Contributor

Closes #623

When using a Fragment implementation of NavigationView the NavigationViewModel will still use the Activity Context when adding NavigationViewModel as a lifecycle observer.

This means that the view model isn't properly shutdown if the Fragment is hidden and not destroyed (and the Activity is still running).

This PR removes the NavigationViewModel as a LifecycleObserver and moves the lifecycle method onDestroy to NavigationView#onDestroy, allowing the developer to call this whenever they chose (like Fragment#onDestroyView).

@danesfeder danesfeder merged commit 474b7b2 into master Jan 11, 2018
@danesfeder danesfeder deleted the dan-nav-vm-ondestroy branch January 11, 2018 19:58
@danesfeder danesfeder mentioned this pull request Jan 23, 2018
14 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.

None yet

2 participants