aboutsummaryrefslogtreecommitdiff
path: root/app/src/main/java/org
diff options
context:
space:
mode:
authoreuxane2024-09-18 23:41:13 +0200
committereuxane2024-09-18 23:41:13 +0200
commit32d87010bbd053185be8b1c817499df310096c33 (patch)
tree49964bee5f1978adabc94ceeb94df07397e6b1ee /app/src/main/java/org
parent2c8f6a263eaea823b107c3d1c19999a8cd3d889d (diff)
downloadtincapp-32d87010bbd053185be8b1c817499df310096c33.tar.gz
browse files intent: remove flaky redundant activity resolver check
Diffstat (limited to 'app/src/main/java/org')
-rw-r--r--app/src/main/java/org/pacien/tincapp/storageprovider/BrowseFilesIntents.kt20
1 files changed, 8 insertions, 12 deletions
diff --git a/app/src/main/java/org/pacien/tincapp/storageprovider/BrowseFilesIntents.kt b/app/src/main/java/org/pacien/tincapp/storageprovider/BrowseFilesIntents.kt
index a4cc5c5..59a4246 100644
--- a/app/src/main/java/org/pacien/tincapp/storageprovider/BrowseFilesIntents.kt
+++ b/app/src/main/java/org/pacien/tincapp/storageprovider/BrowseFilesIntents.kt
@@ -27,15 +27,11 @@ object BrowseFilesIntents {
27 fun openDocumentTree(context: Context, documentId: String) = 27 fun openDocumentTree(context: Context, documentId: String) =
28 openDocumentTree(context, FilesDocumentsProvider.documentUri(documentId)) 28 openDocumentTree(context, FilesDocumentsProvider.documentUri(documentId))
29 29
30 private fun openDocumentTree(context: Context, contentUri: Uri) { 30 private fun openDocumentTree(context: Context, contentUri: Uri) =
31 val intent = Intent(Intent.ACTION_VIEW).apply { 31 context.startActivity(
32 setDataAndType(contentUri, Document.MIME_TYPE_DIR) 32 Intent(Intent.ACTION_VIEW).apply {
33 addFlags(Intent.FLAG_GRANT_READ_URI_PERMISSION or Intent.FLAG_GRANT_WRITE_URI_PERMISSION) 33 setDataAndType(contentUri, Document.MIME_TYPE_DIR)
34 } 34 addFlags(Intent.FLAG_GRANT_READ_URI_PERMISSION or Intent.FLAG_GRANT_WRITE_URI_PERMISSION)
35 35 }
36 if (intent.resolveActivity(context.packageManager) == null) 36 )
37 throw RuntimeException("No opener found for " + Document.MIME_TYPE_DIR) 37}
38
39 context.startActivity(intent)
40 }
41} \ No newline at end of file