Improve MvxCachedFragmentInfo flexibility and fix caching bugs #86
Conversation
- Renamed FragmentInfo to MvxCachedFragmentInfo - Added interface for MvxCachedFragmentInfo - Extrated to separate files
… enable child classes to create their own configurations
… we were creating a new one.
…t that is being shown to the user, when pushed and when popped from the backstack.
…xibility without performance hits
…tantiation so inheritors can further setup the fragment, for instance, with transitions. Furthermore, this can be used in conjunction with a custom `MvxCachedFragmentInfo` to improve performance of this type of setups, reducing unnecessary lookups
- New features: Activity will change the hamburguer menu state based on the current fragment being displayed; Activity will inflate transitions for fragments configured with them
…...)` parameter to allow this functionality to be forced
I did some testing now. There where 2 cases where i could get this to crash in the sample app:
Crash log:
And this:
Could you look into this? |
I caught that error also but wanted to talk to you first, before this change the view would bug the tabs when you did the same, my first google hit pointed out a possible bug in the way the Examples page is doing the child fragments thus, it might be related, check this: http://stackoverflow.com/a/7481468 I'll see if this is happening in other scenarios. |
The real problem is in #85, the way we're bringing caching fragments back. This wasn't a problem before because we were always creating new ones, that |
We use the latest Support libraries and use child fragment manager in the sample, so i think that is not a problem. |
…rent + backstack frags aren't correctly tracked
…ity, all the bugs should be squashed. This will need an improvement in MvxFragmentExtensions, going in a separate commit
… cached instances. This implementation should be improved when the functionality is accepted in MvvmCross main lib.
…would stop animating transitions after some fragment changes.
…edFragmentInfo for clearance.
…idSupport Conflicts: Cirrious.MvvmCross.Droid.Support.AppCompat/MvxCachingFragmentCompatActivity.cs Cirrious.MvvmCross.Droid.Support.Fragging/MvxCachingFragmentActivity.cs Samples/Example.Droid/Activities/MainActivity.cs Samples/Example.Droid/Example.Droid.csproj Samples/Example.Droid/Resources/Resource.designer.cs
…ateException if there was a previous instance of a Bundle already set.
I've tested this a bit. When i enable add to backstack, for example on the homefragment, then pressing back takes me back to a white screen, but the menu still works. What i would expect is that after the last fragment is removed from the screen, the app navigates back to the login activity. |
Root fragments should not be added to the backstack or that will happen.
Álison Fernandes |
Improve MvxCachedFragmentInfo flexibility and fix caching bugs
All of the small changes where made with the final objective of providing more flexibility to inheritors. Furthermore, already includes #85.
Improvements
MvxCachedFragmentInfo
by implementing theIMvxCachedFragmentInfo
and overridingMvxCachingFragmentActivity.CreateFragmentInfo(...)
. Sample used this for Transitions and to know if the fragment is one of the drawer root fragmentsOnFragmentCreated(...)
enables you to do one time fragment setups. This was used in the sample to inflate transitions.OnFragmentChanged
provides a callback so you can know when there was a change in fragments and which fragment is being presented. This is the only callback thats being called when you present a new fragment and when you go back to a previous one. Sample used this to check if the current fragment being showed is root, if so, it enables the user to interact with the menu.IMvxCachedFragmentInfo
Compat
version, the one being used in the sampleQuestions
OnFragmentChanged
needs to be called before theFragmentTransaction.Add(...)
?OnBackPressed
there's multiple fragments being displayed? (for instance, phone vs tablet usecase) Show we be sending a list of tags or list ofIMvxCachedFragmentInfo
?