mirror of
https://github.com/2009scape/2009Scape-mobile.git
synced 2026-08-28 05:45:03 -06:00
Fix the FolderProvider findDocumentPath implementation to make paths actually visible
This commit is contained in:
parent
2293664bd4
commit
1f28b3a6a7
2 changed files with 11 additions and 2 deletions
|
|
@ -1 +1 @@
|
|||
1665886806915
|
||||
1674881685730
|
||||
|
|
@ -313,6 +313,15 @@ public class FolderProvider extends DocumentsProvider {
|
|||
public DocumentsContract.Path findDocumentPath(@Nullable String parentDocumentId, String childDocumentId) throws FileNotFoundException {
|
||||
File source = BASE_DIR;
|
||||
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…
Add table
Add a link
Reference in a new issue