added a fake drag check at slideshow

This commit is contained in:
tibbi 2017-10-28 22:02:17 +02:00
parent 4d913527f5
commit 788885227a

View file

@ -327,10 +327,12 @@ class ViewPagerActivity : SimpleActivity(), ViewPager.OnPageChangeListener, View
animator.addUpdateListener(object : ValueAnimator.AnimatorUpdateListener { animator.addUpdateListener(object : ValueAnimator.AnimatorUpdateListener {
var oldDragPosition = 0 var oldDragPosition = 0
override fun onAnimationUpdate(animation: ValueAnimator) { override fun onAnimationUpdate(animation: ValueAnimator) {
val dragPosition = animation.animatedValue as Int if (view_pager?.isFakeDragging == true) {
val dragOffset = dragPosition - oldDragPosition val dragPosition = animation.animatedValue as Int
oldDragPosition = dragPosition val dragOffset = dragPosition - oldDragPosition
view_pager?.fakeDragBy(dragOffset * (if (forward) 1f else -1f)) oldDragPosition = dragPosition
view_pager.fakeDragBy(dragOffset * (if (forward) 1f else -1f))
}
} }
}) })