ui: fix broken toolbar anims
This commit is contained in:
parent
9a01fe471e
commit
15121d28f6
3 changed files with 6 additions and 4 deletions
|
@ -63,7 +63,7 @@ class AnimatedMaterialButton : RippleFixMaterialButton {
|
|||
animator?.cancel()
|
||||
animator =
|
||||
anim
|
||||
.genericFloat(currentCornerRadiusRatio, targetRadius, ::updateCornerRadiusRatio)
|
||||
.genericFloat(currentCornerRadiusRatio, targetRadius, 0, ::updateCornerRadiusRatio)
|
||||
.also { it.start() }
|
||||
}
|
||||
|
||||
|
|
|
@ -29,11 +29,13 @@ data class Anim(val interpolator: TimeInterpolator, val duration: Long) {
|
|||
inline fun genericFloat(
|
||||
from: Float,
|
||||
to: Float,
|
||||
delayMs: Long = 0,
|
||||
crossinline update: (Float) -> Unit
|
||||
): ValueAnimator =
|
||||
ValueAnimator.ofFloat(from, to).apply {
|
||||
duration = duration
|
||||
interpolator = interpolator
|
||||
startDelay = delayMs
|
||||
duration = this@Anim.duration
|
||||
interpolator = this@Anim.interpolator
|
||||
addUpdateListener { update(animatedValue as Float) }
|
||||
}
|
||||
}
|
||||
|
|
|
@ -96,7 +96,7 @@ constructor(context: Context, attrs: AttributeSet? = null, @AttrRes defStyleAttr
|
|||
}
|
||||
}
|
||||
val inAnimator =
|
||||
inAnim.genericFloat(toView.alpha, 1f) {
|
||||
inAnim.genericFloat(toView.alpha, 1f, outAnim.duration) {
|
||||
toView.apply {
|
||||
scaleX = 1 - 0.05f * (1 - it)
|
||||
scaleY = 1 - 0.05f * (1 - it)
|
||||
|
|
Loading…
Reference in a new issue