diff options
author | Bryan Owens <djbryan3540@gmail.com> | 2016-02-19 13:12:35 -0600 |
---|---|---|
committer | Clark Scheff <clark@cyngn.com> | 2016-03-03 09:52:25 -0800 |
commit | 523ede8ed8068afbac324d58deb6d44fa1b9f413 (patch) | |
tree | c739cf9c9014b8a1189fc54b2f8c6728a891f9f0 /src/com/android/settings/deviceinfo | |
parent | d0aba1ecc908e65ae8a3f1e2b43c0681c94e5f54 (diff) | |
download | packages_apps_Settings-523ede8ed8068afbac324d58deb6d44fa1b9f413.zip packages_apps_Settings-523ede8ed8068afbac324d58deb6d44fa1b9f413.tar.gz packages_apps_Settings-523ede8ed8068afbac324d58deb6d44fa1b9f413.tar.bz2 |
Themes: Expose Hard colors for storage settings
Change-Id: I74d2492ed5e6f1d34cee065719cbc97d5c237829
Signed-off-by: Bryan Owens <djbryan3540@gmail.com>
Diffstat (limited to 'src/com/android/settings/deviceinfo')
-rw-r--r-- | src/com/android/settings/deviceinfo/StorageSettings.java | 29 | ||||
-rw-r--r-- | src/com/android/settings/deviceinfo/StorageVolumePreference.java | 10 |
2 files changed, 24 insertions, 15 deletions
diff --git a/src/com/android/settings/deviceinfo/StorageSettings.java b/src/com/android/settings/deviceinfo/StorageSettings.java index c36d0df..8f56a7c 100644 --- a/src/com/android/settings/deviceinfo/StorageSettings.java +++ b/src/com/android/settings/deviceinfo/StorageSettings.java @@ -23,8 +23,8 @@ import android.app.Fragment; import android.content.Context; import android.content.DialogInterface; import android.content.Intent; -import android.graphics.Color; import android.graphics.drawable.Drawable; +import android.graphics.PorterDuff; import android.os.AsyncTask; import android.os.Bundle; import android.os.storage.DiskInfo; @@ -63,16 +63,10 @@ public class StorageSettings extends SettingsPreferenceFragment implements Index private static final String TAG_VOLUME_UNMOUNTED = "volume_unmounted"; private static final String TAG_DISK_INIT = "disk_init"; - static final int COLOR_PUBLIC = Color.parseColor("#ff9e9e9e"); - static final int COLOR_WARNING = Color.parseColor("#fff4511e"); - static final int[] COLOR_PRIVATE = new int[] { - Color.parseColor("#ff26a69a"), - Color.parseColor("#ffab47bc"), - Color.parseColor("#fff2a600"), - Color.parseColor("#ffec407a"), - Color.parseColor("#ffc0ca33"), - }; + private int mPublicColor; + + private int[] mPrivateColors; private StorageManager mStorageManager; @@ -108,6 +102,14 @@ public class StorageSettings extends SettingsPreferenceFragment implements Index mInternalSummary = new StorageSummaryPreference(context); setHasOptionsMenu(true); + mPublicColor = context.getColor(R.color.storage_volume_color_public); + mPrivateColors = new int[] { + context.getColor(R.color.storage_volume_color_private1), + context.getColor(R.color.storage_volume_color_private2), + context.getColor(R.color.storage_volume_color_private3), + context.getColor(R.color.storage_volume_color_private4), + context.getColor(R.color.storage_volume_color_private5), + }; } private final StorageEventListener mStorageListener = new StorageEventListener() { @@ -147,7 +149,7 @@ public class StorageSettings extends SettingsPreferenceFragment implements Index for (VolumeInfo vol : volumes) { if (vol.getType() == VolumeInfo.TYPE_PRIVATE) { - final int color = COLOR_PRIVATE[privateCount++ % COLOR_PRIVATE.length]; + final int color = mPrivateColors[privateCount++ % mPrivateColors.length]; mInternalCategory.addPreference( new StorageVolumePreference(context, vol, color)); if (vol.isMountedReadable()) { @@ -157,7 +159,7 @@ public class StorageSettings extends SettingsPreferenceFragment implements Index } } else if (vol.getType() == VolumeInfo.TYPE_PUBLIC) { mExternalCategory.addPreference( - new StorageVolumePreference(context, vol, COLOR_PUBLIC)); + new StorageVolumePreference(context, vol, mPublicColor)); } } @@ -169,7 +171,8 @@ public class StorageSettings extends SettingsPreferenceFragment implements Index // TODO: add actual storage type to record final Drawable icon = context.getDrawable(R.drawable.ic_sim_sd); icon.mutate(); - icon.setTint(COLOR_PUBLIC); + icon.setTint(mPublicColor); + icon.setTintMode(PorterDuff.Mode.SRC_ATOP); final Preference pref = new Preference(context); pref.setKey(rec.getFsUuid()); diff --git a/src/com/android/settings/deviceinfo/StorageVolumePreference.java b/src/com/android/settings/deviceinfo/StorageVolumePreference.java index e59f3f6..7668884 100644 --- a/src/com/android/settings/deviceinfo/StorageVolumePreference.java +++ b/src/com/android/settings/deviceinfo/StorageVolumePreference.java @@ -18,8 +18,10 @@ package com.android.settings.deviceinfo; import android.content.Context; import android.content.res.ColorStateList; +import android.content.res.Resources; import android.graphics.Color; import android.graphics.drawable.Drawable; +import android.graphics.PorterDuff; import android.os.storage.StorageManager; import android.os.storage.VolumeInfo; import android.preference.Preference; @@ -77,7 +79,7 @@ public class StorageVolumePreference extends Preference { mUsedPercent = (int) ((usedBytes * 100) / totalBytes); if (freeBytes < mStorageManager.getStorageLowBytes(path)) { - mColor = StorageSettings.COLOR_WARNING; + mColor = context.getColor(R.color.storage_volume_color_warning); icon = context.getDrawable(R.drawable.ic_warning_24dp); } @@ -88,6 +90,7 @@ public class StorageVolumePreference extends Preference { icon.mutate(); icon.setTint(mColor); + icon.setTintMode(PorterDuff.Mode.SRC_ATOP); setIcon(icon); if (volume.getType() == VolumeInfo.TYPE_PUBLIC @@ -99,9 +102,12 @@ public class StorageVolumePreference extends Preference { @Override protected void onBindView(View view) { + final ImageView unmount = (ImageView) view.findViewById(R.id.unmount); + if (unmount != null) { - unmount.setImageTintList(ColorStateList.valueOf(Color.parseColor("#8a000000"))); + unmount.setImageTintList(ColorStateList.valueOf( + getContext().getColor(R.color.eject_icon_tint_color))); unmount.setOnClickListener(mUnmountListener); } |