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:
@@ -23,8 +23,6 @@ import android.app.settings.SettingsEnums;
|
||||
import android.content.Context;
|
||||
import android.content.DialogInterface;
|
||||
import android.content.Intent;
|
||||
import android.graphics.Color;
|
||||
import android.graphics.drawable.Drawable;
|
||||
import android.os.AsyncTask;
|
||||
import android.os.Bundle;
|
||||
import android.os.UserHandle;
|
||||
@@ -76,16 +74,6 @@ public class StorageSettings extends SettingsPreferenceFragment implements Index
|
||||
private static final String TAG_DISK_INIT = "disk_init";
|
||||
private static final int METRICS_CATEGORY = SettingsEnums.DEVICEINFO_STORAGE;
|
||||
|
||||
static final int COLOR_PUBLIC = Color.parseColor("#ff9e9e9e");
|
||||
|
||||
static final int[] COLOR_PRIVATE = new int[]{
|
||||
Color.parseColor("#ff26a69a"),
|
||||
Color.parseColor("#ffab47bc"),
|
||||
Color.parseColor("#fff2a600"),
|
||||
Color.parseColor("#ffec407a"),
|
||||
Color.parseColor("#ffc0ca33"),
|
||||
};
|
||||
|
||||
private StorageManager mStorageManager;
|
||||
|
||||
private PreferenceCategory mInternalCategory;
|
||||
@@ -176,13 +164,12 @@ public class StorageSettings extends SettingsPreferenceFragment implements Index
|
||||
if (vol.getType() == VolumeInfo.TYPE_PRIVATE) {
|
||||
final long volumeTotalBytes = PrivateStorageInfo.getTotalSize(vol,
|
||||
sTotalInternalStorage);
|
||||
final int color = COLOR_PRIVATE[privateCount++ % COLOR_PRIVATE.length];
|
||||
mInternalCategory.addPreference(
|
||||
new StorageVolumePreference(context, vol, color, volumeTotalBytes));
|
||||
new StorageVolumePreference(context, vol, volumeTotalBytes));
|
||||
} else if (vol.getType() == VolumeInfo.TYPE_PUBLIC
|
||||
|| vol.getType() == VolumeInfo.TYPE_STUB) {
|
||||
mExternalCategory.addPreference(
|
||||
new StorageVolumePreference(context, vol, COLOR_PUBLIC, 0));
|
||||
new StorageVolumePreference(context, vol, 0));
|
||||
}
|
||||
}
|
||||
|
||||
@@ -192,15 +179,11 @@ public class StorageSettings extends SettingsPreferenceFragment implements Index
|
||||
if (rec.getType() == VolumeInfo.TYPE_PRIVATE
|
||||
&& mStorageManager.findVolumeByUuid(rec.getFsUuid()) == null) {
|
||||
// TODO: add actual storage type to record
|
||||
final Drawable icon = context.getDrawable(R.drawable.ic_sim_sd);
|
||||
icon.mutate();
|
||||
icon.setTint(COLOR_PUBLIC);
|
||||
|
||||
final Preference pref = new Preference(context);
|
||||
pref.setKey(rec.getFsUuid());
|
||||
pref.setTitle(rec.getNickname());
|
||||
pref.setSummary(com.android.internal.R.string.ext_media_status_missing);
|
||||
pref.setIcon(icon);
|
||||
pref.setIcon(R.drawable.ic_sim_sd);
|
||||
mInternalCategory.addPreference(pref);
|
||||
}
|
||||
}
|
||||
|
@@ -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);
|
||||
}
|
||||
|
Reference in New Issue
Block a user