From bccf86a1bf3e01bd336e967ed93e53e4ab1dea75 Mon Sep 17 00:00:00 2001 From: Naveen Date: Mon, 4 Jul 2022 17:42:50 +0530 Subject: [PATCH] Enable random sorting for external intents --- .../gallery/pro/activities/ViewPagerActivity.kt | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/app/src/main/kotlin/com/simplemobiletools/gallery/pro/activities/ViewPagerActivity.kt b/app/src/main/kotlin/com/simplemobiletools/gallery/pro/activities/ViewPagerActivity.kt index a52545aff..659756c1d 100644 --- a/app/src/main/kotlin/com/simplemobiletools/gallery/pro/activities/ViewPagerActivity.kt +++ b/app/src/main/kotlin/com/simplemobiletools/gallery/pro/activities/ViewPagerActivity.kt @@ -1228,7 +1228,9 @@ class ViewPagerActivity : SimpleActivity(), ViewPager.OnPageChangeListener, View } private fun refreshViewPager(refetchPosition: Boolean = false) { - if (config.getFolderSorting(mDirectory) and SORT_BY_RANDOM == 0) { + val isSortingRandom = config.getFolderSorting(mDirectory) and SORT_BY_RANDOM == 0 + val isExternalIntent = !intent.getBooleanExtra(IS_FROM_GALLERY, false) + if (!isSortingRandom || isExternalIntent) { GetMediaAsynctask(applicationContext, mDirectory, isPickImage = false, isPickVideo = false, showAll = mShowAll) { gotMedia(it, refetchViewPagerPosition = refetchPosition) }.execute()