From 8c47d9e5ba5924c79c0ba0a794a8ccf11d68129d Mon Sep 17 00:00:00 2001 From: tibbi Date: Tue, 31 May 2022 09:51:34 +0200 Subject: [PATCH] fixing a glitch with missing thumbnails at random sorting --- .../gallery/pro/activities/MediaActivity.kt | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/app/src/main/kotlin/com/simplemobiletools/gallery/pro/activities/MediaActivity.kt b/app/src/main/kotlin/com/simplemobiletools/gallery/pro/activities/MediaActivity.kt index 09914b4cd..e462d9e80 100644 --- a/app/src/main/kotlin/com/simplemobiletools/gallery/pro/activities/MediaActivity.kt +++ b/app/src/main/kotlin/com/simplemobiletools/gallery/pro/activities/MediaActivity.kt @@ -57,6 +57,7 @@ class MediaActivity : SimpleActivity(), MediaOperationsListener { private var mShowAll = false private var mLoadedInitialPhotos = false private var mIsSearchOpen = false + private var mWasFullscreenViewOpen = false private var mLastSearchedText = "" private var mLatestMediaId = 0L private var mLatestMediaDateId = 0L @@ -171,7 +172,9 @@ class MediaActivity : SimpleActivity(), MediaOperationsListener { 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()) { tryLoadGallery() } else { @@ -804,6 +807,7 @@ class MediaActivity : SimpleActivity(), MediaOperationsListener { } finish() } else { + mWasFullscreenViewOpen = true val isVideo = path.isVideoFast() if (isVideo) { val extras = HashMap()