Merging update and modify model callbacks

Instead of the dispatcher specifying the type, the UI checks th diff. This
ensures that the UI is updated correctly in all paths

Bug: 390572144
Flag: EXEMPT refactor
Test: Manually verified folder edit path where these callbacks were getting dispatched

Change-Id: Ib73eed5da87a847753a78453a48ab4fc495c1199
This commit is contained in:
Sunny Goyal committed 2025-04-21 12:31:23 -07:00
1 parent c562b3ce4e
commit 007cfecf5e
14 files changed
+211 -87

No files matched your search

@@ -51,6 +51,7 @@ import java.util.ArrayList;
import java.util.Arrays;
import java.util.Collection;
import java.util.Collections;
import java.util.HashSet;
import java.util.List;
import java.util.function.Predicate;
import java.util.function.Supplier;
@@ -177,7 +178,7 @@ public class ModelWriter {
public void moveItemsInDatabase(final ArrayList<ItemInfo> items, int container, int screen) {
ArrayList<ContentValues> contentValues = new ArrayList<>();
int count = items.size();
notifyOtherCallbacks(c -> c.bindItemsModified(items));
notifyOtherCallbacks(c -> c.bindItemsUpdated(new HashSet<>(items)));
for (int i = 0; i < count; i++) {
ItemInfo item = items.get(i);
@@ -229,7 +230,7 @@ public class ModelWriter {
}
public void notifyItemModified(ItemInfo item) {
notifyOtherCallbacks(c -> c.bindItemsModified(Collections.singletonList(item)));
notifyOtherCallbacks(c -> c.bindItemsUpdated(Collections.singleton(item)));
}
/**