Merge "Update auth ripple parameters" into tm-qpr-dev am: 5e46694365 am: 8999cf12bb

Original change: https://googleplex-android-review.googlesource.com/c/platform/frameworks/base/+/21915060

Change-Id: I53b5ca963685fd2f967e452222d7bd06bcedb61a
Signed-off-by: Automerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com>
This commit is contained in:
Beverly Tai
2023-03-10 18:05:30 +00:00
committed by Automerger Merge Worker
2 changed files with 16 additions and 14 deletions

View File

@@ -398,7 +398,7 @@ class AuthRippleController @Inject constructor(
}
companion object {
const val RIPPLE_ANIMATION_DURATION: Long = 1533
const val RIPPLE_ANIMATION_DURATION: Long = 800
const val TAG = "AuthRippleController"
}
}

View File

@@ -31,7 +31,7 @@ import com.android.internal.graphics.ColorUtils
import com.android.systemui.animation.Interpolators
import com.android.systemui.surfaceeffects.ripple.RippleShader
private const val RIPPLE_SPARKLE_STRENGTH: Float = 0.4f
private const val RIPPLE_SPARKLE_STRENGTH: Float = 0.3f
/**
* Handles two ripple effects: dwell ripple and unlocked ripple
@@ -75,8 +75,8 @@ class AuthRippleView(context: Context?, attrs: AttributeSet?) : View(context, at
}
private var radius: Float = 0f
set(value) {
rippleShader.rippleSize.setMaxSize(value * 2f, value * 2f)
field = value
field = value * .9f
rippleShader.rippleSize.setMaxSize(field * 2f, field * 2f)
}
private var origin: Point = Point()
set(value) {
@@ -87,8 +87,9 @@ class AuthRippleView(context: Context?, attrs: AttributeSet?) : View(context, at
init {
rippleShader.color = 0xffffffff.toInt() // default color
rippleShader.rawProgress = 0f
rippleShader.pixelDensity = resources.displayMetrics.density
rippleShader.sparkleStrength = RIPPLE_SPARKLE_STRENGTH
setupRippleFadeParams()
updateRippleFadeParams()
ripplePaint.shader = rippleShader
dwellShader.color = 0xffffffff.toInt() // default color
@@ -266,7 +267,6 @@ class AuthRippleView(context: Context?, attrs: AttributeSet?) : View(context, at
unlockedRippleAnimator?.cancel()
val rippleAnimator = ValueAnimator.ofFloat(0f, 1f).apply {
interpolator = Interpolators.LINEAR_OUT_SLOW_IN
duration = AuthRippleController.RIPPLE_ANIMATION_DURATION
addUpdateListener { animator ->
val now = animator.currentPlayTime
@@ -277,7 +277,7 @@ class AuthRippleView(context: Context?, attrs: AttributeSet?) : View(context, at
}
}
val alphaInAnimator = ValueAnimator.ofInt(0, 255).apply {
val alphaInAnimator = ValueAnimator.ofInt(0, 62).apply {
duration = alphaInDuration
addUpdateListener { animator ->
rippleShader.color = ColorUtils.setAlphaComponent(
@@ -339,15 +339,17 @@ class AuthRippleView(context: Context?, attrs: AttributeSet?) : View(context, at
)
}
private fun setupRippleFadeParams() {
private fun updateRippleFadeParams() {
with(rippleShader) {
baseRingFadeParams.fadeOutStart = RippleShader.DEFAULT_BASE_RING_FADE_OUT_START
baseRingFadeParams.fadeOutEnd = RippleShader.DEFAULT_FADE_OUT_END
baseRingFadeParams.fadeInStart = 0f
baseRingFadeParams.fadeInEnd = .2f
baseRingFadeParams.fadeOutStart = .2f
baseRingFadeParams.fadeOutEnd = 1f
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
centerFillFadeParams.fadeInStart = 0f
centerFillFadeParams.fadeInEnd = .15f
centerFillFadeParams.fadeOutStart = .15f
centerFillFadeParams.fadeOutEnd = .56f
}
}