From be3ee0de8d9f4043fffa84db4a9edc5912eeae83 Mon Sep 17 00:00:00 2001 From: Naveen Date: Mon, 4 Jul 2022 18:07:42 +0530 Subject: [PATCH] Enable refreshing for external intents even when video is playing --- .../gallery/pro/activities/ViewPagerActivity.kt | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) 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 659756c1d..c2bd43f79 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 @@ -1229,8 +1229,7 @@ class ViewPagerActivity : SimpleActivity(), ViewPager.OnPageChangeListener, View private fun refreshViewPager(refetchPosition: Boolean = false) { val isSortingRandom = config.getFolderSorting(mDirectory) and SORT_BY_RANDOM == 0 - val isExternalIntent = !intent.getBooleanExtra(IS_FROM_GALLERY, false) - if (!isSortingRandom || isExternalIntent) { + if (!isSortingRandom || isExternalIntent()) { GetMediaAsynctask(applicationContext, mDirectory, isPickImage = false, isPickVideo = false, showAll = mShowAll) { gotMedia(it, refetchViewPagerPosition = refetchPosition) }.execute() @@ -1246,7 +1245,8 @@ class ViewPagerActivity : SimpleActivity(), ViewPager.OnPageChangeListener, View return } - if (!ignorePlayingVideos && (getCurrentFragment() as? VideoFragment)?.mIsPlaying == true) { + val isPlaying = (getCurrentFragment() as? VideoFragment)?.mIsPlaying == true + if (!ignorePlayingVideos && isPlaying && !isExternalIntent()) { return } @@ -1438,4 +1438,8 @@ class ViewPagerActivity : SimpleActivity(), ViewPager.OnPageChangeListener, View checkOrientation() } } + + private fun isExternalIntent(): Boolean { + return !intent.getBooleanExtra(IS_FROM_GALLERY, false) + } }