fix: Trying to round NaN

This commit is contained in:
Ahmad Ansori Palembani 2024-06-06 08:00:58 +07:00
parent 902b6f6486
commit 2c76508c92
Signed by: null2264
GPG key ID: BA64F8B60AF3EFB6

View file

@ -86,10 +86,14 @@ class CrossFadeChangeHandler : AnimatorChangeHandler {
animatorSet.duration = if (isPush) {
200
} else {
from?.let {
val startX = from.width.toFloat() * 0.2f
((startX - it.x) / startX) * 150f
}?.roundToLong() ?: 150
try {
from?.let {
val startX = from.width.toFloat() * 0.2f
((startX - it.x) / startX) * 150f
}?.roundToLong()
} catch (e: IllegalArgumentException) {
null
} ?: 150
}
animatorSet.doOnCancel { to?.x = 0f }
animatorSet.doOnEnd { to?.x = 0f }