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) {
if (view_pager?.isFakeDragging == true) {
val dragPosition = animation.animatedValue as Int val dragPosition = animation.animatedValue as Int
val dragOffset = dragPosition - oldDragPosition val dragOffset = dragPosition - oldDragPosition
oldDragPosition = dragPosition oldDragPosition = dragPosition
view_pager?.fakeDragBy(dragOffset * (if (forward) 1f else -1f)) view_pager.fakeDragBy(dragOffset * (if (forward) 1f else -1f))
}
} }
}) })