mirror of
https://github.com/LawnchairLauncher/lawnchair.git
synced 2026-03-03 01:16:49 +00:00
Replacing ItemInfoMatcher with predicate
This removed unnecessary componentName lookups when it is not required. Many checks just rely on IDs and userHandle Bug: 231153610 Test: Presubmit Change-Id: Ief93954abc5861062a9f55dc2ef181d3de106c62
This commit is contained in:
@@ -36,6 +36,7 @@ import java.util.Collections;
|
||||
import java.util.HashMap;
|
||||
import java.util.HashSet;
|
||||
import java.util.List;
|
||||
import java.util.function.Predicate;
|
||||
|
||||
/**
|
||||
* Launcher model Callbacks for rendering taskbar.
|
||||
@@ -126,16 +127,16 @@ public class TaskbarModelCallbacks implements
|
||||
}
|
||||
|
||||
@Override
|
||||
public void bindWorkspaceComponentsRemoved(ItemInfoMatcher matcher) {
|
||||
public void bindWorkspaceComponentsRemoved(Predicate<ItemInfo> matcher) {
|
||||
if (handleItemsRemoved(matcher)) {
|
||||
commitItemsToUI();
|
||||
}
|
||||
}
|
||||
|
||||
private boolean handleItemsRemoved(ItemInfoMatcher matcher) {
|
||||
private boolean handleItemsRemoved(Predicate<ItemInfo> matcher) {
|
||||
boolean modified = false;
|
||||
for (int i = mHotseatItems.size() - 1; i >= 0; i--) {
|
||||
if (matcher.matchesInfo(mHotseatItems.valueAt(i))) {
|
||||
if (matcher.test(mHotseatItems.valueAt(i))) {
|
||||
modified = true;
|
||||
mHotseatItems.removeAt(i);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user