mirror of
https://github.com/nextcloud/android.git
synced 2024-11-28 02:17:43 +03:00
Revert "reduce contentresolver/sql queries"
This reverts commit ec5a73142dee30cd909db9e68b97ef65456f7c48. Signed-off-by: Jens Mueller <tschenser@gmx.de>
This commit is contained in:
parent
5de451fa98
commit
8d24d80fdc
1 changed files with 8 additions and 8 deletions
|
@ -395,7 +395,7 @@ public class DocumentsStorageProvider extends DocumentsProvider {
|
|||
}
|
||||
Document newFile = new Document(storageManager, newPath);
|
||||
|
||||
context.getContentResolver().notifyChange(toNotifyUri(targetFolder), null, false);
|
||||
context.getContentResolver().notifyChange(toNotifyUri(newFile.getParent()), null, false);
|
||||
|
||||
return newFile.getDocumentId();
|
||||
}
|
||||
|
@ -754,27 +754,27 @@ public class DocumentsStorageProvider extends DocumentsProvider {
|
|||
|
||||
public class Document {
|
||||
private final FileDataStorageManager storageManager;
|
||||
private final OCFile file;
|
||||
private final long fileId;
|
||||
|
||||
Document(FileDataStorageManager storageManager, long fileId) {
|
||||
this.storageManager = storageManager;
|
||||
this.file = storageManager.getFileById(fileId);
|
||||
this.fileId = fileId;
|
||||
}
|
||||
|
||||
Document(FileDataStorageManager storageManager, OCFile file) {
|
||||
this.storageManager = storageManager;
|
||||
this.file = file;
|
||||
this.fileId = file.getFileId();
|
||||
}
|
||||
|
||||
Document(FileDataStorageManager storageManager, String filePath) {
|
||||
this.storageManager = storageManager;
|
||||
this.file = storageManager.getFileByPath(filePath);
|
||||
this.fileId = storageManager.getFileByPath(filePath).getFileId();
|
||||
}
|
||||
|
||||
public String getDocumentId() {
|
||||
for(int i = 0; i < rootIdToStorageManager.size(); i++) {
|
||||
if (Objects.equals(storageManager, rootIdToStorageManager.valueAt(i))) {
|
||||
return rootIdToStorageManager.keyAt(i) + DOCUMENTID_SEPARATOR + file.getFileId();
|
||||
return rootIdToStorageManager.keyAt(i) + DOCUMENTID_SEPARATOR + fileId;
|
||||
}
|
||||
}
|
||||
return null;
|
||||
|
@ -789,7 +789,7 @@ public class DocumentsStorageProvider extends DocumentsProvider {
|
|||
}
|
||||
|
||||
public OCFile getFile() {
|
||||
return file;
|
||||
return getStorageManager().getFileById(fileId);
|
||||
}
|
||||
|
||||
public String getRemotePath() {
|
||||
|
@ -812,7 +812,7 @@ public class DocumentsStorageProvider extends DocumentsProvider {
|
|||
}
|
||||
|
||||
Document getParent() {
|
||||
long parentId = file.getParentId();
|
||||
long parentId = getFile().getParentId();
|
||||
if (parentId <= 0) {
|
||||
return null;
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue