Hi Xamarin/MvvmCross devs,
I assume any of the Android MvvmCross devs have at some point dealt with what I’m struggling to do since yesterday. I’m dealing with this backstack problem
All I want to do is ALWAYS, and I literally mean ALWAYS skip a certain view on back pressed. I know it sounds pretty simple (and I hope it is) because I’ve been struggling with this quite a bit. Since the AddToBackstack behaviour “doesn’t work” as I expect it to I don’t understand it properly. Because of that I’ve overridden OnBackPressed in my container view and had done numerous checks, all which fail at some point.
My current "solution" is: I get the top fragment, then I find its position in the SupportFragmentManager.Fragments (using IndexOf(topFragment)), go down the stack to check if the next “Real Fragment” is the Fragment I want to skip. I say real fragment because there are null fragment entries as well as SupportRequestManagerFragment entries which cause some havok of its own.
That worked fine until I realized that sometimes the order of SupportFragmentManager.Fragments is not correct. When using the same view twice and having the SupportRequestManagerFragment on there it places the fragment in a weird position, so my solution became obsolete because the view I wanted to skip appears above the view that's currently on screen in the fragment stack.
Any help would be appreciated. Any pointers on the fragment backstack, maybe a more reliable way to see the order of the fragments without the nulls and the SupportRequestManagerFragment from glide on there.
Thank you