mirror of
https://github.com/FossifyOrg/Gallery.git
synced 2024-11-23 04:57:59 +01:00
fix #1274, be more creative at retrieving file path from third party intents
This commit is contained in:
parent
81abbe82ad
commit
15485fa183
1 changed files with 11 additions and 1 deletions
|
@ -68,6 +68,16 @@ open class PhotoVideoActivity : SimpleActivity(), ViewPagerFragment.FragmentList
|
|||
|
||||
private fun checkIntent(savedInstanceState: Bundle? = null) {
|
||||
mUri = intent.data ?: return
|
||||
val uri = mUri.toString()
|
||||
if (uri.startsWith("content:/") && uri.contains("/storage/")) {
|
||||
val guessedPath = uri.substring(uri.indexOf("/storage/"))
|
||||
val extras = intent.extras ?: Bundle()
|
||||
extras.apply {
|
||||
putString(REAL_FILE_PATH, guessedPath)
|
||||
intent.putExtras(this)
|
||||
}
|
||||
}
|
||||
|
||||
var filename = getFilenameFromUri(mUri!!)
|
||||
mIsFromGallery = intent.getBooleanExtra(IS_FROM_GALLERY, false)
|
||||
if (mIsFromGallery && filename.isVideoFast() && config.openVideosOnSeparateScreen) {
|
||||
|
@ -76,7 +86,7 @@ open class PhotoVideoActivity : SimpleActivity(), ViewPagerFragment.FragmentList
|
|||
}
|
||||
|
||||
if (intent.extras?.containsKey(REAL_FILE_PATH) == true) {
|
||||
val realPath = intent.extras.getString(REAL_FILE_PATH)
|
||||
val realPath = intent.extras!!.getString(REAL_FILE_PATH)
|
||||
if (realPath != null) {
|
||||
if (realPath.getFilenameFromPath().contains('.') || filename.contains('.')) {
|
||||
sendViewPagerIntent(realPath)
|
||||
|
|
Loading…
Reference in a new issue