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 03cd4a0fa..444097363 100644 --- a/app/src/main/kotlin/com/simplemobiletools/gallery/activities/ViewPagerActivity.kt +++ b/app/src/main/kotlin/com/simplemobiletools/gallery/activities/ViewPagerActivity.kt @@ -428,7 +428,7 @@ class ViewPagerActivity : SimpleActivity(), ViewPager.OnPageChangeListener, View val dragOffset = dragPosition - oldDragPosition oldDragPosition = dragPosition try { - view_pager.fakeDragBy(dragOffset * (if (forward) 1f else -1f)) + view_pager.fakeDragBy(dragOffset * (if (forward) -1f else 1f)) } catch (e: Exception) { stopSlideshow() } @@ -444,9 +444,9 @@ class ViewPagerActivity : SimpleActivity(), ViewPager.OnPageChangeListener, View private fun slideshowEnded(forward: Boolean) { if (config.loopSlideshow) { if (forward) { - view_pager.setCurrentItem(0, false) - } else { view_pager.setCurrentItem(view_pager.adapter!!.count - 1, false) + } else { + view_pager.setCurrentItem(0, false) } } else { stopSlideshow()