From 962e805f2e5336749475962f6bb9f5b28cb67063 Mon Sep 17 00:00:00 2001 From: euxane Date: Wed, 18 Sep 2024 23:41:13 +0200 Subject: storageprovider: do not advertise virtual root dir non-writable --- .../org/pacien/tincapp/storageprovider/FilesDocumentsProvider.kt | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) (limited to 'app/src/main/java/org/pacien') 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() { MatrixCursor(projection ?: DEFAULT_DOCUMENT_PROJECTION).apply { when (parentDocumentId) { ROOT_DOCUMENT_ID -> { - addVirtualDirRow(VIRTUAL_ROOT_NETWORKS) - addVirtualDirRow(VIRTUAL_ROOT_LOG) + addVirtualDirRow(VIRTUAL_ROOT_NETWORKS, Document.FLAG_DIR_SUPPORTS_CREATE) + addVirtualDirRow(VIRTUAL_ROOT_LOG, Document.FLAG_DIR_SUPPORTS_CREATE) } else -> fileForDocumentId(parentDocumentId!!).listFiles()?.forEach { @@ -206,12 +206,12 @@ class FilesDocumentsProvider : DocumentsProvider() { ) } - private fun MatrixCursor.addVirtualDirRow(documentId: String) { + private fun MatrixCursor.addVirtualDirRow(documentId: String, flags: Int = 0) { addRow( Document.COLUMN_DOCUMENT_ID to documentId, Document.COLUMN_DISPLAY_NAME to documentId, Document.COLUMN_MIME_TYPE to Document.MIME_TYPE_DIR, - Document.COLUMN_FLAGS to Document.FLAG_DIR_SUPPORTS_CREATE, + Document.COLUMN_FLAGS to flags, ) } -- cgit v1.2.3