Added support for nested fragments (ChildFragmentManager) #2482
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
✨ What kind of change does this PR introduce? (Bug fix, feature, docs update...)
Feature
Current behavior only supports FragmentManager and SupportFragmentManager on 1 nested level.
It also doesn't support nested fragments in PageViewer.
🆕 What is the new behavior (if this is a feature change)?
The new behavior adds support for nested fragments (multi level) (for now only MvxAppCompatPresenter supports it).
Adds correct tagging on MvxCachedFragmentPagerAdapter so that nested fragments can be supported in PageViewer.
💥 Does this PR introduce a breaking change?
Not yet (depends if we want to remove 2 of the PageAdapters into making only 2 available)
🐛 Recommendations for testing
📝 Links to relevant issues/docs
Problems with the Android API I am using (found this like 2 hours ago) :
https://stackoverflow.com/questions/6102007/is-there-a-way-to-get-references-for-all-currently-active-fragments-in-an-activi
When we look at the link above it seems that FragmentManager.Fragments is maybe not supposed to be used as its hidden (well its not really hidden in Xamarin). But I am concerned of future updates it might break the implementation. (if they end up making it private field). Also the non-AppCompat version we would need to use reflection to get the field with mActive as said per post. So I am not sure if this is a good solution.
🤔 Checklist before submitting
Didnt have time to do the below yet. I currently implemented it in my own project by just re-implementing the MvxCachedFragmentPagerAdapter and overwriting the MvxAppCompatPresenter. It works as far as I can see but to be added to MvvmCross it needs more work and maybe a different approach.