Merge "Remove AuthRipple alpha animator" into tm-qpr-dev
This commit is contained in:
@@ -102,11 +102,6 @@ constructor(
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
override fun onInit() {
|
|
||||||
mView.setAlphaInDuration(sysuiContext.resources.getInteger(
|
|
||||||
R.integer.auth_ripple_alpha_in_duration).toLong())
|
|
||||||
}
|
|
||||||
|
|
||||||
@VisibleForTesting
|
@VisibleForTesting
|
||||||
public override fun onViewAttached() {
|
public override fun onViewAttached() {
|
||||||
authController.addCallback(authControllerCallback)
|
authController.addCallback(authControllerCallback)
|
||||||
|
|||||||
@@ -54,12 +54,11 @@ class AuthRippleView(context: Context?, attrs: AttributeSet?) : View(context, at
|
|||||||
private var lockScreenColorVal = Color.WHITE
|
private var lockScreenColorVal = Color.WHITE
|
||||||
private val fadeDuration = 83L
|
private val fadeDuration = 83L
|
||||||
private val retractDuration = 400L
|
private val retractDuration = 400L
|
||||||
private var alphaInDuration: Long = 0
|
|
||||||
private val dwellShader = DwellRippleShader()
|
private val dwellShader = DwellRippleShader()
|
||||||
private val dwellPaint = Paint()
|
private val dwellPaint = Paint()
|
||||||
private val rippleShader = RippleShader()
|
private val rippleShader = RippleShader()
|
||||||
private val ripplePaint = Paint()
|
private val ripplePaint = Paint()
|
||||||
private var unlockedRippleAnimator: AnimatorSet? = null
|
private var unlockedRippleAnimator: Animator? = null
|
||||||
private var fadeDwellAnimator: Animator? = null
|
private var fadeDwellAnimator: Animator? = null
|
||||||
private var retractDwellAnimator: Animator? = null
|
private var retractDwellAnimator: Animator? = null
|
||||||
private var dwellPulseOutAnimator: Animator? = null
|
private var dwellPulseOutAnimator: Animator? = null
|
||||||
@@ -85,12 +84,12 @@ class AuthRippleView(context: Context?, attrs: AttributeSet?) : View(context, at
|
|||||||
}
|
}
|
||||||
|
|
||||||
init {
|
init {
|
||||||
rippleShader.color = 0xffffffff.toInt() // default color
|
|
||||||
rippleShader.rawProgress = 0f
|
rippleShader.rawProgress = 0f
|
||||||
rippleShader.pixelDensity = resources.displayMetrics.density
|
rippleShader.pixelDensity = resources.displayMetrics.density
|
||||||
rippleShader.sparkleStrength = RIPPLE_SPARKLE_STRENGTH
|
rippleShader.sparkleStrength = RIPPLE_SPARKLE_STRENGTH
|
||||||
updateRippleFadeParams()
|
updateRippleFadeParams()
|
||||||
ripplePaint.shader = rippleShader
|
ripplePaint.shader = rippleShader
|
||||||
|
setLockScreenColor(0xffffffff.toInt()) // default color
|
||||||
|
|
||||||
dwellShader.color = 0xffffffff.toInt() // default color
|
dwellShader.color = 0xffffffff.toInt() // default color
|
||||||
dwellShader.progress = 0f
|
dwellShader.progress = 0f
|
||||||
@@ -111,10 +110,6 @@ class AuthRippleView(context: Context?, attrs: AttributeSet?) : View(context, at
|
|||||||
dwellRadius = sensorRadius * 1.5f
|
dwellRadius = sensorRadius * 1.5f
|
||||||
}
|
}
|
||||||
|
|
||||||
fun setAlphaInDuration(duration: Long) {
|
|
||||||
alphaInDuration = duration
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Animate dwell ripple inwards back to radius 0
|
* Animate dwell ripple inwards back to radius 0
|
||||||
*/
|
*/
|
||||||
@@ -253,7 +248,6 @@ class AuthRippleView(context: Context?, attrs: AttributeSet?) : View(context, at
|
|||||||
|
|
||||||
override fun onAnimationEnd(animation: Animator?) {
|
override fun onAnimationEnd(animation: Animator?) {
|
||||||
drawDwell = false
|
drawDwell = false
|
||||||
resetRippleAlpha()
|
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
start()
|
start()
|
||||||
@@ -277,22 +271,7 @@ class AuthRippleView(context: Context?, attrs: AttributeSet?) : View(context, at
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
val alphaInAnimator = ValueAnimator.ofInt(0, 62).apply {
|
unlockedRippleAnimator = rippleAnimator.apply {
|
||||||
duration = alphaInDuration
|
|
||||||
addUpdateListener { animator ->
|
|
||||||
rippleShader.color = ColorUtils.setAlphaComponent(
|
|
||||||
rippleShader.color,
|
|
||||||
animator.animatedValue as Int
|
|
||||||
)
|
|
||||||
invalidate()
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
unlockedRippleAnimator = AnimatorSet().apply {
|
|
||||||
playTogether(
|
|
||||||
rippleAnimator,
|
|
||||||
alphaInAnimator
|
|
||||||
)
|
|
||||||
addListener(object : AnimatorListenerAdapter() {
|
addListener(object : AnimatorListenerAdapter() {
|
||||||
override fun onAnimationStart(animation: Animator?) {
|
override fun onAnimationStart(animation: Animator?) {
|
||||||
drawRipple = true
|
drawRipple = true
|
||||||
@@ -310,17 +289,12 @@ class AuthRippleView(context: Context?, attrs: AttributeSet?) : View(context, at
|
|||||||
unlockedRippleAnimator?.start()
|
unlockedRippleAnimator?.start()
|
||||||
}
|
}
|
||||||
|
|
||||||
fun resetRippleAlpha() {
|
|
||||||
rippleShader.color = ColorUtils.setAlphaComponent(
|
|
||||||
rippleShader.color,
|
|
||||||
255
|
|
||||||
)
|
|
||||||
}
|
|
||||||
|
|
||||||
fun setLockScreenColor(color: Int) {
|
fun setLockScreenColor(color: Int) {
|
||||||
lockScreenColorVal = color
|
lockScreenColorVal = color
|
||||||
rippleShader.color = lockScreenColorVal
|
rippleShader.color = ColorUtils.setAlphaComponent(
|
||||||
resetRippleAlpha()
|
lockScreenColorVal,
|
||||||
|
62
|
||||||
|
)
|
||||||
}
|
}
|
||||||
|
|
||||||
fun updateDwellRippleColor(isDozing: Boolean) {
|
fun updateDwellRippleColor(isDozing: Boolean) {
|
||||||
|
|||||||
Reference in New Issue
Block a user