mirror of
https://github.com/FossifyOrg/Gallery.git
synced 2024-11-23 04:57:59 +01:00
properly handle instant slideshow transition without animations
This commit is contained in:
parent
304c4169a4
commit
af36fd45ad
1 changed files with 15 additions and 1 deletions
|
@ -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) {
|
private fun animatePagerTransition(forward: Boolean) {
|
||||||
val oldPosition = view_pager.currentItem
|
val oldPosition = view_pager.currentItem
|
||||||
val animator = ValueAnimator.ofInt(0, view_pager.width)
|
val animator = ValueAnimator.ofInt(0, view_pager.width)
|
||||||
|
@ -506,8 +516,12 @@ class ViewPagerActivity : SimpleActivity(), ViewPager.OnPageChangeListener, View
|
||||||
}
|
}
|
||||||
|
|
||||||
private fun swipeToNextMedium() {
|
private fun swipeToNextMedium() {
|
||||||
|
if (config.slideshowAnimation == SLIDESHOW_ANIMATION_NONE) {
|
||||||
|
goToNextMedium(!mSlideshowMoveBackwards)
|
||||||
|
} else {
|
||||||
animatePagerTransition(!mSlideshowMoveBackwards)
|
animatePagerTransition(!mSlideshowMoveBackwards)
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
private fun getMediaForSlideshow(): Boolean {
|
private fun getMediaForSlideshow(): Boolean {
|
||||||
mSlideshowMedia = mMediaFiles.filter {
|
mSlideshowMedia = mMediaFiles.filter {
|
||||||
|
|
Loading…
Reference in a new issue