diff --git a/app/build.gradle b/app/build.gradle index 90615fc70..7a2458d65 100644 --- a/app/build.gradle +++ b/app/build.gradle @@ -61,7 +61,7 @@ android { } dependencies { - implementation 'com.simplemobiletools:commons:5.9.2' + implementation 'com.simplemobiletools:commons:5.9.3' implementation 'com.theartofdev.edmodo:android-image-cropper:2.8.0' implementation 'androidx.multidex:multidex:2.0.1' implementation 'it.sephiroth.android.exif:library:1.0.1' 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 c2f152b0f..11ba3692b 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 @@ -25,6 +25,7 @@ import com.simplemobiletools.commons.dialogs.ConfirmationDialog import com.simplemobiletools.commons.extensions.* import com.simplemobiletools.commons.helpers.PERMISSION_WRITE_STORAGE import com.simplemobiletools.commons.helpers.REQUEST_EDIT_IMAGE +import com.simplemobiletools.commons.helpers.SORT_BY_RANDOM import com.simplemobiletools.commons.models.FileDirItem import com.simplemobiletools.commons.views.MyGridLayoutManager import com.simplemobiletools.commons.views.MyRecyclerView @@ -152,10 +153,13 @@ class MediaActivity : SimpleActivity(), MediaOperationsListener { media_horizontal_fastscroller.allowBubbleDisplay = config.showInfoBubble media_vertical_fastscroller.allowBubbleDisplay = config.showInfoBubble media_refresh_layout.isEnabled = config.enablePullToRefresh - tryLoadGallery() invalidateOptionsMenu() media_empty_text_label.setTextColor(config.textColor) media_empty_text.setTextColor(getAdjustedPrimaryColor()) + + if (mMedia.isEmpty() || config.getFileSorting(mPath) and SORT_BY_RANDOM == 0) { + tryLoadGallery() + } } override fun onPause() { @@ -413,7 +417,7 @@ class MediaActivity : SimpleActivity(), MediaOperationsListener { } private fun checkLastMediaChanged() { - if (isDestroyed) { + if (isDestroyed || config.getFileSorting(mPath) and SORT_BY_RANDOM != 0) { return }