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
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()

View File

@ -1004,7 +1004,7 @@ class ViewPagerActivity : SimpleActivity(), ViewPager.OnPageChangeListener, View
}
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) {
return
}