Simplifying some view iteration methods
Bug: 393703968 Flag: EXEMPT refactor Test: Presubmit Change-Id: Ieffa3a66fbf8595d542995c348df578a3aec9083
This commit is contained in:
@@ -76,7 +76,6 @@ import java.util.Collections;
|
||||
import java.util.List;
|
||||
import java.util.Objects;
|
||||
import java.util.Set;
|
||||
import java.util.function.Predicate;
|
||||
|
||||
/**
|
||||
* Hosts the Taskbar content such as Hotseat and Recent Apps. Drawn on top of other apps.
|
||||
@@ -1096,29 +1095,6 @@ public class TaskbarView extends FrameLayout implements FolderIcon.FolderIconPar
|
||||
return mAllAppsButtonTranslationOffset;
|
||||
}
|
||||
|
||||
/**
|
||||
* Finds the first icon to match one of the given matchers, from highest to lowest priority.
|
||||
*
|
||||
* @return The first match, or All Apps button if no match was found.
|
||||
*/
|
||||
public View getFirstMatch(Predicate<ItemInfo>... matchers) {
|
||||
for (Predicate<ItemInfo> matcher : matchers) {
|
||||
for (int i = 0; i < getChildCount(); i++) {
|
||||
View item = getChildAt(i);
|
||||
if (!(item.getTag() instanceof ItemInfo)) {
|
||||
// Should only happen for All Apps button.
|
||||
// Will also happen for Recent/Running app icons. (Which have GroupTask as tags)
|
||||
continue;
|
||||
}
|
||||
ItemInfo info = (ItemInfo) item.getTag();
|
||||
if (matcher.test(info)) {
|
||||
return item;
|
||||
}
|
||||
}
|
||||
}
|
||||
return mAllAppsButtonContainer;
|
||||
}
|
||||
|
||||
/**
|
||||
* This method only works for bubble bar enabled in persistent task bar and the taskbar is start
|
||||
* aligned.
|
||||
|
||||
Reference in New Issue
Block a user