mirror of
https://github.com/FossifyOrg/Gallery.git
synced 2024-11-27 06:57:59 +01:00
fix #1043, remove some glitches related to opening third party intents
This commit is contained in:
parent
ff9135c215
commit
124cb9334c
1 changed files with 12 additions and 7 deletions
|
@ -62,18 +62,23 @@ open class PhotoVideoActivity : SimpleActivity(), ViewPagerFragment.FragmentList
|
||||||
|
|
||||||
private fun checkIntent(savedInstanceState: Bundle? = null) {
|
private fun checkIntent(savedInstanceState: Bundle? = null) {
|
||||||
mUri = intent.data ?: return
|
mUri = intent.data ?: return
|
||||||
|
var filename = getFilenameFromUri(mUri!!)
|
||||||
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)
|
||||||
if (realPath?.getFilenameFromPath()?.contains('.') == true) {
|
if (realPath != null) {
|
||||||
sendViewPagerIntent(realPath)
|
if (realPath.getFilenameFromPath().contains('.') || filename.contains('.')) {
|
||||||
finish()
|
sendViewPagerIntent(realPath)
|
||||||
return
|
finish()
|
||||||
|
return
|
||||||
|
} else {
|
||||||
|
filename = realPath.getFilenameFromPath()
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
mIsFromGallery = intent.getBooleanExtra(IS_FROM_GALLERY, false)
|
mIsFromGallery = intent.getBooleanExtra(IS_FROM_GALLERY, false)
|
||||||
if (mUri!!.scheme == "file") {
|
if (mUri!!.scheme == "file") {
|
||||||
if (mUri!!.path?.getFilenameFromPath()?.contains('.') == true) {
|
if (filename.contains('.')) {
|
||||||
scanPathRecursively(mUri!!.path)
|
scanPathRecursively(mUri!!.path)
|
||||||
sendViewPagerIntent(mUri!!.path)
|
sendViewPagerIntent(mUri!!.path)
|
||||||
finish()
|
finish()
|
||||||
|
@ -81,7 +86,7 @@ open class PhotoVideoActivity : SimpleActivity(), ViewPagerFragment.FragmentList
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
val path = applicationContext.getRealPathFromURI(mUri!!) ?: ""
|
val path = applicationContext.getRealPathFromURI(mUri!!) ?: ""
|
||||||
if (path != mUri.toString() && path.isNotEmpty() && mUri!!.authority != "mms" && mUri!!.path.getFilenameFromPath().contains('.')) {
|
if (path != mUri.toString() && path.isNotEmpty() && mUri!!.authority != "mms" && filename.contains('.')) {
|
||||||
scanPathRecursively(mUri!!.path)
|
scanPathRecursively(mUri!!.path)
|
||||||
sendViewPagerIntent(path)
|
sendViewPagerIntent(path)
|
||||||
finish()
|
finish()
|
||||||
|
@ -97,7 +102,6 @@ open class PhotoVideoActivity : SimpleActivity(), ViewPagerFragment.FragmentList
|
||||||
showSystemUI(true)
|
showSystemUI(true)
|
||||||
val bundle = Bundle()
|
val bundle = Bundle()
|
||||||
val file = File(mUri.toString())
|
val file = File(mUri.toString())
|
||||||
val filename = getFilenameFromUri(mUri!!)
|
|
||||||
val type = when {
|
val type = when {
|
||||||
filename.isVideoFast() -> TYPE_VIDEOS
|
filename.isVideoFast() -> TYPE_VIDEOS
|
||||||
filename.isGif() -> TYPE_GIFS
|
filename.isGif() -> TYPE_GIFS
|
||||||
|
@ -106,6 +110,7 @@ open class PhotoVideoActivity : SimpleActivity(), ViewPagerFragment.FragmentList
|
||||||
else -> TYPE_IMAGES
|
else -> TYPE_IMAGES
|
||||||
}
|
}
|
||||||
|
|
||||||
|
mIsVideo = type == TYPE_VIDEOS
|
||||||
mMedium = Medium(null, filename, mUri.toString(), mUri!!.path.getParentPath(), 0, 0, file.length(), type, false, 0L)
|
mMedium = Medium(null, filename, mUri.toString(), mUri!!.path.getParentPath(), 0, 0, file.length(), type, false, 0L)
|
||||||
supportActionBar?.title = mMedium!!.name
|
supportActionBar?.title = mMedium!!.name
|
||||||
bundle.putSerializable(MEDIUM, mMedium)
|
bundle.putSerializable(MEDIUM, mMedium)
|
||||||
|
|
Loading…
Reference in a new issue