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
Fragments leaking on orientation change #681
Comments
This patch greatly improves tablet orientation change by making a few fixes - first, it stops the ViewPager from restoring its page number when the pages are different between portrait and landscape. Second, it stops calling setCurrentItem more than once. See #681 for further discussion.
this really needs a blog post, but the tldr is that:
the fix implemented here is two fold:
the future intended fix is likely:
an alternative to 2 above is to instead signal to the adapter that we're restoring instance state, at which point the adapter can either return lightweight |
This patch introduces a "mode" that is passed to FragmentStatePagerAdapter, which determines whether we are in single or dual page mode. When switching from one to the other, remove all the fragments from FragmentManager since there is no reason to cache them. Fixes #681.
This patch greatly improves tablet orientation change by making a few fixes - first, it stops the ViewPager from restoring its page number when the pages are different between portrait and landscape. Second, it stops calling setCurrentItem more than once. See #681 for further discussion.
this only happens on tablets with tablet mode.
start a tablet in portrait, then switch to landscape (with the setting to see 2 pages side by side enabled). do a heap dump and look for instances of
HighlightingImageView
- while you'd expect to only find 6 (2 per page, andViewPager
keeps 3 pages), we instead find 9, 3 of which are from portrait orientation.The text was updated successfully, but these errors were encountered: