-
Notifications
You must be signed in to change notification settings - Fork 1.9k
[Android] Fixed inconsistant status bar color in Modal pages #32015
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
|
Hey there @@NirmalKumarYuvaraj! Thank you so much for your PR! Someone from the team will get assigned to your PR shortly and we'll get it reviewed. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Pull Request Overview
This pull request refactors Android system bar configuration for API 36+ devices by consolidating duplicated code into a reusable extension method. The change ensures consistent translucent system bar appearance across both main windows and modal pages while improving code maintainability.
Key changes:
- Created a centralized
ConfigureTranslucentSystemBarsextension method that handles theme-aware system bar icon/text color adjustments - Updated window handler and modal navigation manager to use the new extension method instead of duplicated inline code
Reviewed Changes
Copilot reviewed 3 out of 3 changed files in this pull request and generated 1 comment.
| File | Description |
|---|---|
| src/Core/src/Platform/Android/WindowExtensions.cs | Added new ConfigureTranslucentSystemBars extension method and AndroidX.Core.View import |
| src/Core/src/Handlers/Window/WindowHandler.Android.cs | Replaced local ConfigureTranslucentSystemBars method with call to new extension method |
| src/Controls/src/Core/Platform/ModalNavigationManager/ModalNavigationManager.Android.cs | Replaced hardcoded color settings with call to new extension method for API 36+ consistency |
| // Configure translucent system bars for modal pages on Android API 36+ | ||
| if (OperatingSystem.IsAndroidVersionAtLeast(36) && Context?.GetActivity() is global::Android.App.Activity activity) | ||
| { | ||
| var navigationBarColor = mainActivityWindow.NavigationBarColor; | ||
| var statusBarColor = mainActivityWindow.StatusBarColor; | ||
| #pragma warning disable CA1422 | ||
| dialog.Window.SetNavigationBarColor(new AColor(navigationBarColor)); | ||
| dialog.Window.SetStatusBarColor(new AColor(statusBarColor)); | ||
| #pragma warning restore CA1422 | ||
| dialog.Window.ConfigureTranslucentSystemBars(activity); |
Copilot
AI
Oct 16, 2025
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The new modal dialog system bar configuration logic for Android API 36+ lacks test coverage. Consider adding a UI test in src/Controls/tests/TestCases.HostApp/Issues/ that demonstrates a modal page with the correct status bar appearance, along with a corresponding test in src/Controls/tests/TestCases.Shared.Tests/Tests/Issues/ to validate the behavior.
|
/azp run |
|
Azure Pipelines successfully started running 3 pipeline(s). |
| { | ||
| // Automatically adjust icon/text colors based on app theme | ||
| var configuration = activity.Resources?.Configuration; | ||
| var isLightTheme = configuration != null && |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Here is defaulting to dark theme when configuration is unavailable. Should be the light theme?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@jsuarezruiz , Done
|
/backport to release/10.0.1xx |
|
Started backporting to release/10.0.1xx: https://github.com/dotnet/maui/actions/runs/18606040281 |
|
/azp run |
|
/backport to release/10.0.1xx |
|
Azure Pipelines successfully started running 3 pipeline(s). |
|
Started backporting to release/10.0.1xx: https://github.com/dotnet/maui/actions/runs/18719725107 |
|
/rebase |
|
@PureWeen backporting to "release/10.0.1xx" failed, the patch most likely resulted in conflicts: $ git am --3way --empty=keep --ignore-whitespace --keep-non-patch changes.patch
Patch format detection failed.
Error: The process '/usr/bin/git' failed with exit code 128Please backport manually! |
37485d6 to
a1d68a0
Compare
|
/backport to release/10.0.1xx |
|
Started backporting to release/10.0.1xx: https://github.com/dotnet/maui/actions/runs/18719912703 |
|
/azp run |
|
Azure Pipelines successfully started running 3 pipeline(s). |
|
/azp run |
|
Azure Pipelines successfully started running 3 pipeline(s). |
|
/rebase |
6d5c25b to
b9eb598
Compare
| @@ -1,4 +1,5 @@ | |||
| #if ANDROID | |||
| #if TEST_FAILS_ON_ANDROID // SetNavigationBarColor and SetStatusBarColor are deprecated APIs in Android 13 and above. We have enabled edge-to-edge by default, so these will not work after enabling edge-to-edge mode. | |||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@NirmalKumarYuvaraj whats the recommended way for users to set the statusbar color in net10?
|
/rebase |
b9eb598 to
9267f9a
Compare
|
/azp run MAUI-UITests-public |
|
Azure Pipelines successfully started running 1 pipeline(s). |
Note
Are you waiting for the changes in this PR to be merged?
It would be very helpful if you could test the resulting artifacts from this PR and let us know in a comment if this change resolves your issue. Thank you!
Description of Change
This pull request refactors how translucent system bars are configured for Android API 36+ devices, moving the related logic into a new extension method for better code organization and reuse. The main changes involve replacing duplicated system bar configuration code with a centralized method, improving maintainability and readability.
Android system bar configuration refactor:
ConfigureTranslucentSystemBarstoWindowExtensions.cs, encapsulating logic for setting system bar appearance and adapting icon/text colors to the app theme.WindowHandler.Android.csto use the newConfigureTranslucentSystemBarsmethod on the window object, removing the previous inline implementation.ModalNavigationManager.Android.csto call the new extension method for modal pages on Android API 36+ instead of manually setting navigation and status bar colors.Dependency and import updates:
AndroidX.Core.ViewinWindowExtensions.csto support the new extension method.Issues Fixed
Fixes #
Output
Before.mov
After.mov