diff options
Diffstat (limited to 'app/src/main/java/org')
-rw-r--r-- | app/src/main/java/org/pacien/tincapp/storageprovider/BrowseFilesIntents.kt | 20 |
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 | ||