Loading quickstep/src/com/android/launcher3/hybridhotseat/HotseatPredictionController.java +3 −3 Original line number Diff line number Diff line Loading @@ -55,13 +55,13 @@ import com.android.launcher3.popup.SystemShortcut; import com.android.launcher3.touch.ItemLongClickListener; import com.android.launcher3.uioverrides.PredictedAppIcon; import com.android.launcher3.uioverrides.QuickstepLauncher; import com.android.launcher3.util.ItemInfoMatcher; import com.android.launcher3.util.OnboardingPrefs; import com.android.launcher3.views.Snackbar; import java.util.ArrayList; import java.util.Collections; import java.util.List; import java.util.function.Predicate; import java.util.stream.Collectors; /** Loading Loading @@ -480,8 +480,8 @@ public class HotseatPredictionController implements DragController.DragListener, * * @param matcher filter matching items that have been removed */ public void onModelItemsRemoved(ItemInfoMatcher matcher) { if (mPredictedItems.removeIf(matcher::matchesInfo)) { public void onModelItemsRemoved(Predicate<ItemInfo> matcher) { if (mPredictedItems.removeIf(matcher)) { fillGapsWithPrediction(true); } } Loading quickstep/src/com/android/launcher3/taskbar/TaskbarDragController.java +3 −2 Original line number Diff line number Diff line Loading @@ -73,6 +73,7 @@ import com.android.systemui.shared.recents.model.Task; import java.io.PrintWriter; import java.util.Arrays; import java.util.Collections; import java.util.function.Predicate; /** * Handles long click on Taskbar items to start a system drag and drop operation. Loading Loading @@ -439,12 +440,12 @@ public class TaskbarDragController extends DragController<BaseTaskbarContext> im target = taskbarViewController.getAllAppsButtonView(); } else if (item.container >= 0) { // Since folders close when the drag starts, target the folder icon instead. ItemInfoMatcher matcher = ItemInfoMatcher.forFolderMatch( Predicate<ItemInfo> matcher = ItemInfoMatcher.forFolderMatch( ItemInfoMatcher.ofItemIds(IntSet.wrap(item.id))); target = taskbarViewController.getFirstIconMatch(matcher); } else if (item.itemType == ITEM_TYPE_DEEP_SHORTCUT) { // Find first icon with same package/user as the deep shortcut. ItemInfoMatcher packageUserMatcher = ItemInfoMatcher.ofPackages( Predicate<ItemInfo> packageUserMatcher = ItemInfoMatcher.ofPackages( Collections.singleton(item.getTargetPackage()), item.user); target = taskbarViewController.getFirstIconMatch(packageUserMatcher); } Loading quickstep/src/com/android/launcher3/taskbar/TaskbarModelCallbacks.java +4 −3 Original line number Diff line number Diff line Loading @@ -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. Loading Loading @@ -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); } Loading quickstep/src/com/android/launcher3/taskbar/TaskbarView.java +5 −4 Original line number Diff line number Diff line Loading @@ -41,12 +41,13 @@ import com.android.launcher3.model.data.FolderInfo; import com.android.launcher3.model.data.ItemInfo; import com.android.launcher3.model.data.WorkspaceItemInfo; import com.android.launcher3.uioverrides.ApiWrapper; import com.android.launcher3.util.ItemInfoMatcher; import com.android.launcher3.util.LauncherBindableItemsContainer; import com.android.launcher3.views.ActivityContext; import com.android.launcher3.views.AllAppsButton; import com.android.launcher3.views.DoubleShadowBubbleTextView; import java.util.function.Predicate; /** * Hosts the Taskbar content such as Hotseat and Recent Apps. Drawn on top of other apps. */ Loading Loading @@ -424,8 +425,8 @@ public class TaskbarView extends FrameLayout implements FolderIcon.FolderIconPar * 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(ItemInfoMatcher... matchers) { for (ItemInfoMatcher matcher : matchers) { 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)) { Loading @@ -433,7 +434,7 @@ public class TaskbarView extends FrameLayout implements FolderIcon.FolderIconPar continue; } ItemInfo info = (ItemInfo) item.getTag(); if (matcher.matchesInfo(info)) { if (matcher.test(info)) { return item; } } Loading quickstep/src/com/android/launcher3/taskbar/TaskbarViewController.java +3 −2 Original line number Diff line number Diff line Loading @@ -47,6 +47,7 @@ import com.android.launcher3.util.MultiValueAlpha; import com.android.quickstep.AnimatedFloat; import java.io.PrintWriter; import java.util.function.Predicate; /** * Handles properties/data collection, then passes the results to TaskbarView to render. Loading Loading @@ -317,8 +318,8 @@ public class TaskbarViewController implements TaskbarControllers.LoggableTaskbar * 2) FolderIcon of the Folder containing the given icon * 3) All Apps button */ public View getFirstIconMatch(ItemInfoMatcher matcher) { ItemInfoMatcher folderMatcher = ItemInfoMatcher.forFolderMatch(matcher); public View getFirstIconMatch(Predicate<ItemInfo> matcher) { Predicate<ItemInfo> folderMatcher = ItemInfoMatcher.forFolderMatch(matcher); return mTaskbarView.getFirstMatch(matcher, folderMatcher); } Loading Loading
quickstep/src/com/android/launcher3/hybridhotseat/HotseatPredictionController.java +3 −3 Original line number Diff line number Diff line Loading @@ -55,13 +55,13 @@ import com.android.launcher3.popup.SystemShortcut; import com.android.launcher3.touch.ItemLongClickListener; import com.android.launcher3.uioverrides.PredictedAppIcon; import com.android.launcher3.uioverrides.QuickstepLauncher; import com.android.launcher3.util.ItemInfoMatcher; import com.android.launcher3.util.OnboardingPrefs; import com.android.launcher3.views.Snackbar; import java.util.ArrayList; import java.util.Collections; import java.util.List; import java.util.function.Predicate; import java.util.stream.Collectors; /** Loading Loading @@ -480,8 +480,8 @@ public class HotseatPredictionController implements DragController.DragListener, * * @param matcher filter matching items that have been removed */ public void onModelItemsRemoved(ItemInfoMatcher matcher) { if (mPredictedItems.removeIf(matcher::matchesInfo)) { public void onModelItemsRemoved(Predicate<ItemInfo> matcher) { if (mPredictedItems.removeIf(matcher)) { fillGapsWithPrediction(true); } } Loading
quickstep/src/com/android/launcher3/taskbar/TaskbarDragController.java +3 −2 Original line number Diff line number Diff line Loading @@ -73,6 +73,7 @@ import com.android.systemui.shared.recents.model.Task; import java.io.PrintWriter; import java.util.Arrays; import java.util.Collections; import java.util.function.Predicate; /** * Handles long click on Taskbar items to start a system drag and drop operation. Loading Loading @@ -439,12 +440,12 @@ public class TaskbarDragController extends DragController<BaseTaskbarContext> im target = taskbarViewController.getAllAppsButtonView(); } else if (item.container >= 0) { // Since folders close when the drag starts, target the folder icon instead. ItemInfoMatcher matcher = ItemInfoMatcher.forFolderMatch( Predicate<ItemInfo> matcher = ItemInfoMatcher.forFolderMatch( ItemInfoMatcher.ofItemIds(IntSet.wrap(item.id))); target = taskbarViewController.getFirstIconMatch(matcher); } else if (item.itemType == ITEM_TYPE_DEEP_SHORTCUT) { // Find first icon with same package/user as the deep shortcut. ItemInfoMatcher packageUserMatcher = ItemInfoMatcher.ofPackages( Predicate<ItemInfo> packageUserMatcher = ItemInfoMatcher.ofPackages( Collections.singleton(item.getTargetPackage()), item.user); target = taskbarViewController.getFirstIconMatch(packageUserMatcher); } Loading
quickstep/src/com/android/launcher3/taskbar/TaskbarModelCallbacks.java +4 −3 Original line number Diff line number Diff line Loading @@ -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. Loading Loading @@ -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); } Loading
quickstep/src/com/android/launcher3/taskbar/TaskbarView.java +5 −4 Original line number Diff line number Diff line Loading @@ -41,12 +41,13 @@ import com.android.launcher3.model.data.FolderInfo; import com.android.launcher3.model.data.ItemInfo; import com.android.launcher3.model.data.WorkspaceItemInfo; import com.android.launcher3.uioverrides.ApiWrapper; import com.android.launcher3.util.ItemInfoMatcher; import com.android.launcher3.util.LauncherBindableItemsContainer; import com.android.launcher3.views.ActivityContext; import com.android.launcher3.views.AllAppsButton; import com.android.launcher3.views.DoubleShadowBubbleTextView; import java.util.function.Predicate; /** * Hosts the Taskbar content such as Hotseat and Recent Apps. Drawn on top of other apps. */ Loading Loading @@ -424,8 +425,8 @@ public class TaskbarView extends FrameLayout implements FolderIcon.FolderIconPar * 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(ItemInfoMatcher... matchers) { for (ItemInfoMatcher matcher : matchers) { 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)) { Loading @@ -433,7 +434,7 @@ public class TaskbarView extends FrameLayout implements FolderIcon.FolderIconPar continue; } ItemInfo info = (ItemInfo) item.getTag(); if (matcher.matchesInfo(info)) { if (matcher.test(info)) { return item; } } Loading
quickstep/src/com/android/launcher3/taskbar/TaskbarViewController.java +3 −2 Original line number Diff line number Diff line Loading @@ -47,6 +47,7 @@ import com.android.launcher3.util.MultiValueAlpha; import com.android.quickstep.AnimatedFloat; import java.io.PrintWriter; import java.util.function.Predicate; /** * Handles properties/data collection, then passes the results to TaskbarView to render. Loading Loading @@ -317,8 +318,8 @@ public class TaskbarViewController implements TaskbarControllers.LoggableTaskbar * 2) FolderIcon of the Folder containing the given icon * 3) All Apps button */ public View getFirstIconMatch(ItemInfoMatcher matcher) { ItemInfoMatcher folderMatcher = ItemInfoMatcher.forFolderMatch(matcher); public View getFirstIconMatch(Predicate<ItemInfo> matcher) { Predicate<ItemInfo> folderMatcher = ItemInfoMatcher.forFolderMatch(matcher); return mTaskbarView.getFirstMatch(matcher, folderMatcher); } Loading