Tint icon colors of storage screen same as other screen

We were using hard-coded colors to tint the icons on storage screen
for some reasons.  Change it to the same way we tint other icons,
as there's no reason to keep it special, and also per partner's
request to keep it consistent with other screens.

Also update the ic_sim_sd icon from png to vectors.

Test: Manual/Visual verification
BUG: 113977374
Change-Id: Ia0210635e936b6798aaf9e48dd8815a197396065
This commit is contained in:
lindatseng
2019-03-28 14:46:36 -07:00
committed by Linda Tseng
parent 619211cd9e
commit 3debd0691d
8 changed files with 37 additions and 27 deletions

View File

@@ -50,16 +50,16 @@ public class StorageVolumePreference extends Preference {
private final StorageManager mStorageManager;
private final VolumeInfo mVolume;
private int mColor;
private int mUsedPercent = -1;
private ColorStateList mColorTintList;
// TODO: ideally, VolumeInfo should have a total physical size.
public StorageVolumePreference(Context context, VolumeInfo volume, int color, long totalBytes) {
public StorageVolumePreference(Context context, VolumeInfo volume, long totalBytes) {
super(context);
mStorageManager = context.getSystemService(StorageManager.class);
mVolume = volume;
mColor = color;
mColorTintList = Utils.getColorAttr(context, android.R.attr.colorControlNormal);
setLayoutResource(R.layout.storage_volume);
@@ -107,8 +107,10 @@ public class StorageVolumePreference extends Preference {
}
if (freeBytes < mStorageManager.getStorageLowBytes(path)) {
mColor = Utils.getColorAttrDefaultColor(context, android.R.attr.colorError);
mColorTintList = Utils.getColorAttr(context, android.R.attr.colorError);
icon = context.getDrawable(R.drawable.ic_warning_24dp);
icon.mutate();
icon.setTintList(mColorTintList);
}
} else {
@@ -116,8 +118,6 @@ public class StorageVolumePreference extends Preference {
mUsedPercent = -1;
}
icon.mutate();
icon.setTint(mColor);
setIcon(icon);
if (volume.getType() == VolumeInfo.TYPE_PUBLIC
@@ -138,7 +138,7 @@ public class StorageVolumePreference extends Preference {
if (mVolume.getType() == VolumeInfo.TYPE_PRIVATE && mUsedPercent != -1) {
progress.setVisibility(View.VISIBLE);
progress.setProgress(mUsedPercent);
progress.setProgressTintList(ColorStateList.valueOf(mColor));
progress.setProgressTintList(mColorTintList);
} else {
progress.setVisibility(View.GONE);
}