Improve keyboard hiding animation

This commit is contained in:
Suphon Thanakornpakapong
2021-10-09 13:49:06 +07:00
parent 79562aee35
commit 3e8265ec39
2 changed files with 6 additions and 4 deletions
@@ -38,7 +38,7 @@ class SearchBarInsetsHandler(private val shiftRange: Float) : WindowInsetsAnimat
)
}
fun onAnimationEnd(isSuccess: Boolean) {
animationController?.finish(!isSuccess)
fun onAnimationEnd() {
animationController?.finish(progress.value < 0.5f)
}
}
@@ -42,8 +42,10 @@ class SearchBarStateHandler(private val launcher: LawnchairLauncher) : StateMana
)
animation.setFloat(handler.progress, AnimatedFloat.VALUE, 1f, Interpolators.LINEAR)
animation.runOnEnd { isSuccess ->
handler.onAnimationEnd(isSuccess)
cancellationSignal.cancel()
if (isSuccess) {
handler.onAnimationEnd()
cancellationSignal.cancel()
}
}
}
if (launcher.isInState(LauncherState.NORMAL) && toState == LauncherState.ALL_APPS) {