Fix tinting on injected pref icon

We used to tint the injected pref icon when refreshing Tile. However,
when we are going to render the icon, we used Tile.getIcon which uses
the icon resource id to get the original version of icon directly.

Do a little refactor here to move the tinting logic inside Tile.getIcon.

Test: Manual/Visual inspection
Fixes: 129010399
Change-Id: I6f187b12cb6d91b54dcfe43e0ff34add55fd7b07
This commit is contained in:
lindatseng
2019-04-02 11:27:25 -07:00
parent ed4bc05f6f
commit 2e7af2f023
2 changed files with 3 additions and 13 deletions

View File

@@ -192,7 +192,9 @@ public class DashboardFeatureProviderImpl implements DashboardFeatureProvider {
@VisibleForTesting
void bindIcon(Preference preference, Tile tile, boolean forceRoundedIcon) {
final Icon tileIcon = tile.getIcon(mContext);
// Use preference context instead here when get icon from Tile, as we are using the context
// to get the style to tint the icon. Using mContext here won't get the correct style.
final Icon tileIcon = tile.getIcon(preference.getContext());
if (tileIcon != null) {
Drawable iconDrawable = tileIcon.loadDrawable(preference.getContext());
if (forceRoundedIcon