Remove custom tintable check.
Make a bunch keys private in tile and DashboardCategory Bug: 77600770 Test: robotests Change-Id: I4693e6bb71bd50cc664f578c7f8e25e67da20b67
This commit is contained in:
@@ -18,6 +18,7 @@ package com.android.settings.dashboard;
|
||||
import android.app.Activity;
|
||||
import android.content.Context;
|
||||
import android.content.res.TypedArray;
|
||||
import android.graphics.drawable.Icon;
|
||||
import android.os.Bundle;
|
||||
import android.text.TextUtils;
|
||||
import android.util.ArrayMap;
|
||||
@@ -40,7 +41,6 @@ import com.android.settingslib.core.lifecycle.Lifecycle;
|
||||
import com.android.settingslib.core.lifecycle.LifecycleObserver;
|
||||
import com.android.settingslib.drawer.DashboardCategory;
|
||||
import com.android.settingslib.drawer.Tile;
|
||||
import com.android.settingslib.drawer.TileUtils;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.Collection;
|
||||
@@ -254,24 +254,6 @@ public abstract class DashboardFragment extends SettingsPreferenceFragment
|
||||
return true;
|
||||
}
|
||||
|
||||
@VisibleForTesting
|
||||
boolean tintTileIcon(Tile tile) {
|
||||
final Context context = getContext();
|
||||
if (tile.getIcon(context) == null) {
|
||||
return false;
|
||||
}
|
||||
// First check if the tile has set the icon tintable metadata.
|
||||
final Bundle metadata = tile.metaData;
|
||||
if (metadata != null
|
||||
&& metadata.containsKey(TileUtils.META_DATA_PREFERENCE_ICON_TINTABLE)) {
|
||||
return metadata.getBoolean(TileUtils.META_DATA_PREFERENCE_ICON_TINTABLE);
|
||||
}
|
||||
final String pkgName = context.getPackageName();
|
||||
// If this drawable is coming from outside Settings, tint it to match the color.
|
||||
return pkgName != null && tile.intent != null
|
||||
&& !pkgName.equals(tile.intent.getComponent().getPackageName());
|
||||
}
|
||||
|
||||
/**
|
||||
* Displays resource based tiles.
|
||||
*/
|
||||
@@ -370,8 +352,11 @@ public abstract class DashboardFragment extends SettingsPreferenceFragment
|
||||
if (!displayTile(tile)) {
|
||||
continue;
|
||||
}
|
||||
if (tintTileIcon(tile)) {
|
||||
tile.getIcon(context).setTint(tintColor);
|
||||
if (tile.isIconTintable(context)) {
|
||||
final Icon icon = tile.getIcon(context);
|
||||
if (icon != null) {
|
||||
icon.setTint(tintColor);
|
||||
}
|
||||
}
|
||||
if (mDashboardTilePrefKeys.contains(key)) {
|
||||
// Have the key already, will rebind.
|
||||
|
Reference in New Issue
Block a user