handle all third party intents like on nougat
This commit is contained in:
parent
557f752902
commit
9b793afd72
1 changed files with 2 additions and 7 deletions
|
@ -165,10 +165,7 @@ fun Activity.openEditor(uri: Uri, applicationId: String) {
|
||||||
action = Intent.ACTION_EDIT
|
action = Intent.ACTION_EDIT
|
||||||
setDataAndType(newUri, getMimeTypeFromUri(newUri))
|
setDataAndType(newUri, getMimeTypeFromUri(newUri))
|
||||||
addFlags(Intent.FLAG_GRANT_READ_URI_PERMISSION)
|
addFlags(Intent.FLAG_GRANT_READ_URI_PERMISSION)
|
||||||
|
putExtra(MediaStore.EXTRA_OUTPUT, uri)
|
||||||
if (isNougatPlus()) {
|
|
||||||
putExtra(MediaStore.EXTRA_OUTPUT, uri)
|
|
||||||
}
|
|
||||||
|
|
||||||
if (resolveActivity(packageManager) != null) {
|
if (resolveActivity(packageManager) != null) {
|
||||||
startActivityForResult(this, REQUEST_EDIT_IMAGE)
|
startActivityForResult(this, REQUEST_EDIT_IMAGE)
|
||||||
|
@ -190,9 +187,7 @@ fun Activity.openFile(uri: Uri, forceChooser: Boolean, applicationId: String) {
|
||||||
putExtra(IS_FROM_GALLERY, true)
|
putExtra(IS_FROM_GALLERY, true)
|
||||||
}
|
}
|
||||||
|
|
||||||
if (isNougatPlus()) {
|
putExtra(REAL_FILE_PATH, uri)
|
||||||
putExtra(REAL_FILE_PATH, uri)
|
|
||||||
}
|
|
||||||
|
|
||||||
if (resolveActivity(packageManager) != null) {
|
if (resolveActivity(packageManager) != null) {
|
||||||
val chooser = Intent.createChooser(this, getString(R.string.open_with))
|
val chooser = Intent.createChooser(this, getString(R.string.open_with))
|
||||||
|
|
Loading…
Reference in a new issue