Add a WidgetsSearchBar(Launcher3) and a WidgetsSearchController.

- Make WidgetsSearchBar in Launcher3 initialize WidgetsSearchController with SimpleWidgetsSearchPipeline
- Modify SimpleWidgetsSearchPipeline to filter widgets entries on widgets/shortcut labels also.

Test: Tested prototype locally. Also added robolectric test.
Bug: b/157286785
Change-Id: I65f5fa0240ffb6d22023167e4e86d94d83bbd9f7
This commit is contained in:
Alina Zaidi
2021-03-09 21:23:35 +00:00
parent 334e65935b
commit d07acba048
18 changed files with 733 additions and 348 deletions

View File

@@ -17,23 +17,18 @@ package com.android.launcher3.widget.model;
import com.android.launcher3.model.WidgetItem;
import com.android.launcher3.model.data.PackageItemInfo;
import com.android.launcher3.widget.WidgetItemComparator;
import java.util.List;
import java.util.stream.Collectors;
/** An information holder for an app which has widgets or/and shortcuts, to be shown in search. */
public final class WidgetsListSearchHeaderEntry extends WidgetsListBaseEntry {
public final List<WidgetItem> mWidgets;
private boolean mIsWidgetListShown = false;
private boolean mHasEntryUpdated = false;
public WidgetsListSearchHeaderEntry(PackageItemInfo pkgItem, String titleSectionName,
List<WidgetItem> items) {
super(pkgItem, titleSectionName);
mWidgets = items.stream().sorted(new WidgetItemComparator()).collect(Collectors.toList());
super(pkgItem, titleSectionName, items);
}
/** Sets if the widgets list associated with this header is shown. */