Loading packages/SystemUI/src/com/android/systemui/qs/tileimpl/QSTileView.java +11 −9 Original line number Diff line number Diff line Loading @@ -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; Loading Loading @@ -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); Loading @@ -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); } Loading packages/SystemUI/src/com/android/systemui/qs/tileimpl/QSTileViewHorizontal.kt +4 −5 Original line number Diff line number Diff line Loading @@ -57,6 +57,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 onLayout(changed: Boolean, l: Int, t: Int, r: Int, b: Int) { Loading Loading @@ -121,7 +122,6 @@ open class QSTileViewHorizontal( if (allowAnimations) { animateBackground(newColor) } else { if (newColor != paintColor) { clearBackgroundAnimator() colorBackgroundDrawable?.setTintList(ColorStateList.valueOf(newColor))?.also { paintColor = newColor Loading @@ -129,7 +129,6 @@ open class QSTileViewHorizontal( paintColor = newColor } } } private fun animateBackground(newBackgroundColor: Int) { if (newBackgroundColor != paintColor) { Loading Loading
packages/SystemUI/src/com/android/systemui/qs/tileimpl/QSTileView.java +11 −9 Original line number Diff line number Diff line Loading @@ -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; Loading Loading @@ -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); Loading @@ -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); } Loading
packages/SystemUI/src/com/android/systemui/qs/tileimpl/QSTileViewHorizontal.kt +4 −5 Original line number Diff line number Diff line Loading @@ -57,6 +57,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 onLayout(changed: Boolean, l: Int, t: Int, r: Int, b: Int) { Loading Loading @@ -121,7 +122,6 @@ open class QSTileViewHorizontal( if (allowAnimations) { animateBackground(newColor) } else { if (newColor != paintColor) { clearBackgroundAnimator() colorBackgroundDrawable?.setTintList(ColorStateList.valueOf(newColor))?.also { paintColor = newColor Loading @@ -129,7 +129,6 @@ open class QSTileViewHorizontal( paintColor = newColor } } } private fun animateBackground(newBackgroundColor: Int) { if (newBackgroundColor != paintColor) { Loading