Loading packages/SystemUI/src/com/android/systemui/qs/customize/CustomizeTileViewHorizontal.kt +0 −6 Original line number Diff line number Diff line package com.android.systemui.qs.customize import android.content.Context import android.graphics.drawable.Drawable import android.view.View import com.android.systemui.plugins.qs.QSIconView import com.android.systemui.plugins.qs.QSTile Loading Loading @@ -42,9 +41,4 @@ class CustomizeTileViewHorizontal( override fun changeState(state: QSTile.State) { handleStateChanged(state) } override fun newTileBackground(): Drawable? { super.newTileBackground() return paintDrawable } } No newline at end of file packages/SystemUI/src/com/android/systemui/qs/tileimpl/QSTileViewHorizontal.kt +11 −25 Original line number Diff line number Diff line Loading @@ -21,8 +21,8 @@ import android.content.Context import android.content.res.ColorStateList import android.graphics.Color import android.graphics.drawable.Drawable import android.graphics.drawable.PaintDrawable import android.graphics.drawable.RippleDrawable import android.graphics.drawable.ShapeDrawable import android.graphics.drawable.shapes.RoundRectShape import android.service.quicksettings.Tile.STATE_ACTIVE import android.view.Gravity import android.widget.LinearLayout Loading @@ -34,13 +34,14 @@ import com.android.systemui.qs.tileimpl.QSTileImpl.getColorForState // Placeholder private const val CORNER_RADIUS = 40f private val RADII = (1..8).map { CORNER_RADIUS }.toFloatArray() open class QSTileViewHorizontal( context: Context, icon: QSIconView ) : QSTileView(context, icon, false) { protected var paintDrawable: PaintDrawable? = null protected var backgroundDrawable: ShapeDrawable? = null private var paintColor = Color.WHITE private var paintAnimator: ValueAnimator? = null Loading Loading @@ -74,28 +75,13 @@ open class QSTileViewHorizontal( } override fun newTileBackground(): Drawable? { val d = super.newTileBackground() if (paintDrawable == null) { paintDrawable = PaintDrawable(paintColor).apply { setCornerRadius(CORNER_RADIUS) } } if (d is RippleDrawable) { d.addLayer(paintDrawable) return d } else { return paintDrawable } backgroundDrawable = ShapeDrawable(RoundRectShape(RADII, null, null)) return backgroundDrawable } override fun setClickable(clickable: Boolean) { super.setClickable(clickable) background = mTileBackground if (clickable && mShowRippleEffect) { mRipple?.setHotspotBounds(left, top, right, bottom) } else { mRipple?.setHotspotBounds(0, 0, 0, 0) } } override fun handleStateChanged(state: QSTile.State) { Loading @@ -110,11 +96,10 @@ open class QSTileViewHorizontal( } else { if (newColor != paintColor) { clearAnimator() paintDrawable?.paint?.color = newColor paintDrawable?.invalidateSelf() backgroundDrawable?.setTintList(ColorStateList.valueOf(newColor)) paintColor = newColor } } paintColor = newColor } private fun animateToNewState(newColor: Int) { Loading @@ -123,8 +108,9 @@ open class QSTileViewHorizontal( paintAnimator = ValueAnimator.ofArgb(paintColor, newColor) .setDuration(QSIconViewImpl.QS_ANIM_LENGTH).apply { addUpdateListener { animation: ValueAnimator -> paintDrawable?.paint?.color = animation.animatedValue as Int paintDrawable?.invalidateSelf() val c = animation.animatedValue as Int backgroundDrawable?.setTintList(ColorStateList.valueOf(c)) paintColor = c } start() } Loading Loading
packages/SystemUI/src/com/android/systemui/qs/customize/CustomizeTileViewHorizontal.kt +0 −6 Original line number Diff line number Diff line package com.android.systemui.qs.customize import android.content.Context import android.graphics.drawable.Drawable import android.view.View import com.android.systemui.plugins.qs.QSIconView import com.android.systemui.plugins.qs.QSTile Loading Loading @@ -42,9 +41,4 @@ class CustomizeTileViewHorizontal( override fun changeState(state: QSTile.State) { handleStateChanged(state) } override fun newTileBackground(): Drawable? { super.newTileBackground() return paintDrawable } } No newline at end of file
packages/SystemUI/src/com/android/systemui/qs/tileimpl/QSTileViewHorizontal.kt +11 −25 Original line number Diff line number Diff line Loading @@ -21,8 +21,8 @@ import android.content.Context import android.content.res.ColorStateList import android.graphics.Color import android.graphics.drawable.Drawable import android.graphics.drawable.PaintDrawable import android.graphics.drawable.RippleDrawable import android.graphics.drawable.ShapeDrawable import android.graphics.drawable.shapes.RoundRectShape import android.service.quicksettings.Tile.STATE_ACTIVE import android.view.Gravity import android.widget.LinearLayout Loading @@ -34,13 +34,14 @@ import com.android.systemui.qs.tileimpl.QSTileImpl.getColorForState // Placeholder private const val CORNER_RADIUS = 40f private val RADII = (1..8).map { CORNER_RADIUS }.toFloatArray() open class QSTileViewHorizontal( context: Context, icon: QSIconView ) : QSTileView(context, icon, false) { protected var paintDrawable: PaintDrawable? = null protected var backgroundDrawable: ShapeDrawable? = null private var paintColor = Color.WHITE private var paintAnimator: ValueAnimator? = null Loading Loading @@ -74,28 +75,13 @@ open class QSTileViewHorizontal( } override fun newTileBackground(): Drawable? { val d = super.newTileBackground() if (paintDrawable == null) { paintDrawable = PaintDrawable(paintColor).apply { setCornerRadius(CORNER_RADIUS) } } if (d is RippleDrawable) { d.addLayer(paintDrawable) return d } else { return paintDrawable } backgroundDrawable = ShapeDrawable(RoundRectShape(RADII, null, null)) return backgroundDrawable } override fun setClickable(clickable: Boolean) { super.setClickable(clickable) background = mTileBackground if (clickable && mShowRippleEffect) { mRipple?.setHotspotBounds(left, top, right, bottom) } else { mRipple?.setHotspotBounds(0, 0, 0, 0) } } override fun handleStateChanged(state: QSTile.State) { Loading @@ -110,11 +96,10 @@ open class QSTileViewHorizontal( } else { if (newColor != paintColor) { clearAnimator() paintDrawable?.paint?.color = newColor paintDrawable?.invalidateSelf() backgroundDrawable?.setTintList(ColorStateList.valueOf(newColor)) paintColor = newColor } } paintColor = newColor } private fun animateToNewState(newColor: Int) { Loading @@ -123,8 +108,9 @@ open class QSTileViewHorizontal( paintAnimator = ValueAnimator.ofArgb(paintColor, newColor) .setDuration(QSIconViewImpl.QS_ANIM_LENGTH).apply { addUpdateListener { animation: ValueAnimator -> paintDrawable?.paint?.color = animation.animatedValue as Int paintDrawable?.invalidateSelf() val c = animation.animatedValue as Int backgroundDrawable?.setTintList(ColorStateList.valueOf(c)) paintColor = c } start() } Loading