fix #835, open files without extension at PhotoVideo activity

This commit is contained in:
tibbi 2018-10-28 23:04:09 +01:00
parent b53bd52adf
commit 9ed420daa1
2 changed files with 13 additions and 9 deletions

View File

@ -64,20 +64,24 @@ open class PhotoVideoActivity : SimpleActivity(), ViewPagerFragment.FragmentList
mUri = intent.data ?: return mUri = intent.data ?: return
if (intent.extras?.containsKey(REAL_FILE_PATH) == true) { if (intent.extras?.containsKey(REAL_FILE_PATH) == true) {
val realPath = intent.extras.getString(REAL_FILE_PATH) val realPath = intent.extras.getString(REAL_FILE_PATH)
sendViewPagerIntent(realPath) if (realPath?.getFilenameFromPath()?.contains('.') == true) {
finish() sendViewPagerIntent(realPath)
return finish()
return
}
} }
mIsFromGallery = intent.getBooleanExtra(IS_FROM_GALLERY, false) mIsFromGallery = intent.getBooleanExtra(IS_FROM_GALLERY, false)
if (mUri!!.scheme == "file") { if (mUri!!.scheme == "file") {
scanPathRecursively(mUri!!.path) if (mUri!!.path?.getFilenameFromPath()?.contains('.') == true) {
sendViewPagerIntent(mUri!!.path) scanPathRecursively(mUri!!.path)
finish() sendViewPagerIntent(mUri!!.path)
return finish()
return
}
} else { } else {
val path = applicationContext.getRealPathFromURI(mUri!!) ?: "" 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) scanPathRecursively(mUri!!.path)
sendViewPagerIntent(path) sendViewPagerIntent(path)
finish() finish()

View File

@ -1004,7 +1004,7 @@ class ViewPagerActivity : SimpleActivity(), ViewPager.OnPageChangeListener, View
} }
private fun gotMedia(thumbnailItems: ArrayList<ThumbnailItem>) { private fun gotMedia(thumbnailItems: ArrayList<ThumbnailItem>) {
val media = thumbnailItems.filter { it is Medium }.map { it as Medium } as ArrayList<Medium> val media = thumbnailItems.asSequence().filter { it is Medium }.map { it as Medium }.toMutableList() as ArrayList<Medium>
if (isDirEmpty(media) || media.hashCode() == mPrevHashcode) { if (isDirEmpty(media) || media.hashCode() == mPrevHashcode) {
return return
} }