allow sending some extras at OpenPath intent

This commit is contained in:
tibbi 2019-08-10 21:19:14 +02:00
parent b673812520
commit 8388415c7b
2 changed files with 6 additions and 2 deletions

View file

@ -7,7 +7,7 @@ buildscript {
propMinSdkVersion = 21
propTargetSdkVersion = propCompileSdkVersion
propVersionCode = 1
propVersionName = '5.15.31'
propVersionName = '5.15.32'
kotlin_version = '1.3.41'
}

View file

@ -290,7 +290,7 @@ fun Activity.openEditorIntent(path: String, forceChooser: Boolean, applicationId
}
}
fun Activity.openPathIntent(path: String, forceChooser: Boolean, applicationId: String, forceMimeType: String = "") {
fun Activity.openPathIntent(path: String, forceChooser: Boolean, applicationId: String, forceMimeType: String = "", extras: HashMap<String, Boolean>) {
ensureBackgroundThread {
val newUri = getFinalUriFromPath(path, applicationId) ?: return@ensureBackgroundThread
val mimeType = if (forceMimeType.isNotEmpty()) forceMimeType else getUriMimeType(path, newUri)
@ -303,6 +303,10 @@ fun Activity.openPathIntent(path: String, forceChooser: Boolean, applicationId:
putExtra(IS_FROM_GALLERY, true)
}
for ((key, value) in extras) {
putExtra(key, value)
}
putExtra(REAL_FILE_PATH, path)
if (resolveActivity(packageManager) != null) {