summaryrefslogtreecommitdiff
path: root/Xamarin.Forms.Platform.Android
diff options
context:
space:
mode:
authorSamantha Houts <samantha@teamredwall.com>2016-10-12 19:57:15 (GMT)
committerJason Smith <jason.smith@xamarin.com>2016-10-12 19:57:15 (GMT)
commitd16f3550dcacb92b36e8c7ec5d4547cd97d001bf (patch)
treeb8fb966cb36955e0fd4b2a1e8db5c586b34969e2 /Xamarin.Forms.Platform.Android
parent739802143552ea1d28544bd05718bf4feeeb5bed (diff)
downloadxamarin-forms-d16f3550dcacb92b36e8c7ec5d4547cd97d001bf.zip
xamarin-forms-d16f3550dcacb92b36e8c7ec5d4547cd97d001bf.tar.gz
xamarin-forms-d16f3550dcacb92b36e8c7ec5d4547cd97d001bf.tar.bz2
[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.cs23
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 3931e20..432fcd3 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();
}