diff --git a/app/src/main/kotlin/com/simplemobiletools/gallery/activities/PhotoVideoActivity.kt b/app/src/main/kotlin/com/simplemobiletools/gallery/activities/PhotoVideoActivity.kt index a0fdc7157..e3a243a53 100644 --- a/app/src/main/kotlin/com/simplemobiletools/gallery/activities/PhotoVideoActivity.kt +++ b/app/src/main/kotlin/com/simplemobiletools/gallery/activities/PhotoVideoActivity.kt @@ -64,20 +64,24 @@ open class PhotoVideoActivity : SimpleActivity(), ViewPagerFragment.FragmentList mUri = intent.data ?: return if (intent.extras?.containsKey(REAL_FILE_PATH) == true) { val realPath = intent.extras.getString(REAL_FILE_PATH) - sendViewPagerIntent(realPath) - finish() - return + if (realPath?.getFilenameFromPath()?.contains('.') == true) { + sendViewPagerIntent(realPath) + finish() + return + } } mIsFromGallery = intent.getBooleanExtra(IS_FROM_GALLERY, false) if (mUri!!.scheme == "file") { - scanPathRecursively(mUri!!.path) - sendViewPagerIntent(mUri!!.path) - finish() - return + if (mUri!!.path?.getFilenameFromPath()?.contains('.') == true) { + scanPathRecursively(mUri!!.path) + sendViewPagerIntent(mUri!!.path) + finish() + return + } } else { val path = applicationContext.getRealPathFromURI(mUri!!) ?: "" - if (path != mUri.toString() && path.isNotEmpty() && mUri!!.authority != "mms") { + if (path != mUri.toString() && path.isNotEmpty() && mUri!!.authority != "mms" && mUri!!.path.getFilenameFromPath().contains('.')) { scanPathRecursively(mUri!!.path) sendViewPagerIntent(path) finish() diff --git a/app/src/main/kotlin/com/simplemobiletools/gallery/activities/ViewPagerActivity.kt b/app/src/main/kotlin/com/simplemobiletools/gallery/activities/ViewPagerActivity.kt index 1a50a42a4..d7f5812a4 100644 --- a/app/src/main/kotlin/com/simplemobiletools/gallery/activities/ViewPagerActivity.kt +++ b/app/src/main/kotlin/com/simplemobiletools/gallery/activities/ViewPagerActivity.kt @@ -1004,7 +1004,7 @@ class ViewPagerActivity : SimpleActivity(), ViewPager.OnPageChangeListener, View } private fun gotMedia(thumbnailItems: ArrayList) { - val media = thumbnailItems.filter { it is Medium }.map { it as Medium } as ArrayList + val media = thumbnailItems.asSequence().filter { it is Medium }.map { it as Medium }.toMutableList() as ArrayList if (isDirEmpty(media) || media.hashCode() == mPrevHashcode) { return }