From 788885227ae54bbb95370f1632aa152621324146 Mon Sep 17 00:00:00 2001 From: tibbi Date: Sat, 28 Oct 2017 22:02:17 +0200 Subject: [PATCH] added a fake drag check at slideshow --- .../gallery/activities/ViewPagerActivity.kt | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/app/src/main/kotlin/com/simplemobiletools/gallery/activities/ViewPagerActivity.kt b/app/src/main/kotlin/com/simplemobiletools/gallery/activities/ViewPagerActivity.kt index d8d814da1..a99a66b4d 100644 --- a/app/src/main/kotlin/com/simplemobiletools/gallery/activities/ViewPagerActivity.kt +++ b/app/src/main/kotlin/com/simplemobiletools/gallery/activities/ViewPagerActivity.kt @@ -327,10 +327,12 @@ class ViewPagerActivity : SimpleActivity(), ViewPager.OnPageChangeListener, View animator.addUpdateListener(object : ValueAnimator.AnimatorUpdateListener { var oldDragPosition = 0 override fun onAnimationUpdate(animation: ValueAnimator) { - val dragPosition = animation.animatedValue as Int - val dragOffset = dragPosition - oldDragPosition - oldDragPosition = dragPosition - view_pager?.fakeDragBy(dragOffset * (if (forward) 1f else -1f)) + if (view_pager?.isFakeDragging == true) { + val dragPosition = animation.animatedValue as Int + val dragOffset = dragPosition - oldDragPosition + oldDragPosition = dragPosition + view_pager.fakeDragBy(dragOffset * (if (forward) 1f else -1f)) + } } })