From b45f682e72c0b7747ac3ba0eb7365db25f26b0d6 Mon Sep 17 00:00:00 2001 From: tibbi Date: Tue, 31 May 2022 11:19:41 +0200 Subject: [PATCH] make sure we show the proper video at opening from Favorites --- .../gallery/pro/activities/ViewPagerActivity.kt | 4 ++-- 1 file changed, 2 insertions(+), 2 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 d76500082..ff4616c0c 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 @@ -134,7 +134,7 @@ class ViewPagerActivity : SimpleActivity(), ViewPager.OnPageChangeListener, View } // show the selected image asap, while loading the rest in the background to allow swiping between them. Needed at third party intents - if (mMediaFiles.isEmpty() && mPath.isNotEmpty()) { + if (mMediaFiles.isEmpty() && mPath.isNotEmpty() && mDirectory != FAVORITES) { getCachedMedia(mPath.getParentPath(), false, false) { thumbnailItems -> // if we have nothing cached from the given folder, at least show the selected image asap if (thumbnailItems.isEmpty()) { @@ -1263,7 +1263,7 @@ class ViewPagerActivity : SimpleActivity(), ViewPager.OnPageChangeListener, View if (refetchViewPagerPosition || mPos == -1) { mPos = getPositionInList(media) if (mPos == -1) { - Math.min(mPos, mMediaFiles.size - 1) + Math.min(mPos, media.size - 1) } }