-
Notifications
You must be signed in to change notification settings - Fork 2k
[Android] Make system chrome follow MAUI bar colors (opt-in) #35463
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
Changes from all commits
20f9b4a
e152174
ca6479e
1f85509
b2c7210
50261eb
4793a80
1fc672d
635e61c
4944018
b600feb
8c419e6
11aa96a
9351a7b
070663b
e3c0ce3
4477208
2c3f74b
2ee848d
1ef63ce
731d010
d9030c9
7e8108a
efb5346
607caf7
09a533c
ed2c187
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -42,6 +42,9 @@ protected virtual void SetColors(TabLayout tabLayout, Color foreground, Color ba | |
| tabLayout.SetTabTextColors(unselectedArgb, titleArgb); | ||
| tabLayout.SetBackground(new ColorDrawable(background.ToPlatform(ShellRenderer.DefaultBackgroundColor))); | ||
| tabLayout.SetSelectedTabIndicatorColor(foreground.ToPlatform(ShellRenderer.DefaultForegroundColor)); | ||
| AndroidSystemChrome.UpdateTopChrome( | ||
|
Collaborator
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
[major] Native Defaults Preservation / default background semantics — When Shell top tabs use default colors (no explicit |
||
| tabLayout, | ||
| new SolidColorBrush(background ?? ShellRenderer.DefaultBackgroundColor)); | ||
| } | ||
|
|
||
| #region IDisposable | ||
|
|
@@ -62,4 +65,4 @@ protected virtual void Dispose(bool disposing) | |
|
|
||
| #endregion IDisposable | ||
| } | ||
| } | ||
| } | ||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -55,6 +55,9 @@ protected virtual void SetColors(AToolbar toolbar, IShellToolbarTracker toolbarT | |
| shellToolbar.BarTextColor = title ?? ShellRenderer.DefaultTitleColor; | ||
| shellToolbar.BarBackground = background ?? new SolidColorBrush(ShellRenderer.DefaultBackgroundColor); | ||
| shellToolbar.IconColor = foreground ?? ShellRenderer.DefaultForegroundColor; | ||
| AndroidSystemChrome.UpdateTopChrome( | ||
|
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
It's functionally fine today because both compute the same color, but it's fragile if the two ever diverge (e.g. different default handling). Consider driving the shared system-bar chrome once at the owning layer rather than independently from each tracker. Flagged by: 2/3 reviewers
Collaborator
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
❌ Shell default colors pass |
||
| toolbar, | ||
| background is null ? null : shellToolbar.BarBackground); | ||
|
Collaborator
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
[major] Navigation & Shell — When Shell uses default colors, the visible toolbar is set to |
||
| } | ||
|
|
||
| [Obsolete("Use SetColors(AToolbar, IShellToolbarTracker, Color, Brush, Color) instead.")] | ||
|
|
@@ -85,4 +88,4 @@ protected virtual void Dispose(bool disposing) | |
|
|
||
| #endregion IDisposable | ||
| } | ||
| } | ||
| } | ||
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.
[major] Native Defaults Preservation / default background semantics — When Shell bottom tabs use default colors (
controller.EffectiveTabBarBackgroundColoris null, the common case),SetBackgroundColorpaints the visibleBottomNavigationViewwithShellRenderer.DefaultBottomNavigationViewBackgroundColor(lines 88-91), but this call passesnulltoAndroidSystemChrome.UpdateBottomChrome, which restores the native/theme navigation-bar color instead of matching the visible default bottom-tab color.ResetAppearance(lines 41-47) has the identical issue:SetBackgroundColor(bottomView, null)makes the bar showDefaultBottomNavigationViewBackgroundColor, yetAndroidSystemChrome.UpdateBottomChrome(bottomView, null)never picks up that default. This is the same class of bug already flagged onShellToolbarAppearanceTracker.cs(explicitly called out there as also needed for bottom tabs) but is unaddressed here, and there is no device test covering default (unstyled) Shell bottom-tab colors against the system navigation bar.