Skip to content

Commit

Permalink
Fix a rounding issue on Android 4.4
Browse files Browse the repository at this point in the history
We can use setTranslationY directly on Android 4.4. Otherwise, we need
to handle float to int routing issue very carefully.
  • Loading branch information
madeye committed Dec 30, 2017
1 parent 56f4a36 commit a40f87f
Showing 1 changed file with 1 addition and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -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
}
})
Expand Down

0 comments on commit a40f87f

Please sign in to comment.