diff options
author | Samantha Houts <samantha@teamredwall.com> | 2016-10-12 12:57:15 -0700 |
---|---|---|
committer | Jason Smith <jason.smith@xamarin.com> | 2016-10-12 12:57:15 -0700 |
commit | d16f3550dcacb92b36e8c7ec5d4547cd97d001bf (patch) | |
tree | b8fb966cb36955e0fd4b2a1e8db5c586b34969e2 /Xamarin.Forms.Platform.Android | |
parent | 739802143552ea1d28544bd05718bf4feeeb5bed (diff) | |
download | xamarin-forms-d16f3550dcacb92b36e8c7ec5d4547cd97d001bf.tar.gz xamarin-forms-d16f3550dcacb92b36e8c7ec5d4547cd97d001bf.tar.bz2 xamarin-forms-d16f3550dcacb92b36e8c7ec5d4547cd97d001bf.zip |
[Android App Compat] Can opt out of sending Appearing/Disappearing events on Resume/Pause (#450)
* Add reproduction for 40722
* [Core] Add Android AppCompat PS props ...
... to disable sending Disappearing/Appearing events on Pause/Resume
respectively.
* [Android] Allow user to disable Pause/Resume evts
* Revise repro to use new PS option
* Update docs
Diffstat (limited to 'Xamarin.Forms.Platform.Android')
-rw-r--r-- | Xamarin.Forms.Platform.Android/AppCompat/FragmentContainer.cs | 23 |
1 files changed, 16 insertions, 7 deletions
diff --git a/Xamarin.Forms.Platform.Android/AppCompat/FragmentContainer.cs b/Xamarin.Forms.Platform.Android/AppCompat/FragmentContainer.cs index 3931e207..432fcd39 100644 --- a/Xamarin.Forms.Platform.Android/AppCompat/FragmentContainer.cs +++ b/Xamarin.Forms.Platform.Android/AppCompat/FragmentContainer.cs @@ -2,6 +2,7 @@ using System; using Android.OS; using Android.Runtime; using Android.Views; +using Xamarin.Forms.PlatformConfiguration.AndroidSpecific.AppCompat; using AView = Android.Views.View; using Fragment = Android.Support.V4.App.Fragment; @@ -119,18 +120,26 @@ namespace Xamarin.Forms.Platform.Android.AppCompat public override void OnPause() { - Page currentPage = (Application.Current.MainPage as IPageContainer<Page>)?.CurrentPage; - if (currentPage == null || currentPage == PageController) - PageController?.SendDisappearing(); + var shouldSendEvent = Application.Current.OnThisPlatform().GetSendDisappearingEventOnPause(); + if (shouldSendEvent) + { + Page currentPage = (Application.Current.MainPage as IPageContainer<Page>)?.CurrentPage; + if (currentPage == null || currentPage == PageController) + PageController?.SendDisappearing(); + } base.OnPause(); } - + public override void OnResume() { - Page currentPage = (Application.Current.MainPage as IPageContainer<Page>)?.CurrentPage; - if (UserVisibleHint && (currentPage == null || currentPage == PageController)) - PageController?.SendAppearing(); + var shouldSendEvent = Application.Current.OnThisPlatform().GetSendAppearingEventOnResume(); + if (shouldSendEvent) + { + Page currentPage = (Application.Current.MainPage as IPageContainer<Page>)?.CurrentPage; + if (UserVisibleHint && (currentPage == null || currentPage == PageController)) + PageController?.SendAppearing(); + } base.OnResume(); } |