-
Notifications
You must be signed in to change notification settings - Fork 1.9k
[Android] Top bar item colors - fix #26964
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
[Android] Top bar item colors - fix #26964
Conversation
90bf31b to
3831a77
Compare
|
/azp run |
|
Azure Pipelines successfully started running 3 pipeline(s). |
|
@kubaflo, I believe removing SetIconColorFilter is not appropriate, as it could cause issues in certain scenarios involving FontImageSource color. Recently, I fixed the FontImageSource color issue on the TabbedPage icon. The PR can be found here: [iOS] [Android] Fix for the FontImageSource color is not applied properly to the Tab Icon by Tamilarasan-Paranthaman · Pull Request #26757 · dotnet/maui For instance, if there are two ContentPage instances as children of a TabbedPage, setting SelectedTabColor to red while applying different FontImageSource colors to each page may not work as expected. The SetIconColorFilter method handles the Icon.InvalidateSelf call, ensuring that the icon is updated correctly. |
|
Hi @Tamilarasan-Paranthaman this pr actually fixes the issue in your PR. And there's no need for Screen.Recording.2025-01-06.at.18.09.05.mov |
|
Azure Pipelines successfully started running 3 pipeline(s). |
|
Can we make sure adding a menu item and disable and enable it with have the correct colors? |
@kubaflo, can you please fully utilize my test sample? I have added the SelectedTabColor and UnSelectedTabColor, but no FontImageSource color is specified for the first page. Only the second and third pages have the FontImageSource color defined. With your fix, the FontImageSource color is not applied to the second and third pages. I have handled the FontImageSource color for different scenarios by using combinations of SelectedTabColor, UnSelectedTabColor, and the FontImageSource color in my PR. It works properly. |
|
/azp run |
|
Azure Pipelines successfully started running 3 pipeline(s). |
fe7c67e to
95d99c6
Compare
|
/azp run |
|
Azure Pipelines successfully started running 3 pipeline(s). |
|
/rebase |
95d99c6 to
8fc9053
Compare
|
/azp run |
|
Azure Pipelines successfully started running 3 pipeline(s). |
8fc9053 to
6534efc
Compare
PureWeen
left a comment
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.
|
@PureWeen @Tamilarasan-Paranthaman The fix specifically targets IconImageSource, as the issue affects only this type of ImageSource. While FontImageSource might also have similar problems, addressing it would likely require a separate solution. |
|
@IX-OmkarP can you try the resulting NuGets from this PR so see if this resolves your issue? See the instructions at the very top in the first post of this PR. |
|
Azure Pipelines successfully started running 3 pipeline(s). |
6534efc to
9ee6e78
Compare
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 PR fixes an issue with tab icon coloring on Android where the tab layout's global icon tint was interfering with FontImageSource icons that already have their own color applied. The fix ensures that the global tint is only applied when the icon is not a FontImageSource.
- Adds conditional logic to prevent applying global tab icon tint to FontImageSource icons
- Preserves existing tint behavior for other icon types
Prevents applying TabIconTint when the tab icon is a FontImageSource, as it manages its own color. This ensures correct icon coloring for font-based icons in TabbedPageManager.
9ee6e78 to
a083c3e
Compare
@jfversluis Thanks for the ping! I will try the NuGets from this PR and report back. I am a bit short on bandwidth right now, so I may need a few days before I can test and update you. |
|
Azure Pipelines successfully started running 3 pipeline(s). |
|
@jfversluis @kubaflo Thank you it is working |
* [Android] Top bar item colors - fix * Avoid tab icon tint for FontImageSource on Android Prevents applying TabIconTint when the tab icon is a FontImageSource, as it manages its own color. This ensures correct icon coloring for font-based icons in TabbedPageManager.
* [Android] Top bar item colors - fix * Avoid tab icon tint for FontImageSource on Android Prevents applying TabIconTint when the tab icon is a FontImageSource, as it manages its own color. This ensures correct icon coloring for font-based icons in TabbedPageManager.
* [Android] Top bar item colors - fix * Avoid tab icon tint for FontImageSource on Android Prevents applying TabIconTint when the tab icon is a FontImageSource, as it manages its own color. This ensures correct icon coloring for font-based icons in TabbedPageManager.
* [Android] Top bar item colors - fix * Avoid tab icon tint for FontImageSource on Android Prevents applying TabIconTint when the tab icon is a FontImageSource, as it manages its own color. This ensures correct icon coloring for font-based icons in TabbedPageManager.

Description
Android docs: https://developer.android.com/reference/com/google/android/material/tabs/TabLayout#setTabIconTint(android.content.res.ColorStateList)
Issues Fixed
Fixes #26905
Screen.Recording.2025-01-05.at.19.53.17.mov
Screen.Recording.2025-01-05.at.19.54.38.mov
@jsuarezruiz what do you think?