Skip to content

Commit 5eceec2

Browse files
committed
fix(file-list): cleanup states
Signed-off-by: alperozturk96 <alper_ozturk@proton.me>
1 parent b833d4f commit 5eceec2

2 files changed

Lines changed: 5 additions & 4 deletions

File tree

app/src/main/java/com/owncloud/android/ui/adapter/OCFileListAdapter.java

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -871,6 +871,7 @@ public void updateAdapter(List<OCFile> newFiles, OCFile directory) {
871871

872872
mFiles = new ArrayList<>(newFiles);
873873
mFilesAll.clear();
874+
ocFileListDelegate.clearFolderDownloadStates();
874875
mFilesAll.addAll(mFiles);
875876

876877
if (directory != null) {

app/src/main/java/com/owncloud/android/ui/adapter/OCFileListDelegate.kt

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -413,17 +413,17 @@ class OCFileListDelegate(
413413
}
414414

415415
fun addFolderDownloadStates(ids: Set<FolderDownloadState>) {
416-
val removed = folderDownloadStates - ids
417-
val added = ids - folderDownloadStates
418-
419416
folderDownloadStates.clear()
420417
folderDownloadStates.addAll(ids)
421418

422-
Log_OC.d(TAG, "downloading folders - added: $added, removed: $removed, current: $folderDownloadStates")
419+
Log_OC.d(TAG, "downloading folders - added current: $folderDownloadStates")
423420
}
424421

425422
fun getFolderDownloadStates(): List<FolderDownloadState> = folderDownloadStates.toList()
426423

424+
// only clear remove states since downloading states added and removed via worker
425+
fun clearFolderDownloadStates() = folderDownloadStates.removeIf { it is FolderDownloadState.Removed }
426+
427427
fun cleanup() {
428428
ioScope.cancel()
429429

0 commit comments

Comments
 (0)