fixing a glitch with missing thumbnails at random sorting

This commit is contained in:
tibbi 2022-05-31 09:51:34 +02:00
parent 8cd32928aa
commit 8c47d9e5ba

View file

@ -57,6 +57,7 @@ class MediaActivity : SimpleActivity(), MediaOperationsListener {
private var mShowAll = false private var mShowAll = false
private var mLoadedInitialPhotos = false private var mLoadedInitialPhotos = false
private var mIsSearchOpen = false private var mIsSearchOpen = false
private var mWasFullscreenViewOpen = false
private var mLastSearchedText = "" private var mLastSearchedText = ""
private var mLatestMediaId = 0L private var mLatestMediaId = 0L
private var mLatestMediaDateId = 0L private var mLatestMediaDateId = 0L
@ -171,7 +172,9 @@ class MediaActivity : SimpleActivity(), MediaOperationsListener {
invalidateOptionsMenu() invalidateOptionsMenu()
} }
if (mMedia.isEmpty() || config.getFolderSorting(mPath) and SORT_BY_RANDOM == 0) { // do not refresh Random sorted files after opening a fullscreen image and going Back
val isRandomSorting = config.getFolderSorting(mPath) and SORT_BY_RANDOM != 0
if (mMedia.isEmpty() || !isRandomSorting || (isRandomSorting && !mWasFullscreenViewOpen)) {
if (shouldSkipAuthentication()) { if (shouldSkipAuthentication()) {
tryLoadGallery() tryLoadGallery()
} else { } else {
@ -804,6 +807,7 @@ class MediaActivity : SimpleActivity(), MediaOperationsListener {
} }
finish() finish()
} else { } else {
mWasFullscreenViewOpen = true
val isVideo = path.isVideoFast() val isVideo = path.isVideoFast()
if (isVideo) { if (isVideo) {
val extras = HashMap<String, Boolean>() val extras = HashMap<String, Boolean>()