Skip to content

Commit

Permalink
Move packages to jobs
Browse files Browse the repository at this point in the history
Signed-off-by: alperozturk <[email protected]>
  • Loading branch information
alperozturk96 committed Jan 12, 2024
2 parents ae35278 + 1914121 commit 17d5720
Showing 1 changed file with 8 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -221,13 +221,15 @@ public int getItemPosition(@NonNull OCFile file) {
return position;
}

@SuppressLint("NotifyDataSetChanged")
public void setFavoriteAttributeForItemID(String remotePath, boolean favorite, boolean removeFromList) {
List<OCFile> filesToDelete = new ArrayList<>();
for (OCFile file : mFiles) {
if (file.getRemotePath().equals(remotePath)) {
file.setFavorite(favorite);

if (removeFromList) {
mFiles.remove(file);
filesToDelete.add(file);
}

break;
Expand All @@ -241,7 +243,7 @@ public void setFavoriteAttributeForItemID(String remotePath, boolean favorite, b
mStorageManager.saveFile(file);

if (removeFromList) {
mFiles.remove(file);
filesToDelete.add(file);
}

break;
Expand All @@ -257,7 +259,10 @@ public void setFavoriteAttributeForItemID(String remotePath, boolean favorite, b
mFiles = sortOrder.sortCloudFiles(mFiles);
}

new Handler(Looper.getMainLooper()).post(this::notifyDataSetChanged);
new Handler(Looper.getMainLooper()).post(() -> {
mFiles.removeAll(filesToDelete);
notifyDataSetChanged();
});
}

public void refreshCommentsCount(String fileId) {
Expand Down

0 comments on commit 17d5720

Please sign in to comment.