diff --git a/src/Controls/src/Core/Platform/AlertManager/AlertManager.Android.cs b/src/Controls/src/Core/Platform/AlertManager/AlertManager.Android.cs index f04234b87f71..3a843b1fafd7 100644 --- a/src/Controls/src/Core/Platform/AlertManager/AlertManager.Android.cs +++ b/src/Controls/src/Core/Platform/AlertManager/AlertManager.Android.cs @@ -97,7 +97,7 @@ public void ResetBusyCount() void OnPageBusy(IView sender, bool enabled) { // Verify that the page making the request is part of this activity - if (!PageIsInThisContext(sender)) + if (!PageIsInThisContext(sender) && enabled) { return; } diff --git a/src/Controls/tests/TestCases.HostApp/Issues/Issue23674.xaml.cs b/src/Controls/tests/TestCases.HostApp/Issues/Issue23674.xaml.cs new file mode 100644 index 000000000000..d0f6ab5a9fe2 --- /dev/null +++ b/src/Controls/tests/TestCases.HostApp/Issues/Issue23674.xaml.cs @@ -0,0 +1,47 @@ +namespace Maui.Controls.Sample.Issues +{ + [XamlCompilation(XamlCompilationOptions.Compile)] + [Issue(IssueTracker.Github, 23674, "Page.IsBusy activity indicators gets stuck/causes multiple to be displayed", PlatformAffected.Android)] + public class Issue23674 : NavigationPage + { + public Issue23674() : base(new Issue23674Page1()){ } + + class Issue23674Page1 : ContentPage + { + public Issue23674Page1() + { + Content = new Button() + { + AutomationId = "button1", + VerticalOptions = LayoutOptions.Start, + Text = "Navigate to page 1", + HeightRequest = 100, + Command = new Command(async ()=> + { + await Navigation.PushAsync(new Issue23674Page2()); + }) + }; + } + } + + class Issue23674Page2 : ContentPage + { + public Issue23674Page2() + { + IsBusy = true; + Content = new Button() + { + AutomationId = "button2", + VerticalOptions = LayoutOptions.Start, + Text = "Navigate to page 2", + HeightRequest = 100, + Command = new Command(() => + { + Navigation.PopAsync(); + }) + }; + IsBusy = true; + } + } + } +} \ No newline at end of file diff --git a/src/Controls/tests/TestCases.Shared.Tests/Tests/Issues/Issue23674.cs b/src/Controls/tests/TestCases.Shared.Tests/Tests/Issues/Issue23674.cs new file mode 100644 index 000000000000..ec9584ced97d --- /dev/null +++ b/src/Controls/tests/TestCases.Shared.Tests/Tests/Issues/Issue23674.cs @@ -0,0 +1,27 @@ +using NUnit.Framework; +using UITest.Appium; +using UITest.Core; + +namespace Microsoft.Maui.TestCases.Tests.Issues +{ + public class Issue23674 : _IssuesUITest + { + public override string Issue => "Page.IsBusy activity indicators gets stuck/causes multiple to be displayed"; + + public Issue23674(TestDevice device) : base(device) { } + + [Test] + [Category(UITestCategories.Page)] + public void Issue23674Test() + { + App.WaitForElement("button1"); + App.Click("button1"); + App.WaitForElement("button2"); + App.Click("button2"); + App.WaitForElement("button1"); + + // The test passes if activity indicator is not visible + VerifyScreenshot(); + } + } +}