summaryrefslogtreecommitdiffstats
path: root/src/com/android/settings/dashboard
diff options
context:
space:
mode:
authorJason Monk <jmonk@google.com>2015-04-21 13:26:36 -0400
committerJason Monk <jmonk@google.com>2015-04-23 12:41:40 -0400
commit47d16e9bf6768b7bcc8b3ca9327e9e866bf9cdee (patch)
tree4af3d16f823adaeb7fe12de437f0e891da6387a3 /src/com/android/settings/dashboard
parentf62f1db70fea9801151438da66b085f2b5b5a147 (diff)
downloadpackages_apps_Settings-47d16e9bf6768b7bcc8b3ca9327e9e866bf9cdee.zip
packages_apps_Settings-47d16e9bf6768b7bcc8b3ca9327e9e866bf9cdee.tar.gz
packages_apps_Settings-47d16e9bf6768b7bcc8b3ca9327e9e866bf9cdee.tar.bz2
Tint dashboard items coming from external tiles
So they can match the Settings theme. Bug: 20449897 Change-Id: I33ad0d78dad6fbc9dae35552246a559b6508deaf
Diffstat (limited to 'src/com/android/settings/dashboard')
-rw-r--r--src/com/android/settings/dashboard/DashboardSummary.java14
1 files changed, 12 insertions, 2 deletions
diff --git a/src/com/android/settings/dashboard/DashboardSummary.java b/src/com/android/settings/dashboard/DashboardSummary.java
index b1d2cba..31aa0df 100644
--- a/src/com/android/settings/dashboard/DashboardSummary.java
+++ b/src/com/android/settings/dashboard/DashboardSummary.java
@@ -22,11 +22,13 @@ import android.content.Intent;
import android.content.IntentFilter;
import android.content.pm.PackageManager.NameNotFoundException;
import android.content.res.Resources;
+import android.graphics.drawable.Drawable;
import android.os.Bundle;
import android.os.Handler;
import android.os.Message;
import android.text.TextUtils;
import android.util.Log;
+import android.util.TypedValue;
import android.view.LayoutInflater;
import android.view.Menu;
import android.view.MenuInflater;
@@ -174,8 +176,16 @@ public class DashboardSummary extends InstrumentedFragment {
if (!TextUtils.isEmpty(tile.iconPkg)) {
try {
- tileIcon.setImageDrawable(context.getPackageManager()
- .getResourcesForApplication(tile.iconPkg).getDrawable(tile.iconRes, null));
+ Drawable drawable = context.getPackageManager()
+ .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);
+ }
+ tileIcon.setImageDrawable(drawable);
} catch (NameNotFoundException | Resources.NotFoundException e) {
tileIcon.setImageDrawable(null);
tileIcon.setBackground(null);