fix #1474, improve the handling of third party intents and type filters
This commit is contained in:
parent
b1f2ab8a13
commit
bf7b0d0386
1 changed files with 20 additions and 7 deletions
|
@ -97,9 +97,11 @@ open class PhotoVideoActivity : SimpleActivity(), ViewPagerFragment.FragmentList
|
|||
val realPath = intent.extras!!.getString(REAL_FILE_PATH)
|
||||
if (realPath != null && File(realPath).exists()) {
|
||||
if (realPath.getFilenameFromPath().contains('.') || filename.contains('.')) {
|
||||
if (isFileTypeVisible(realPath)) {
|
||||
sendViewPagerIntent(realPath)
|
||||
finish()
|
||||
return
|
||||
}
|
||||
} else {
|
||||
filename = realPath.getFilenameFromPath()
|
||||
}
|
||||
|
@ -116,12 +118,14 @@ open class PhotoVideoActivity : SimpleActivity(), ViewPagerFragment.FragmentList
|
|||
} else {
|
||||
val path = applicationContext.getRealPathFromURI(mUri!!) ?: ""
|
||||
if (path != mUri.toString() && path.isNotEmpty() && mUri!!.authority != "mms" && filename.contains('.') && File(path).exists()) {
|
||||
if (isFileTypeVisible(path)) {
|
||||
rescanPaths(arrayListOf(mUri!!.path))
|
||||
sendViewPagerIntent(path)
|
||||
finish()
|
||||
return
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
checkNotchSupport()
|
||||
showSystemUI(true)
|
||||
|
@ -253,6 +257,15 @@ open class PhotoVideoActivity : SimpleActivity(), ViewPagerFragment.FragmentList
|
|||
PropertiesDialog(this, mUri!!.path)
|
||||
}
|
||||
|
||||
private fun isFileTypeVisible(path: String): Boolean {
|
||||
val filter = config.filterMedia
|
||||
return !(path.isImageFast() && filter and TYPE_IMAGES == 0 ||
|
||||
path.isVideoFast() && filter and TYPE_VIDEOS == 0 ||
|
||||
path.isGif() && filter and TYPE_GIFS == 0 ||
|
||||
path.isRawFast() && filter and TYPE_RAWS == 0 ||
|
||||
path.isSvg() && filter and TYPE_SVGS == 0)
|
||||
}
|
||||
|
||||
private fun initBottomActions() {
|
||||
initBottomActionsLayout()
|
||||
initBottomActionButtons()
|
||||
|
|
Loading…
Reference in a new issue