|
@@ -144,14 +144,10 @@ internal class FilePicker {
|
|
}
|
|
}
|
|
// ACTION_OPEN_DOCUMENT_TREE does not support intent type
|
|
// ACTION_OPEN_DOCUMENT_TREE does not support intent type
|
|
if (fileMode != FILE_MODE_OPEN_DIR) {
|
|
if (fileMode != FILE_MODE_OPEN_DIR) {
|
|
- intent.type = "*/*"
|
|
|
|
- if (filters.isNotEmpty()) {
|
|
|
|
- val resolvedFilters = filters.map { resolveMimeType(it) }.distinct()
|
|
|
|
- if (resolvedFilters.size == 1) {
|
|
|
|
- intent.type = resolvedFilters[0]
|
|
|
|
- } else {
|
|
|
|
- intent.putExtra(Intent.EXTRA_MIME_TYPES, resolvedFilters.toTypedArray())
|
|
|
|
- }
|
|
|
|
|
|
+ val resolvedFilters = filters.map { resolveMimeType(it) }.distinct()
|
|
|
|
+ intent.type = resolvedFilters.firstOrNull { it != "application/octet-stream" } ?: "*/*"
|
|
|
|
+ if (resolvedFilters.size > 1) {
|
|
|
|
+ intent.putExtra(Intent.EXTRA_MIME_TYPES, resolvedFilters.toTypedArray())
|
|
}
|
|
}
|
|
intent.addCategory(Intent.CATEGORY_OPENABLE)
|
|
intent.addCategory(Intent.CATEGORY_OPENABLE)
|
|
}
|
|
}
|