summaryrefslogtreecommitdiff
path: root/Xamarin.Forms.Controls.Issues
diff options
context:
space:
mode:
authorSamantha Houts <samantha@teamredwall.com>2016-10-12 12:57:15 -0700
committerJason Smith <jason.smith@xamarin.com>2016-10-12 12:57:15 -0700
commitd16f3550dcacb92b36e8c7ec5d4547cd97d001bf (patch)
treeb8fb966cb36955e0fd4b2a1e8db5c586b34969e2 /Xamarin.Forms.Controls.Issues
parent739802143552ea1d28544bd05718bf4feeeb5bed (diff)
downloadxamarin-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.Controls.Issues')
-rw-r--r--Xamarin.Forms.Controls.Issues/Xamarin.Forms.Controls.Issues.Shared/Bugzilla40722.cs68
-rw-r--r--Xamarin.Forms.Controls.Issues/Xamarin.Forms.Controls.Issues.Shared/Xamarin.Forms.Controls.Issues.Shared.projitems1
2 files changed, 69 insertions, 0 deletions
diff --git a/Xamarin.Forms.Controls.Issues/Xamarin.Forms.Controls.Issues.Shared/Bugzilla40722.cs b/Xamarin.Forms.Controls.Issues/Xamarin.Forms.Controls.Issues.Shared/Bugzilla40722.cs
new file mode 100644
index 00000000..1ce0482f
--- /dev/null
+++ b/Xamarin.Forms.Controls.Issues/Xamarin.Forms.Controls.Issues.Shared/Bugzilla40722.cs
@@ -0,0 +1,68 @@
+using Xamarin.Forms.CustomAttributes;
+using Xamarin.Forms.Internals;
+using Xamarin.Forms.PlatformConfiguration;
+using Xamarin.Forms.PlatformConfiguration.AndroidSpecific.AppCompat;
+
+namespace Xamarin.Forms.Controls
+{
+ [Preserve(AllMembers = true)]
+ [Issue(IssueTracker.Bugzilla, 40722, "Using FormsAppCompatActivity calls OnDisappearing on device sleep")]
+ public class Bugzilla40722 : TestContentPage
+ {
+ const string ButtonText_Disable = "Disable Pause/Resume events";
+ const string ButtonText_Enable = "Enable Pause/Resume events";
+ const string Instructions_Disabled = "Sleep the device, then wake it. If \"Disappearing!\" and/or \"Appearing!\" is displayed on this screen, this test has failed.";
+ const string Instructions_Enabled = "Sleep the device, then wake it. If \"Disappearing!\" and/or \"Appearing!\" is NOT displayed on this screen, this test has failed.";
+
+ Label _Target = new Label();
+ bool _sendEvents = true;
+
+ protected override void Init()
+ {
+ ToggleEvents(_sendEvents);
+
+ var instructions = new Label
+ {
+ Text = Instructions_Enabled
+ };
+
+ var button = new Button
+ {
+ Text = ButtonText_Disable
+ };
+
+ button.Clicked += (sender, e) =>
+ {
+ _sendEvents = !_sendEvents;
+ ToggleEvents(_sendEvents);
+ button.Text = _sendEvents ? ButtonText_Disable : ButtonText_Enable;
+ instructions.Text = _sendEvents ? Instructions_Enabled : Instructions_Disabled;
+ _Target.Text = "";
+ };
+
+ Content = new StackLayout { Children = { instructions, button, _Target } };
+ }
+
+
+ protected override void OnAppearing()
+ {
+ base.OnAppearing();
+
+ _Target.Text += "\r\nAppearing!";
+ }
+
+ protected override void OnDisappearing()
+ {
+ base.OnDisappearing();
+
+ _Target.Text += "\r\nDisappearing!";
+ }
+
+ void ToggleEvents(bool value)
+ {
+ Application.Current.On<Android>()
+ .SendDisappearingEventOnPause(value)
+ .SendAppearingEventOnResume(value);
+ }
+ }
+} \ No newline at end of file
diff --git a/Xamarin.Forms.Controls.Issues/Xamarin.Forms.Controls.Issues.Shared/Xamarin.Forms.Controls.Issues.Shared.projitems b/Xamarin.Forms.Controls.Issues/Xamarin.Forms.Controls.Issues.Shared/Xamarin.Forms.Controls.Issues.Shared.projitems
index 5e9e9034..224ef47a 100644
--- a/Xamarin.Forms.Controls.Issues/Xamarin.Forms.Controls.Issues.Shared/Xamarin.Forms.Controls.Issues.Shared.projitems
+++ b/Xamarin.Forms.Controls.Issues/Xamarin.Forms.Controls.Issues.Shared/Xamarin.Forms.Controls.Issues.Shared.projitems
@@ -189,6 +189,7 @@
<Compile Include="$(MSBuildThisFileDirectory)Bugzilla43161.cs" />
<Compile Include="$(MSBuildThisFileDirectory)Bugzilla39768.cs" />
<Compile Include="$(MSBuildThisFileDirectory)Bugzilla41271.cs" />
+ <Compile Include="$(MSBuildThisFileDirectory)Bugzilla40722.cs" />
<Compile Include="$(MSBuildThisFileDirectory)Bugzilla41153.cs" />
<Compile Include="$(MSBuildThisFileDirectory)Bugzilla44129.cs" />
<Compile Include="$(MSBuildThisFileDirectory)_Template.cs" />