-
Notifications
You must be signed in to change notification settings - Fork 1.9k
Refactor SearchView color application logic #32187
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
base: main
Are you sure you want to change the base?
Changes from all commits
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,12 +42,10 @@ public static void UpdatePlaceholderColor(this SearchView searchView, ISearchBar | |
| else if (TryGetDefaultStateColor(searchView, AAttribute.TextColorHint, out var color)) | ||
| { | ||
| editText.SetHintTextColor(color); | ||
|
|
||
| var searchMagIconImage = searchView.FindViewById<ImageView>(Resource.Id.search_mag_icon); | ||
| searchMagIconImage?.Drawable?.SetTint(color); | ||
| ApplyDecorColor(searchView, color); | ||
| } | ||
| } | ||
|
|
||
| internal static void UpdateTextColor(this SearchView searchView, ITextStyle entry) | ||
| { | ||
| if (TryGetDefaultStateColor(searchView, AAttribute.TextColorPrimary, out var color) && | ||
|
|
@@ -56,11 +54,20 @@ internal static void UpdateTextColor(this SearchView searchView, ITextStyle entr | |
| if (entry.TextColor is null) | ||
| editText.SetTextColor(color); | ||
|
|
||
| var searchMagIconImage = searchView.FindViewById<ImageView>(Resource.Id.search_mag_icon); | ||
| searchMagIconImage?.Drawable?.SetTint(color); | ||
| ApplyDecorColor(searchView, color); | ||
kubaflo marked this conversation as resolved.
Show resolved
Hide resolved
|
||
| } | ||
| } | ||
|
|
||
| // Tints the magnifier icon and the underline | ||
kubaflo marked this conversation as resolved.
Show resolved
Hide resolved
kubaflo marked this conversation as resolved.
Show resolved
Hide resolved
|
||
| static void ApplyDecorColor(SearchView searchView, Color color) | ||
|
Contributor
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.
Contributor
Author
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.
Contributor
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. The best fix would be that the search icon and the underline can be set by the user (via AppThemeBinding) ;)
Contributor
Author
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. Hi @AlleSchonWeg this still works: Screen.Recording.2025-10-31.at.13.49.06.mov
Contributor
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. Hi @kubaflo
Contributor
Author
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 was added in here: #26759
Contributor
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.
Contributor
Author
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. I see what happened here :) |
||
| { | ||
| var searchMagIconImage = searchView.FindViewById<ImageView>(Resource.Id.search_mag_icon); | ||
| searchMagIconImage?.Drawable?.SetTint(color); | ||
|
|
||
| var searchPlate = searchView.FindViewById(Resource.Id.search_plate); | ||
| searchPlate?.Background?.SetTint(color); | ||
| } | ||
|
|
||
| public static void UpdateFont(this SearchView searchView, ISearchBar searchBar, IFontManager fontManager, EditText? editText = null) | ||
| { | ||
| editText ??= searchView.GetFirstChildOfType<EditText>(); | ||
|
|
||



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.
introduces trailing whitespace - revert.