From 6c16bdc444e99ea00d743c806daf4cdc4d6ce344 Mon Sep 17 00:00:00 2001 From: 2bllw8 <2bllw8@gmail.com> Date: Tue, 3 May 2022 10:14:59 +0200 Subject: [PATCH] Add isChild support to FileSystemProvider Issue #24 --- .../anemo/documents/provider/AnemoDocumentProvider.java | 1 + .../bbllw8/anemo/documents/provider/FileSystemProvider.java | 5 +++++ 2 files changed, 6 insertions(+) diff --git a/app/src/main/java/exe/bbllw8/anemo/documents/provider/AnemoDocumentProvider.java b/app/src/main/java/exe/bbllw8/anemo/documents/provider/AnemoDocumentProvider.java index b99a0fc..d735eb7 100644 --- a/app/src/main/java/exe/bbllw8/anemo/documents/provider/AnemoDocumentProvider.java +++ b/app/src/main/java/exe/bbllw8/anemo/documents/provider/AnemoDocumentProvider.java @@ -83,6 +83,7 @@ public Cursor queryRoots(String[] projection) { int flags = Root.FLAG_LOCAL_ONLY; flags |= Root.FLAG_SUPPORTS_CREATE; + flags |= Root.FLAG_SUPPORTS_IS_CHILD; flags |= DocumentsContract.Root.FLAG_SUPPORTS_EJECT; if (Build.VERSION.SDK_INT >= 29) { flags |= Root.FLAG_SUPPORTS_SEARCH; diff --git a/app/src/main/java/exe/bbllw8/anemo/documents/provider/FileSystemProvider.java b/app/src/main/java/exe/bbllw8/anemo/documents/provider/FileSystemProvider.java index 2f801a9..4166862 100644 --- a/app/src/main/java/exe/bbllw8/anemo/documents/provider/FileSystemProvider.java +++ b/app/src/main/java/exe/bbllw8/anemo/documents/provider/FileSystemProvider.java @@ -385,6 +385,11 @@ public FileVisitResult preVisitDirectory(Path dir, BasicFileAttributes attrs) return result; } + @Override + public boolean isChildDocument(String parentDocumentId, String documentId) { + return documentId.contains(parentDocumentId); + } + /** * Callback indicating that the given document has been modified. This gives the provider a hook * to invalidate cached data, such as {@code sdcardfs}.