mirror of
https://github.com/AngelAuraMC/Amethyst-Android.git
synced 2025-09-18 17:15:40 -04:00
Fix the FolderProvider findDocumentPath implementation to make paths actually visible
This commit is contained in:
parent
2293664bd4
commit
1f28b3a6a7
@ -1 +1 @@
|
|||||||
1665886806915
|
1674881685730
|
@ -313,6 +313,15 @@ public class FolderProvider extends DocumentsProvider {
|
|||||||
public DocumentsContract.Path findDocumentPath(@Nullable String parentDocumentId, String childDocumentId) throws FileNotFoundException {
|
public DocumentsContract.Path findDocumentPath(@Nullable String parentDocumentId, String childDocumentId) throws FileNotFoundException {
|
||||||
File source = BASE_DIR;
|
File source = BASE_DIR;
|
||||||
if(parentDocumentId != null) source = getFileForDocId(parentDocumentId);
|
if(parentDocumentId != null) source = getFileForDocId(parentDocumentId);
|
||||||
return new DocumentsContract.Path(getDocIdForFile(source), Collections.singletonList(childDocumentId));
|
File destination = getFileForDocId(childDocumentId);
|
||||||
|
List<String> pathIds = new ArrayList<>();
|
||||||
|
while(!source.equals(destination) && destination != null) {
|
||||||
|
pathIds.add(getDocIdForFile(destination));
|
||||||
|
destination = destination.getParentFile();
|
||||||
|
}
|
||||||
|
pathIds.add(getDocIdForFile(source));
|
||||||
|
Collections.reverse(pathIds);
|
||||||
|
Log.i("FolderProvider", pathIds.toString());
|
||||||
|
return new DocumentsContract.Path(getDocIdForFile(source), pathIds);
|
||||||
}
|
}
|
||||||
}
|
}
|
Loading…
x
Reference in New Issue
Block a user