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

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

Fix tile color issues

Test: manual
Fixes: 183888161

Change-Id: I818d41246c892a2cb211170afadc110930f40ab1
parent 81b12816
Loading
Loading
Loading
Loading
+11 −9
Original line number Diff line number Diff line
@@ -43,7 +43,7 @@ public class QSTileView extends QSTileBaseView {
    protected TextView mLabel;
    protected TextView mSecondLine;
    private ImageView mPadLock;
    private int mState;
    protected int mState;
    protected ViewGroup mLabelContainer;
    private View mExpandIndicator;
    private View mExpandSpace;
@@ -133,14 +133,7 @@ public class QSTileView extends QSTileBaseView {
    protected void handleStateChanged(QSTile.State state) {
        super.handleStateChanged(state);
        if (!Objects.equals(mLabel.getText(), state.label) || mState != state.state) {
            ColorStateList labelColor;
            if (state.state == Tile.STATE_ACTIVE) {
                labelColor = mColorLabelActive;
            } else if (state.state == Tile.STATE_INACTIVE) {
                labelColor = mColorLabelInactive;
            } else {
                labelColor = mColorLabelUnavailable;
            }
            ColorStateList labelColor = getLabelColor(state.state);
            changeLabelColor(labelColor);
            mState = state.state;
            mLabel.setText(state.label);
@@ -163,6 +156,15 @@ public class QSTileView extends QSTileBaseView {
        mPadLock.setVisibility(state.disabledByPolicy ? View.VISIBLE : View.GONE);
    }

    protected final ColorStateList getLabelColor(int state) {
        if (state == Tile.STATE_ACTIVE) {
            return mColorLabelActive;
        } else if (state == Tile.STATE_INACTIVE) {
            return mColorLabelInactive;
        }
        return mColorLabelUnavailable;
    }

    protected void changeLabelColor(ColorStateList color) {
        mLabel.setTextColor(color);
    }
+4 −5
Original line number Diff line number Diff line
@@ -56,6 +56,7 @@ open class QSTileViewHorizontal(
        addView(mIcon, 0, LayoutParams(iconSize, iconSize))

        mColorLabelActive = ColorStateList.valueOf(getColorForState(getContext(), STATE_ACTIVE))
        changeLabelColor(getLabelColor(mState)) // Matches the default state of the tile
    }

    override fun createLabel() {
@@ -113,7 +114,6 @@ open class QSTileViewHorizontal(
        if (allowAnimations) {
            animateBackground(newColor)
        } else {
            if (newColor != paintColor) {
            clearBackgroundAnimator()
            colorBackgroundDrawable?.setTintList(ColorStateList.valueOf(newColor))?.also {
                paintColor = newColor
@@ -121,7 +121,6 @@ open class QSTileViewHorizontal(
            paintColor = newColor
        }
    }
    }

    private fun animateBackground(newBackgroundColor: Int) {
        if (newBackgroundColor != paintColor) {