|
|
@ -57,15 +57,13 @@ class DialogPlugin(private val activity: Activity): Plugin(activity) {
|
|
|
|
val args = invoke.parseArgs(FilePickerOptions::class.java)
|
|
|
|
val args = invoke.parseArgs(FilePickerOptions::class.java)
|
|
|
|
val parsedTypes = parseFiltersOption(args.filters)
|
|
|
|
val parsedTypes = parseFiltersOption(args.filters)
|
|
|
|
|
|
|
|
|
|
|
|
val intent = if (parsedTypes.isNotEmpty()) {
|
|
|
|
// TODO: ACTION_OPEN_DOCUMENT ??
|
|
|
|
val intent = Intent(Intent.ACTION_PICK)
|
|
|
|
|
|
|
|
setIntentMimeTypes(intent, parsedTypes)
|
|
|
|
|
|
|
|
intent
|
|
|
|
|
|
|
|
} else {
|
|
|
|
|
|
|
|
val intent = Intent(Intent.ACTION_GET_CONTENT)
|
|
|
|
val intent = Intent(Intent.ACTION_GET_CONTENT)
|
|
|
|
intent.addCategory(Intent.CATEGORY_OPENABLE)
|
|
|
|
intent.addCategory(Intent.CATEGORY_OPENABLE)
|
|
|
|
intent.type = "*/*"
|
|
|
|
intent.type = "*/*"
|
|
|
|
intent
|
|
|
|
|
|
|
|
|
|
|
|
if (parsedTypes.isNotEmpty()) {
|
|
|
|
|
|
|
|
intent.putExtra(Intent.EXTRA_MIME_TYPES, parsedTypes)
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
intent.putExtra(Intent.EXTRA_ALLOW_MULTIPLE, args.multiple ?: false)
|
|
|
|
intent.putExtra(Intent.EXTRA_ALLOW_MULTIPLE, args.multiple ?: false)
|
|
|
|