From 914b708645f3f183719dd53623900a1609c6579b Mon Sep 17 00:00:00 2001 From: Lucas Dupin Date: Sat, 3 Mar 2018 14:05:04 -0800 Subject: [PATCH] Tint keyguard icons Test: visual Change-Id: I7915c4ad1cd4bcb852a7bdd68e9f57fda7f985c6 Fixes: 71599427 --- .../android/keyguard/KeyguardSliceView.java | 24 ++++++++++++++++++- 1 file changed, 23 insertions(+), 1 deletion(-) diff --git a/packages/SystemUI/src/com/android/keyguard/KeyguardSliceView.java b/packages/SystemUI/src/com/android/keyguard/KeyguardSliceView.java index 2adb2869e0f6c..7572512eac314 100644 --- a/packages/SystemUI/src/com/android/keyguard/KeyguardSliceView.java +++ b/packages/SystemUI/src/com/android/keyguard/KeyguardSliceView.java @@ -179,7 +179,7 @@ public class KeyguardSliceView extends LinearLayout implements View.OnClickListe / (float) iconDrawable.getIntrinsicHeight() * mIconSize); iconDrawable.setBounds(0, 0, Math.max(width, 1), mIconSize); } - button.setCompoundDrawablesRelative(iconDrawable, null, null, null); + button.setCompoundDrawables(iconDrawable, null, null, null); button.setOnClickListener(this); } @@ -338,5 +338,27 @@ public class KeyguardSliceView extends LinearLayout implements View.OnClickListe setMaxLines(1); setEllipsize(TruncateAt.END); } + + @Override + public void setTextColor(int color) { + super.setTextColor(color); + updateDrawableColors(); + } + + @Override + public void setCompoundDrawables(Drawable left, Drawable top, Drawable right, + Drawable bottom) { + super.setCompoundDrawables(left, top, right, bottom); + updateDrawableColors(); + } + + private void updateDrawableColors() { + final int color = getCurrentTextColor(); + for (Drawable drawable : getCompoundDrawables()) { + if (drawable != null) { + drawable.setTint(color); + } + } + } } }