Skip to content

Conversation

@NirmalKumarYuvaraj
Copy link
Contributor

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:

  • Added a new extension method ConfigureTranslucentSystemBars to WindowExtensions.cs, encapsulating logic for setting system bar appearance and adapting icon/text colors to the app theme.
  • Updated WindowHandler.Android.cs to use the new ConfigureTranslucentSystemBars method on the window object, removing the previous inline implementation.
  • Modified ModalNavigationManager.Android.cs to 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:

  • Added a missing import for AndroidX.Core.View in WindowExtensions.cs to support the new extension method.

Issues Fixed

Fixes #

Output

Before After
Before.mov
After.mov

@dotnet-policy-service dotnet-policy-service bot added the community ✨ Community Contribution label Oct 16, 2025
@dotnet-policy-service
Copy link
Contributor

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.

@dotnet-policy-service dotnet-policy-service bot added the partner/syncfusion Issues / PR's with Syncfusion collaboration label Oct 16, 2025
@NirmalKumarYuvaraj NirmalKumarYuvaraj marked this pull request as ready for review October 16, 2025 06:05
Copilot AI review requested due to automatic review settings October 16, 2025 06:05
Copy link
Contributor

Copilot AI left a 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 ConfigureTranslucentSystemBars extension 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

Comment on lines 243 to 246
// 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);
Copy link

Copilot AI Oct 16, 2025

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.

Copilot uses AI. Check for mistakes.
@jsuarezruiz
Copy link
Contributor

/azp run

@azure-pipelines
Copy link

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 &&
Copy link
Contributor

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?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@jsuarezruiz , Done

@PureWeen PureWeen added this to the .NET 10.0 GA milestone Oct 16, 2025
@PureWeen PureWeen moved this from Todo to Changes Requested in MAUI SDK Ongoing Oct 16, 2025
@PureWeen
Copy link
Member

/backport to release/10.0.1xx

@github-actions
Copy link
Contributor

Started backporting to release/10.0.1xx: https://github.com/dotnet/maui/actions/runs/18606040281

@PureWeen
Copy link
Member

/azp run

@PureWeen
Copy link
Member

/backport to release/10.0.1xx

@azure-pipelines
Copy link

Azure Pipelines successfully started running 3 pipeline(s).

@github-actions
Copy link
Contributor

Started backporting to release/10.0.1xx: https://github.com/dotnet/maui/actions/runs/18719725107

@PureWeen
Copy link
Member

/rebase

@github-actions
Copy link
Contributor

@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 128

Please backport manually!

@github-actions github-actions bot force-pushed the fix-statusBar_color branch from 37485d6 to a1d68a0 Compare October 22, 2025 14:37
@PureWeen
Copy link
Member

/backport to release/10.0.1xx

@github-actions
Copy link
Contributor

Started backporting to release/10.0.1xx: https://github.com/dotnet/maui/actions/runs/18719912703

@PureWeen
Copy link
Member

/azp run

@azure-pipelines
Copy link

Azure Pipelines successfully started running 3 pipeline(s).

@jsuarezruiz
Copy link
Contributor

/azp run

@azure-pipelines
Copy link

Azure Pipelines successfully started running 3 pipeline(s).

@rmarinho rmarinho modified the milestones: .NET 10.0 GA, .NET 10 SR1 Oct 28, 2025
@PureWeen PureWeen changed the base branch from net10.0 to main October 29, 2025 12:07
@PureWeen
Copy link
Member

/rebase

@github-actions github-actions bot force-pushed the fix-statusBar_color branch from 6d5c25b to b9eb598 Compare October 29, 2025 12:09
@@ -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.
Copy link
Member

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?

@PureWeen PureWeen added the p/0 Current heighest priority issues that we are targeting for a release. label Nov 4, 2025
@PureWeen
Copy link
Member

PureWeen commented Nov 5, 2025

/rebase

@github-actions github-actions bot force-pushed the fix-statusBar_color branch from b9eb598 to 9267f9a Compare November 5, 2025 17:02
@PureWeen
Copy link
Member

PureWeen commented Nov 5, 2025

/azp run MAUI-UITests-public

@azure-pipelines
Copy link

Azure Pipelines successfully started running 1 pipeline(s).

@PureWeen PureWeen dismissed jsuarezruiz’s stale review November 5, 2025 19:52

Changes Addressed

@github-project-automation github-project-automation bot moved this from Changes Requested to Approved in MAUI SDK Ongoing Nov 5, 2025
@PureWeen PureWeen merged commit 8af6166 into dotnet:main Nov 6, 2025
163 checks passed
@github-project-automation github-project-automation bot moved this from Approved to Done in MAUI SDK Ongoing Nov 6, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

area-controls-modal community ✨ Community Contribution p/0 Current heighest priority issues that we are targeting for a release. partner/syncfusion Issues / PR's with Syncfusion collaboration platform/android

Projects

Status: Done

Development

Successfully merging this pull request may close these issues.

4 participants