Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit a99d9015 authored by Fabian Kozynski's avatar Fabian Kozynski
Browse files

Use new color for unavailable looking tiles

This also makes sure that disabledByPolicy tiles properly change color.

Fixes: 245019957
Test: visual
Change-Id: I502a3832d33722ad848eca46e3b79ed47d8a717d
parent 9fefe95b
Loading
Loading
Loading
Loading
+5 −8
Original line number Diff line number Diff line
@@ -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) {
+3 −2
Original line number Diff line number Diff line
@@ -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