From a40f87f49265aa77811e84a563d9d3dbad66dcff Mon Sep 17 00:00:00 2001 From: Max Lv Date: Sat, 30 Dec 2017 15:04:04 +0800 Subject: [PATCH] Fix a rounding issue on Android 4.4 We can use setTranslationY directly on Android 4.4. Otherwise, we need to handle float to int routing issue very carefully. --- .../java/com/github/shadowsocks/widget/MoveUpwardBehavior.kt | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/mobile/src/main/java/com/github/shadowsocks/widget/MoveUpwardBehavior.kt b/mobile/src/main/java/com/github/shadowsocks/widget/MoveUpwardBehavior.kt index 1e5b14e0..5f508141 100644 --- a/mobile/src/main/java/com/github/shadowsocks/widget/MoveUpwardBehavior.kt +++ b/mobile/src/main/java/com/github/shadowsocks/widget/MoveUpwardBehavior.kt @@ -64,8 +64,7 @@ class MoveUpwardBehavior : CoordinatorLayout.Behavior { override fun onAnimationUpdate(animator: ValueAnimator) { val currentValue = animator.animatedValue as Float - if (Build.VERSION.SDK_INT > 19) child.translationY = currentValue - else ViewCompat.offsetTopAndBottom(child, (currentValue - previousValue).toInt()) + child.translationY = currentValue previousValue = currentValue } })