[TIMOB-26822] Android: Improved customization of Ti.UI.Android.SearchView
| GitHub Issue | n/a |
|---|---|
| Type | Improvement |
| Priority | Medium |
| Status | Closed |
| Resolution | Won't Do |
| Resolution Date | 2020-06-20T00:46:38.000+0000 |
| Affected Version/s | n/a |
| Fix Version/s | n/a |
| Components | Android |
| Labels | n/a |
| Reporter | Rene Pot |
| Assignee | Joshua Quick |
| Created | 2019-02-13T15:58:29.000+0000 |
| Updated | 2020-06-20T00:47:19.000+0000 |
Description
Expose new properties to improve the customization of Ti.UI.Android.SearchView. They are as follow:
-
iconSearchColor - color of the Search icon in collapsed view
- iconSearchCloseColor - color of the Search Close button in expanded view
- iconSearchHintColor - color of the default Search Hint icon
Note that this this can easily be done via themes. For example:
The above works for aSearchViewdisplayed within a window. However, the above won't work when theSearchViewis hosted within the topActionBarand I'm not sure why at the moment. I know that Google's support library overrides the "searchViewStyle" within itsActionBarstyle, but that shouldn't matter since Titanium creates aSearchViewvia the activity's context... which means it's using activity's theme/style instead. And I've noticed that Google's own Gmail app and Docs app never themes theSearchViewwithin theActionBareither. Makes me wonder if they're doing something programmatically that makes it ignore the theme. This is the only issue that I'm aware of. Perhaps setting this icons programmatically "is" the only option in this case.PR: https://github.com/appcelerator/titanium_mobile/pull/10719
I think we should close this ticket as "Won't Do" because: * Google does not provide an official public API to do this. Doing this via Java reflection like the current PR is doing won't be maintainable because it depends on implementation details that Google may change. * Setting the colors should be done via a theme/styles XML file. This is how Google wants this to be done. * I'd prefer that we invest our time into
Ti.UI.SearchBarinstead ofTi.UI.Android.SearchViewfor the sake of parity. The native implementation of Android'sTi.UI.SearchBarshould be changed to use the AndroidXSearchViewclass and deprecateTi.UI.Android.SearchView.