Use new color for unavailable looking tiles

This also makes sure that disabledByPolicy tiles properly change color.

Fixes: 245019957
Test: visual
Change-Id: I502a3832d33722ad848eca46e3b79ed47d8a717d
This commit is contained in:
Fabian Kozynski
2022-09-15 11:02:22 -04:00
parent 9fefe95ba6
commit a99d9015a2
2 changed files with 8 additions and 10 deletions

View File

@@ -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) {

View File

@@ -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