From a99d9015a2dec3d512431ea35318c90b84ae9d91 Mon Sep 17 00:00:00 2001 From: Fabian Kozynski Date: Thu, 15 Sep 2022 11:02:22 -0400 Subject: [PATCH] Use new color for unavailable looking tiles This also makes sure that disabledByPolicy tiles properly change color. Fixes: 245019957 Test: visual Change-Id: I502a3832d33722ad848eca46e3b79ed47d8a717d --- .../systemui/qs/tileimpl/QSIconViewImpl.java | 13 +++++-------- .../android/systemui/qs/tileimpl/QSTileViewImpl.kt | 5 +++-- 2 files changed, 8 insertions(+), 10 deletions(-) diff --git a/packages/SystemUI/src/com/android/systemui/qs/tileimpl/QSIconViewImpl.java b/packages/SystemUI/src/com/android/systemui/qs/tileimpl/QSIconViewImpl.java index 58426656e4bf9..e9a6c25c0e6d4 100644 --- a/packages/SystemUI/src/com/android/systemui/qs/tileimpl/QSIconViewImpl.java +++ b/packages/SystemUI/src/com/android/systemui/qs/tileimpl/QSIconViewImpl.java @@ -50,6 +50,7 @@ public class QSIconViewImpl extends QSIconView { protected int mIconSizePx; private boolean mAnimationEnabled = true; private int mState = -1; + private boolean mDisabledByPolicy = false; private int mTint; @Nullable private QSTile.Icon mLastIcon; @@ -159,14 +160,10 @@ public class QSIconViewImpl extends QSIconView { } protected void setIcon(ImageView iv, QSTile.State state, boolean allowAnimations) { - if (state.disabledByPolicy) { - iv.setColorFilter(getContext().getColor(R.color.qs_tile_disabled_color)); - } else { - iv.clearColorFilter(); - } - if (state.state != mState) { + if (state.state != mState || state.disabledByPolicy != mDisabledByPolicy) { int color = getColor(state); mState = state.state; + mDisabledByPolicy = state.disabledByPolicy; if (mTint != 0 && allowAnimations && shouldAnimate(iv)) { animateGrayScale(mTint, color, iv, () -> updateIcon(iv, state, allowAnimations)); } else { @@ -241,8 +238,8 @@ public class QSIconViewImpl extends QSIconView { */ private static int getIconColorForState(Context context, QSTile.State state) { if (state.disabledByPolicy || state.state == Tile.STATE_UNAVAILABLE) { - return Utils.applyAlpha(QSTileViewImpl.UNAVAILABLE_ALPHA, - Utils.getColorAttrDefaultColor(context, android.R.attr.textColorPrimary)); + return Utils.getColorAttrDefaultColor( + context, com.android.internal.R.attr.textColorTertiary); } else if (state.state == Tile.STATE_INACTIVE) { return Utils.getColorAttrDefaultColor(context, android.R.attr.textColorPrimary); } else if (state.state == Tile.STATE_ACTIVE) { diff --git a/packages/SystemUI/src/com/android/systemui/qs/tileimpl/QSTileViewImpl.kt b/packages/SystemUI/src/com/android/systemui/qs/tileimpl/QSTileViewImpl.kt index 163ee2af600c9..972b24343d10f 100644 --- a/packages/SystemUI/src/com/android/systemui/qs/tileimpl/QSTileViewImpl.kt +++ b/packages/SystemUI/src/com/android/systemui/qs/tileimpl/QSTileViewImpl.kt @@ -100,14 +100,15 @@ open class QSTileViewImpl @JvmOverloads constructor( Utils.getColorAttrDefaultColor(context, com.android.internal.R.attr.textColorOnAccent) private val colorLabelInactive = Utils.getColorAttrDefaultColor(context, android.R.attr.textColorPrimary) - private val colorLabelUnavailable = Utils.applyAlpha(UNAVAILABLE_ALPHA, colorLabelInactive) + private val colorLabelUnavailable = + Utils.getColorAttrDefaultColor(context, com.android.internal.R.attr.textColorTertiary) private val colorSecondaryLabelActive = Utils.getColorAttrDefaultColor(context, android.R.attr.textColorSecondaryInverse) private val colorSecondaryLabelInactive = Utils.getColorAttrDefaultColor(context, android.R.attr.textColorSecondary) private val colorSecondaryLabelUnavailable = - Utils.applyAlpha(UNAVAILABLE_ALPHA, colorSecondaryLabelInactive) + Utils.getColorAttrDefaultColor(context, com.android.internal.R.attr.textColorTertiary) private lateinit var label: TextView protected lateinit var secondaryLabel: TextView