properly handle instant slideshow transition without animations

This commit is contained in:
tibbi 2019-06-21 12:16:38 +02:00
parent 304c4169a4
commit af36fd45ad

View file

@ -411,6 +411,16 @@ class ViewPagerActivity : SimpleActivity(), ViewPager.OnPageChangeListener, View
}
}
private fun goToNextMedium(forward: Boolean) {
val oldPosition = view_pager.currentItem
val newPosition = if (forward) oldPosition + 1 else oldPosition - 1
if (newPosition == -1 || newPosition > view_pager.adapter!!.count - 1) {
slideshowEnded(forward)
} else {
view_pager.setCurrentItem(newPosition, false)
}
}
private fun animatePagerTransition(forward: Boolean) {
val oldPosition = view_pager.currentItem
val animator = ValueAnimator.ofInt(0, view_pager.width)
@ -506,8 +516,12 @@ class ViewPagerActivity : SimpleActivity(), ViewPager.OnPageChangeListener, View
}
private fun swipeToNextMedium() {
if (config.slideshowAnimation == SLIDESHOW_ANIMATION_NONE) {
goToNextMedium(!mSlideshowMoveBackwards)
} else {
animatePagerTransition(!mSlideshowMoveBackwards)
}
}
private fun getMediaForSlideshow(): Boolean {
mSlideshowMedia = mMediaFiles.filter {