Use mSlideShowMedia even after stopping random slideshow

As before, random order doesn't go away by itself until activity is restarted normally (without slideshow)
This commit is contained in:
Naveen 2022-09-24 01:20:08 +05:30
parent c05b351b9f
commit ff4a7d4bb4

View file

@ -80,6 +80,7 @@ class ViewPagerActivity : SimpleActivity(), ViewPager.OnPageChangeListener, View
private var mSlideshowMoveBackwards = false
private var mSlideshowMedia = mutableListOf<Medium>()
private var mAreSlideShowMediaVisible = false
private var mRandomSlideshowStopped = false
private var mIsOrientationLocked = false
@ -505,6 +506,7 @@ class ViewPagerActivity : SimpleActivity(), ViewPager.OnPageChangeListener, View
}
hideSystemUI(true)
mRandomSlideshowStopped = false
mSlideshowInterval = config.slideshowInterval
mSlideshowMoveBackwards = config.slideshowMoveBackwards
mIsSlideshowActive = true
@ -600,6 +602,10 @@ class ViewPagerActivity : SimpleActivity(), ViewPager.OnPageChangeListener, View
mSlideshowHandler.removeCallbacksAndMessages(null)
window.clearFlags(WindowManager.LayoutParams.FLAG_KEEP_SCREEN_ON)
mAreSlideShowMediaVisible = false
if (config.slideshowRandomOrder) {
mRandomSlideshowStopped = true
}
}
}
@ -1429,8 +1435,9 @@ class ViewPagerActivity : SimpleActivity(), ViewPager.OnPageChangeListener, View
private fun updateActionbarTitle() {
runOnUiThread {
if (mPos < getCurrentMedia().size) {
medium_viewer_toolbar.title = getCurrentMedia()[mPos].path.getFilenameFromPath()
val medium = getCurrentMedium()
if (medium != null) {
medium_viewer_toolbar.title = medium.path.getFilenameFromPath()
}
}
}
@ -1443,7 +1450,7 @@ class ViewPagerActivity : SimpleActivity(), ViewPager.OnPageChangeListener, View
}
}
private fun getCurrentMedia() = if (mAreSlideShowMediaVisible) mSlideshowMedia else mMediaFiles
private fun getCurrentMedia() = if (mAreSlideShowMediaVisible || mRandomSlideshowStopped) mSlideshowMedia else mMediaFiles
private fun getCurrentPath() = getCurrentMedium()?.path ?: ""