Skip to content
Merged
Changes from 2 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
using Android.App;
using Android.Views;
using Android.Widget;
using AndroidX.Core.View;
using CommunityToolkit.Maui.Core;
using CommunityToolkit.Maui.Core.Extensions;
Expand Down Expand Up @@ -95,7 +96,35 @@ public static void MapNavigationColorProperty(IPageHandler handler, IContentView

var color = GetColor(page).ToPlatform();

if (OperatingSystem.IsAndroidVersionAtLeast(23))
if (OperatingSystem.IsAndroidVersionAtLeast(35))
{
const string navigationBarOverlay = "NavigationBarOverlay";

Copilot AI Jan 30, 2026

Copy link

Choose a reason for hiding this comment

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

This line has trailing whitespace after the semicolon. Remove the trailing whitespace to maintain code cleanliness.

Suggested change

Copilot uses AI. Check for mistakes.
WindowCompat.SetDecorFitsSystemWindows(window, false);
Comment thread
TheCodeTraveler marked this conversation as resolved.

var decorGroup = (ViewGroup)window.DecorView;
var statusBarOverlay = decorGroup.FindViewWithTag(navigationBarOverlay);

if (statusBarOverlay is null)
{
var navigationBarHeight = activity.Resources?.GetIdentifier("navigation_bar_height", "dimen", "android") ?? 0;
var navigationBarPixelSize = navigationBarHeight > 0 ? activity.Resources?.GetDimensionPixelSize(navigationBarHeight) ?? 0 : 0;

statusBarOverlay = new(activity)
{
LayoutParameters = new FrameLayout.LayoutParams(Android.Views.ViewGroup.LayoutParams.MatchParent, navigationBarPixelSize + 3)

Copilot AI Jan 30, 2026

Copy link

Choose a reason for hiding this comment

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

The magic number + 3 added to the navigation bar height is unexplained. Consider extracting this to a named constant with a descriptive comment explaining why 3 extra pixels are needed. This would improve code maintainability and make the intent clear to future developers.

Copilot uses AI. Check for mistakes.
{
Gravity = GravityFlags.Bottom
}
};

Comment thread
TheCodeTraveler marked this conversation as resolved.
decorGroup.AddView(statusBarOverlay);
statusBarOverlay.SetZ(0);
}

statusBarOverlay.SetBackgroundColor(color);
Comment thread
TheCodeTraveler marked this conversation as resolved.
Outdated
}
else if (OperatingSystem.IsAndroidVersionAtLeast(23))
{
window.SetNavigationBarColor(color);
}
Comment on lines +99 to 131

Copilot AI Jan 30, 2026

Copy link

Choose a reason for hiding this comment

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

The NavigationBar implementation is missing window flag handling for transparent colors that StatusBar includes (StatusBar.android.cs:75-85). StatusBar sets different WindowManagerFlags based on whether the color is transparent:

  • For transparent: ClearFlags(DrawsSystemBarBackgrounds) and SetFlags(LayoutNoLimits)
  • For non-transparent: ClearFlags(LayoutNoLimits) and SetFlags(DrawsSystemBarBackgrounds)

Without this handling, transparent navigation bar colors may not render correctly. Consider adding similar logic to maintain consistency with StatusBar behavior and ensure proper transparent color support.

Copilot uses AI. Check for mistakes.
Expand Down
Loading