summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--packages/SystemUI/src/com/android/systemui/qs/tileimpl/QSTileView.java20
-rw-r--r--packages/SystemUI/src/com/android/systemui/qs/tileimpl/QSTileViewHorizontal.kt9
2 files changed, 15 insertions, 14 deletions
diff --git a/packages/SystemUI/src/com/android/systemui/qs/tileimpl/QSTileView.java b/packages/SystemUI/src/com/android/systemui/qs/tileimpl/QSTileView.java
index c7ed89ba49b1..3d5a709a5fdd 100644
--- a/packages/SystemUI/src/com/android/systemui/qs/tileimpl/QSTileView.java
+++ b/packages/SystemUI/src/com/android/systemui/qs/tileimpl/QSTileView.java
@@ -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);
}
diff --git a/packages/SystemUI/src/com/android/systemui/qs/tileimpl/QSTileViewHorizontal.kt b/packages/SystemUI/src/com/android/systemui/qs/tileimpl/QSTileViewHorizontal.kt
index 188e89edd89a..ea6876f5999b 100644
--- a/packages/SystemUI/src/com/android/systemui/qs/tileimpl/QSTileViewHorizontal.kt
+++ b/packages/SystemUI/src/com/android/systemui/qs/tileimpl/QSTileViewHorizontal.kt
@@ -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) {
@@ -121,13 +122,11 @@ open class QSTileViewHorizontal(
if (allowAnimations) {
animateBackground(newColor)
} else {
- if (newColor != paintColor) {
- clearBackgroundAnimator()
- colorBackgroundDrawable?.setTintList(ColorStateList.valueOf(newColor))?.also {
- paintColor = newColor
- }
+ clearBackgroundAnimator()
+ colorBackgroundDrawable?.setTintList(ColorStateList.valueOf(newColor))?.also {
paintColor = newColor
}
+ paintColor = newColor
}
}