aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authoreuxane2024-09-18 23:41:13 +0200
committereuxane2024-09-18 23:41:13 +0200
commit962e805f2e5336749475962f6bb9f5b28cb67063 (patch)
treeba21f0fd4f43312301ac66d8e36655db50f15cc5
parent318a57b80054c7c47f49acc088bc454d16338892 (diff)
downloadtincapp-962e805f2e5336749475962f6bb9f5b28cb67063.tar.gz
storageprovider: do not advertise virtual root dir non-writable
-rw-r--r--app/src/main/java/org/pacien/tincapp/storageprovider/FilesDocumentsProvider.kt8
1 files changed, 4 insertions, 4 deletions
diff --git a/app/src/main/java/org/pacien/tincapp/storageprovider/FilesDocumentsProvider.kt b/app/src/main/java/org/pacien/tincapp/storageprovider/FilesDocumentsProvider.kt
index 07ffaca..38cd562 100644
--- a/app/src/main/java/org/pacien/tincapp/storageprovider/FilesDocumentsProvider.kt
+++ b/app/src/main/java/org/pacien/tincapp/storageprovider/FilesDocumentsProvider.kt
@@ -94,8 +94,8 @@ class FilesDocumentsProvider : DocumentsProvider() {
94 MatrixCursor(projection ?: DEFAULT_DOCUMENT_PROJECTION).apply { 94 MatrixCursor(projection ?: DEFAULT_DOCUMENT_PROJECTION).apply {
95 when (parentDocumentId) { 95 when (parentDocumentId) {
96 ROOT_DOCUMENT_ID -> { 96 ROOT_DOCUMENT_ID -> {
97 addVirtualDirRow(VIRTUAL_ROOT_NETWORKS) 97 addVirtualDirRow(VIRTUAL_ROOT_NETWORKS, Document.FLAG_DIR_SUPPORTS_CREATE)
98 addVirtualDirRow(VIRTUAL_ROOT_LOG) 98 addVirtualDirRow(VIRTUAL_ROOT_LOG, Document.FLAG_DIR_SUPPORTS_CREATE)
99 } 99 }
100 100
101 else -> fileForDocumentId(parentDocumentId!!).listFiles()?.forEach { 101 else -> fileForDocumentId(parentDocumentId!!).listFiles()?.forEach {
@@ -206,12 +206,12 @@ class FilesDocumentsProvider : DocumentsProvider() {
206 ) 206 )
207 } 207 }
208 208
209 private fun MatrixCursor.addVirtualDirRow(documentId: String) { 209 private fun MatrixCursor.addVirtualDirRow(documentId: String, flags: Int = 0) {
210 addRow( 210 addRow(
211 Document.COLUMN_DOCUMENT_ID to documentId, 211 Document.COLUMN_DOCUMENT_ID to documentId,
212 Document.COLUMN_DISPLAY_NAME to documentId, 212 Document.COLUMN_DISPLAY_NAME to documentId,
213 Document.COLUMN_MIME_TYPE to Document.MIME_TYPE_DIR, 213 Document.COLUMN_MIME_TYPE to Document.MIME_TYPE_DIR,
214 Document.COLUMN_FLAGS to Document.FLAG_DIR_SUPPORTS_CREATE, 214 Document.COLUMN_FLAGS to flags,
215 ) 215 )
216 } 216 }
217 217