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.
This commit is contained in:
Max Lv
2017-12-30 15:04:04 +08:00
parent 56f4a36a18
commit a40f87f492
@@ -64,8 +64,7 @@ class MoveUpwardBehavior : CoordinatorLayout.Behavior<View> {
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
}
})