Merge "Migrate AuthRippleView to use RippleShader#FadeParams to deprecate rippleFill." into tm-qpr-dev

This commit is contained in:
Yein Jo
2023-02-07 02:15:04 +00:00
committed by Android (Google) Code Review

View File

@@ -88,6 +88,7 @@ class AuthRippleView(context: Context?, attrs: AttributeSet?) : View(context, at
rippleShader.color = 0xffffffff.toInt() // default color rippleShader.color = 0xffffffff.toInt() // default color
rippleShader.rawProgress = 0f rippleShader.rawProgress = 0f
rippleShader.sparkleStrength = RIPPLE_SPARKLE_STRENGTH rippleShader.sparkleStrength = RIPPLE_SPARKLE_STRENGTH
setupRippleFadeParams()
ripplePaint.shader = rippleShader ripplePaint.shader = rippleShader
dwellShader.color = 0xffffffff.toInt() // default color dwellShader.color = 0xffffffff.toInt() // default color
@@ -294,7 +295,6 @@ class AuthRippleView(context: Context?, attrs: AttributeSet?) : View(context, at
) )
addListener(object : AnimatorListenerAdapter() { addListener(object : AnimatorListenerAdapter() {
override fun onAnimationStart(animation: Animator?) { override fun onAnimationStart(animation: Animator?) {
rippleShader.rippleFill = false
drawRipple = true drawRipple = true
visibility = VISIBLE visibility = VISIBLE
} }
@@ -339,6 +339,18 @@ class AuthRippleView(context: Context?, attrs: AttributeSet?) : View(context, at
) )
} }
private fun setupRippleFadeParams() {
with(rippleShader) {
baseRingFadeParams.fadeOutStart = RippleShader.DEFAULT_BASE_RING_FADE_OUT_START
baseRingFadeParams.fadeOutEnd = RippleShader.DEFAULT_FADE_OUT_END
centerFillFadeParams.fadeInStart = RippleShader.DEFAULT_FADE_IN_START
centerFillFadeParams.fadeInEnd = RippleShader.DEFAULT_CENTER_FILL_FADE_IN_END
centerFillFadeParams.fadeOutStart = RippleShader.DEFAULT_CENTER_FILL_FADE_OUT_START
centerFillFadeParams.fadeOutEnd = RippleShader.DEFAULT_CENTER_FILL_FADE_OUT_END
}
}
override fun onDraw(canvas: Canvas?) { override fun onDraw(canvas: Canvas?) {
// To reduce overdraw, we mask the effect to a circle whose radius is big enough to cover // To reduce overdraw, we mask the effect to a circle whose radius is big enough to cover
// the active effect area. Values here should be kept in sync with the // the active effect area. Values here should be kept in sync with the