diff options
author | d34d <clark@cyngn.com> | 2015-12-01 13:52:03 -0800 |
---|---|---|
committer | d34d <clark@cyngn.com> | 2015-12-03 13:28:43 -0800 |
commit | 03857bc022722980308470f59e65718c928e1278 (patch) | |
tree | 7310b3fdec484179f3183a403f5aef512ed1715e /src/com | |
parent | 39aaf2b7c6f967c0034f5dedf5a065d10f0f6940 (diff) | |
download | packages_apps_Settings-03857bc022722980308470f59e65718c928e1278.zip packages_apps_Settings-03857bc022722980308470f59e65718c928e1278.tar.gz packages_apps_Settings-03857bc022722980308470f59e65718c928e1278.tar.bz2 |
Themes: Expose color for external settings icons
Marhsmallow now allows for system apps to add settings. An icon is
loaded from the external package and a tint is applied to the icon
so that it matches other icons in the dashboard. The tint color
uses the colorAccent attribute from the currently applied style.
Themes can overlay the colorAccent but this color is also used for
other elements of the UI which may not be ideal.
This patch adds a new color external_tile_icon_tint_color which
points to the attribute ?android:attr/colorAccent when not themed.
This retains the original look but offers better flexibility for
theme designers.
Change-Id: I95fe8da0768f29e0b762af3a74fd2afad7b15cd2
Diffstat (limited to 'src/com')
-rw-r--r-- | src/com/android/settings/dashboard/DashboardSummary.java | 13 |
1 files changed, 9 insertions, 4 deletions
diff --git a/src/com/android/settings/dashboard/DashboardSummary.java b/src/com/android/settings/dashboard/DashboardSummary.java index 6408636..39ff0c7 100644 --- a/src/com/android/settings/dashboard/DashboardSummary.java +++ b/src/com/android/settings/dashboard/DashboardSummary.java @@ -181,10 +181,15 @@ public class DashboardSummary extends InstrumentedFragment { .getResourcesForApplication(tile.iconPkg).getDrawable(tile.iconRes, null); if (!tile.iconPkg.equals(context.getPackageName()) && drawable != null) { // If this drawable is coming from outside Settings, tint it to match the color. - TypedValue tintColor = new TypedValue(); - context.getTheme().resolveAttribute(com.android.internal.R.attr.colorAccent, - tintColor, true); - drawable.setTint(tintColor.data); + TypedValue tintColorValue = new TypedValue(); + context.getResources().getValue(R.color.external_tile_icon_tint_color, + tintColorValue, true); + // If tintColorValue is TYPE_ATTRIBUTE, resolve it + if (tintColorValue.type == TypedValue.TYPE_ATTRIBUTE) { + context.getTheme().resolveAttribute(tintColorValue.data, + tintColorValue, true); + } + drawable.setTint(tintColorValue.data); } tileIcon.setImageDrawable(drawable); } catch (NameNotFoundException | Resources.NotFoundException e) { |