diff options
author | E.Z. Hart <hartez@users.noreply.github.com> | 2016-11-16 13:43:33 -0700 |
---|---|---|
committer | Jason Smith <jason.smith@xamarin.com> | 2016-11-16 12:43:33 -0800 |
commit | 243d9e0c6727a6610a6e1034775cf336ccfbf1e2 (patch) | |
tree | dbccaf860f341a76cbf8cff6a93708e1d1317aa0 | |
parent | 20adf7ec74c02f8522b12c14dbb1b5eec3a0dfee (diff) | |
download | xamarin-forms-243d9e0c6727a6610a6e1034775cf336ccfbf1e2.tar.gz xamarin-forms-243d9e0c6727a6610a6e1034775cf336ccfbf1e2.tar.bz2 xamarin-forms-243d9e0c6727a6610a6e1034775cf336ccfbf1e2.zip |
Make CommitAllowingStateLoss the default (#527)
-rw-r--r-- | Xamarin.Forms.Platform.Android/AppCompat/MasterDetailContainer.cs | 10 | ||||
-rw-r--r-- | Xamarin.Forms.Platform.Android/AppCompat/NavigationPageRenderer.cs | 5 |
2 files changed, 12 insertions, 3 deletions
diff --git a/Xamarin.Forms.Platform.Android/AppCompat/MasterDetailContainer.cs b/Xamarin.Forms.Platform.Android/AppCompat/MasterDetailContainer.cs index fad745aa..0265cd3d 100644 --- a/Xamarin.Forms.Platform.Android/AppCompat/MasterDetailContainer.cs +++ b/Xamarin.Forms.Platform.Android/AppCompat/MasterDetailContainer.cs @@ -71,7 +71,10 @@ namespace Xamarin.Forms.Platform.Android.AppCompat transaction.DisallowAddToBackStack(); transaction.Remove(_currentFragment); transaction.SetTransition((int)FragmentTransit.None); - transaction.Commit(); + + // This is a removal of a fragment that's not going on the back stack; there's no reason to care + // whether its state gets successfully saved, since we'll never restore it. Ergo, CommitAllowingStateLoss + transaction.CommitAllowingStateLoss(); _currentFragment = null; } @@ -102,7 +105,10 @@ namespace Xamarin.Forms.Platform.Android.AppCompat transaction.Add(Id, fragment); transaction.SetTransition((int)FragmentTransit.None); - transaction.Commit(); + + // We don't currently support fragment restoration + // So we don't need to worry about loss of this fragment's state + transaction.CommitAllowingStateLoss(); _currentFragment = fragment; diff --git a/Xamarin.Forms.Platform.Android/AppCompat/NavigationPageRenderer.cs b/Xamarin.Forms.Platform.Android/AppCompat/NavigationPageRenderer.cs index dc3c5666..0b7ed763 100644 --- a/Xamarin.Forms.Platform.Android/AppCompat/NavigationPageRenderer.cs +++ b/Xamarin.Forms.Platform.Android/AppCompat/NavigationPageRenderer.cs @@ -627,7 +627,10 @@ namespace Xamarin.Forms.Platform.Android.AppCompat fragments.Add(fragment); } } - transaction.Commit(); + + // We don't currently support fragment restoration, so we don't need to worry about + // whether the commit loses state + transaction.CommitAllowingStateLoss(); // The fragment transitions don't really SUPPORT telling you when they end // There are some hacks you can do, but they actually are worse than just doing this: |