mirror of
https://github.com/LawnchairLauncher/lawnchair.git
synced 2026-02-20 03:08:19 +00:00
Creating a common method to iterate over all model items.
This would allow adding different source for model items without modifying every model task Bug: 160748731 Change-Id: I5a14dd761e2b8696c58dc8fec7b14077da0aced3
This commit is contained in:
@@ -56,6 +56,7 @@ import java.util.Iterator;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.function.BiConsumer;
|
||||
import java.util.function.Consumer;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
/**
|
||||
@@ -348,6 +349,19 @@ public class BgDataModel {
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Calls the provided {@code op} for all workspaceItems in the in-memory model (both persisted
|
||||
* items and dynamic/predicted items for the provided {@code userHandle}.
|
||||
* Note the call is not synchronized over the model, that should be handled by the called.
|
||||
*/
|
||||
public void forAllWorkspaceItemInfos(UserHandle userHandle, Consumer<WorkspaceItemInfo> op) {
|
||||
for (ItemInfo info : itemsIdMap) {
|
||||
if (info instanceof WorkspaceItemInfo && userHandle.equals(info.user)) {
|
||||
op.accept((WorkspaceItemInfo) info);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public interface Callbacks {
|
||||
// If the launcher has permission to access deep shortcuts.
|
||||
int FLAG_HAS_SHORTCUT_PERMISSION = 1 << 0;
|
||||
|
||||
Reference in New Issue
Block a user