diff options
| author | 2021-05-06 13:42:10 -0400 | |
|---|---|---|
| committer | 2021-05-06 13:56:29 -0400 | |
| commit | f0b4194fbc3a67a4535472f23a6c86f4b86e77c5 (patch) | |
| tree | ade0dc18a0497a112dafcf3af7c0352279cccc75 | |
| parent | d245565acc4e3279d4544612ceae3749e569ed74 (diff) | |
Set the default background color to ACTIVE
This corresponds to the default state of tiles.
Test: no test
Fixes: 187414055
Change-Id: I85fe80becd8305bb6600921d08d7121c33481f4a
| -rw-r--r-- | packages/SystemUI/plugin/src/com/android/systemui/plugins/qs/QSTile.java | 4 | ||||
| -rw-r--r-- | packages/SystemUI/src/com/android/systemui/qs/tileimpl/QSTileViewImpl.kt | 11 |
2 files changed, 9 insertions, 6 deletions
diff --git a/packages/SystemUI/plugin/src/com/android/systemui/plugins/qs/QSTile.java b/packages/SystemUI/plugin/src/com/android/systemui/plugins/qs/QSTile.java index 55dea3d3bcb9..f1c1477c5b0a 100644 --- a/packages/SystemUI/plugin/src/com/android/systemui/plugins/qs/QSTile.java +++ b/packages/SystemUI/plugin/src/com/android/systemui/plugins/qs/QSTile.java @@ -148,9 +148,11 @@ public interface QSTile { @ProvidesInterface(version = State.VERSION) public static class State { public static final int VERSION = 1; + public static final int DEFAULT_STATE = Tile.STATE_ACTIVE; + public Icon icon; public Supplier<Icon> iconSupplier; - public int state = Tile.STATE_ACTIVE; + public int state = DEFAULT_STATE; public CharSequence label; public CharSequence secondaryLabel; public CharSequence contentDescription; diff --git a/packages/SystemUI/src/com/android/systemui/qs/tileimpl/QSTileViewImpl.kt b/packages/SystemUI/src/com/android/systemui/qs/tileimpl/QSTileViewImpl.kt index 3ad95d27e940..2d777a53de51 100644 --- a/packages/SystemUI/src/com/android/systemui/qs/tileimpl/QSTileViewImpl.kt +++ b/packages/SystemUI/src/com/android/systemui/qs/tileimpl/QSTileViewImpl.kt @@ -21,7 +21,6 @@ import android.content.Context import android.content.res.ColorStateList import android.content.res.Configuration import android.content.res.Resources.ID_NULL -import android.graphics.Color import android.graphics.drawable.Drawable import android.graphics.drawable.RippleDrawable import android.service.quicksettings.Tile @@ -83,7 +82,7 @@ open class QSTileViewImpl @JvmOverloads constructor( private lateinit var ripple: RippleDrawable private lateinit var colorBackgroundDrawable: Drawable - private var paintColor = Color.WHITE + private var paintColor: Int = 0 private var paintAnimator: ValueAnimator? = null private var labelAnimator: ValueAnimator? = null private var secondaryLabelAnimator: ValueAnimator? = null @@ -105,6 +104,8 @@ open class QSTileViewImpl @JvmOverloads constructor( clipToPadding = false isFocusable = true background = createTileBackground() + paintColor = getCircleColor(QSTile.State.DEFAULT_STATE) + colorBackgroundDrawable.setTint(paintColor) val padding = resources.getDimensionPixelSize(R.dimen.qs_tile_padding) val startPadding = resources.getDimensionPixelSize(R.dimen.qs_tile_start_padding) @@ -165,8 +166,8 @@ open class QSTileViewImpl @JvmOverloads constructor( labelContainer.ignoreLastView = true secondaryLabel.alpha = 0f } - label.setTextColor(getLabelColor(0)) // Default state - secondaryLabel.setTextColor(getSecondaryLabelColor(0)) + label.setTextColor(getLabelColor(QSTile.State.DEFAULT_STATE)) + secondaryLabel.setTextColor(getSecondaryLabelColor(QSTile.State.DEFAULT_STATE)) addView(labelContainer) } @@ -314,7 +315,7 @@ open class QSTileViewImpl @JvmOverloads constructor( // HANDLE STATE CHANGES RELATED METHODS protected open fun handleStateChanged(state: QSTile.State) { - val allowAnimations = animationsEnabled() && paintColor != Color.WHITE + val allowAnimations = animationsEnabled() showRippleEffect = state.showRippleEffect isClickable = state.state != Tile.STATE_UNAVAILABLE isLongClickable = state.handlesLongClick |