diff --git a/res/drawable-hdpi/ic_sim_sd.png b/res/drawable-hdpi/ic_sim_sd.png deleted file mode 100644 index 50a16dbbbb8..00000000000 Binary files a/res/drawable-hdpi/ic_sim_sd.png and /dev/null differ diff --git a/res/drawable-mdpi/ic_sim_sd.png b/res/drawable-mdpi/ic_sim_sd.png deleted file mode 100644 index 19266089bcc..00000000000 Binary files a/res/drawable-mdpi/ic_sim_sd.png and /dev/null differ diff --git a/res/drawable-xhdpi/ic_sim_sd.png b/res/drawable-xhdpi/ic_sim_sd.png deleted file mode 100644 index 1a0842b68f1..00000000000 Binary files a/res/drawable-xhdpi/ic_sim_sd.png and /dev/null differ diff --git a/res/drawable-xxhdpi/ic_sim_sd.png b/res/drawable-xxhdpi/ic_sim_sd.png deleted file mode 100644 index e05e7adc254..00000000000 Binary files a/res/drawable-xxhdpi/ic_sim_sd.png and /dev/null differ diff --git a/res/drawable-xxxhdpi/ic_sim_sd.png b/res/drawable-xxxhdpi/ic_sim_sd.png deleted file mode 100644 index b12e34efdfb..00000000000 Binary files a/res/drawable-xxxhdpi/ic_sim_sd.png and /dev/null differ diff --git a/res/drawable/ic_sim_sd.xml b/res/drawable/ic_sim_sd.xml new file mode 100644 index 00000000000..d7e31a24809 --- /dev/null +++ b/res/drawable/ic_sim_sd.xml @@ -0,0 +1,27 @@ + + + + + \ No newline at end of file diff --git a/src/com/android/settings/deviceinfo/StorageSettings.java b/src/com/android/settings/deviceinfo/StorageSettings.java index 2e52e6b4642..a24f82b3535 100644 --- a/src/com/android/settings/deviceinfo/StorageSettings.java +++ b/src/com/android/settings/deviceinfo/StorageSettings.java @@ -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); } } diff --git a/src/com/android/settings/deviceinfo/StorageVolumePreference.java b/src/com/android/settings/deviceinfo/StorageVolumePreference.java index 14fd42e23d4..0734c0b66ad 100644 --- a/src/com/android/settings/deviceinfo/StorageVolumePreference.java +++ b/src/com/android/settings/deviceinfo/StorageVolumePreference.java @@ -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); }