Merge "Update auth ripple parameters" into tm-qpr-dev
This commit is contained in:
@@ -397,7 +397,7 @@ class AuthRippleController @Inject constructor(
|
|||||||
}
|
}
|
||||||
|
|
||||||
companion object {
|
companion object {
|
||||||
const val RIPPLE_ANIMATION_DURATION: Long = 1533
|
const val RIPPLE_ANIMATION_DURATION: Long = 800
|
||||||
const val TAG = "AuthRippleController"
|
const val TAG = "AuthRippleController"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -31,7 +31,7 @@ import com.android.internal.graphics.ColorUtils
|
|||||||
import com.android.systemui.animation.Interpolators
|
import com.android.systemui.animation.Interpolators
|
||||||
import com.android.systemui.surfaceeffects.ripple.RippleShader
|
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
|
* 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
|
private var radius: Float = 0f
|
||||||
set(value) {
|
set(value) {
|
||||||
rippleShader.rippleSize.setMaxSize(value * 2f, value * 2f)
|
field = value * .9f
|
||||||
field = value
|
rippleShader.rippleSize.setMaxSize(field * 2f, field * 2f)
|
||||||
}
|
}
|
||||||
private var origin: Point = Point()
|
private var origin: Point = Point()
|
||||||
set(value) {
|
set(value) {
|
||||||
@@ -87,8 +87,9 @@ class AuthRippleView(context: Context?, attrs: AttributeSet?) : View(context, at
|
|||||||
init {
|
init {
|
||||||
rippleShader.color = 0xffffffff.toInt() // default color
|
rippleShader.color = 0xffffffff.toInt() // default color
|
||||||
rippleShader.rawProgress = 0f
|
rippleShader.rawProgress = 0f
|
||||||
|
rippleShader.pixelDensity = resources.displayMetrics.density
|
||||||
rippleShader.sparkleStrength = RIPPLE_SPARKLE_STRENGTH
|
rippleShader.sparkleStrength = RIPPLE_SPARKLE_STRENGTH
|
||||||
setupRippleFadeParams()
|
updateRippleFadeParams()
|
||||||
ripplePaint.shader = rippleShader
|
ripplePaint.shader = rippleShader
|
||||||
|
|
||||||
dwellShader.color = 0xffffffff.toInt() // default color
|
dwellShader.color = 0xffffffff.toInt() // default color
|
||||||
@@ -266,7 +267,6 @@ class AuthRippleView(context: Context?, attrs: AttributeSet?) : View(context, at
|
|||||||
unlockedRippleAnimator?.cancel()
|
unlockedRippleAnimator?.cancel()
|
||||||
|
|
||||||
val rippleAnimator = ValueAnimator.ofFloat(0f, 1f).apply {
|
val rippleAnimator = ValueAnimator.ofFloat(0f, 1f).apply {
|
||||||
interpolator = Interpolators.LINEAR_OUT_SLOW_IN
|
|
||||||
duration = AuthRippleController.RIPPLE_ANIMATION_DURATION
|
duration = AuthRippleController.RIPPLE_ANIMATION_DURATION
|
||||||
addUpdateListener { animator ->
|
addUpdateListener { animator ->
|
||||||
val now = animator.currentPlayTime
|
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
|
duration = alphaInDuration
|
||||||
addUpdateListener { animator ->
|
addUpdateListener { animator ->
|
||||||
rippleShader.color = ColorUtils.setAlphaComponent(
|
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) {
|
with(rippleShader) {
|
||||||
baseRingFadeParams.fadeOutStart = RippleShader.DEFAULT_BASE_RING_FADE_OUT_START
|
baseRingFadeParams.fadeInStart = 0f
|
||||||
baseRingFadeParams.fadeOutEnd = RippleShader.DEFAULT_FADE_OUT_END
|
baseRingFadeParams.fadeInEnd = .2f
|
||||||
|
baseRingFadeParams.fadeOutStart = .2f
|
||||||
|
baseRingFadeParams.fadeOutEnd = 1f
|
||||||
|
|
||||||
centerFillFadeParams.fadeInStart = RippleShader.DEFAULT_FADE_IN_START
|
centerFillFadeParams.fadeInStart = 0f
|
||||||
centerFillFadeParams.fadeInEnd = RippleShader.DEFAULT_CENTER_FILL_FADE_IN_END
|
centerFillFadeParams.fadeInEnd = .15f
|
||||||
centerFillFadeParams.fadeOutStart = RippleShader.DEFAULT_CENTER_FILL_FADE_OUT_START
|
centerFillFadeParams.fadeOutStart = .15f
|
||||||
centerFillFadeParams.fadeOutEnd = RippleShader.DEFAULT_CENTER_FILL_FADE_OUT_END
|
centerFillFadeParams.fadeOutEnd = .56f
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user