fix(android): Corrected TabView fragment manager resolution#11228
fix(android): Corrected TabView fragment manager resolution#11228CatchABus wants to merge 5 commits into
Conversation
|
View your CI Pipeline Execution ↗ for commit 99443e9
☁️ Nx Cloud last updated this comment at |
farfromrefug
left a comment
There was a problem hiding this comment.
Seems good. Juste one question. You say you always add the fragment to the adapter fragment manager while the material.plugin does not. Couldn't the material plugin do the same ?
My comment is a bit misleading and that's not what I wanted to say. Material plugin uses ViewPager2 with a modern fragment state adapter which makes use of activity fragment manager internally https://android.googlesource.com/platform/frameworks/support/+/refs/heads/androidx-master-dev/viewpager2/viewpager2/src/main/java/androidx/viewpager2/adapter/FragmentStateAdapter.java#111. |
PR Checklist
What is the current behavior?
This is the second attempt after #11217.
Apparently, entering tab item
loadedlifecycle during adapterattachis too early and tab frame fragments don't get enough time to be added to the correct fragment manager.What is the new behavior?
This PR takes a few things from ui-material tabs plugin:
loadedlifecycle is called at the right time (see line, commit)It seems we don't really need the material plugin approach for retrieving child fragment manager since adapter always adds/attaches fragments to
tabView._getFragmentManager(), so this PR uses the fragment tag to resolve the tab fragment directly and consequently the child fragment manager here.Fixes #10165.