allow importing both txt and json files

This commit is contained in:
tibbi 2023-07-31 19:24:45 +02:00
parent 03d0ea826b
commit 88100ea5ae

View File

@ -649,9 +649,11 @@ class MainActivity : SimpleActivity() {
} else { } else {
Intent(Intent.ACTION_OPEN_DOCUMENT).apply { Intent(Intent.ACTION_OPEN_DOCUMENT).apply {
addCategory(Intent.CATEGORY_OPENABLE) addCategory(Intent.CATEGORY_OPENABLE)
type = "text/*" type = "*/*"
try { try {
val mimetypes = arrayOf("text/*", "application/json")
putExtra(Intent.EXTRA_MIME_TYPES, mimetypes)
startActivityForResult(this, PICK_OPEN_FILE_INTENT) startActivityForResult(this, PICK_OPEN_FILE_INTENT)
} catch (e: ActivityNotFoundException) { } catch (e: ActivityNotFoundException) {
toast(R.string.system_service_disabled, Toast.LENGTH_LONG) toast(R.string.system_service_disabled, Toast.LENGTH_LONG)