Commit a40f87f4 authored by Max Lv's avatar Max Lv

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.
parent 56f4a36a
...@@ -64,8 +64,7 @@ class MoveUpwardBehavior : CoordinatorLayout.Behavior<View> { ...@@ -64,8 +64,7 @@ class MoveUpwardBehavior : CoordinatorLayout.Behavior<View> {
override fun onAnimationUpdate(animator: ValueAnimator) { override fun onAnimationUpdate(animator: ValueAnimator) {
val currentValue = animator.animatedValue as Float val currentValue = animator.animatedValue as Float
if (Build.VERSION.SDK_INT > 19) child.translationY = currentValue child.translationY = currentValue
else ViewCompat.offsetTopAndBottom(child, (currentValue - previousValue).toInt())
previousValue = currentValue previousValue = currentValue
} }
}) })
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment