Loading go/src/com/android/launcher3/model/WidgetsModel.java +15 −1 Original line number Diff line number Diff line Loading @@ -33,6 +33,7 @@ import java.util.Collections; import java.util.List; import java.util.Map; import java.util.Set; import java.util.function.Predicate; /** * Widgets data model that is used by the adapters of the widget views and controllers. Loading @@ -47,6 +48,19 @@ public class WidgetsModel { private static final ArrayList<WidgetsListBaseEntry> EMPTY_WIDGET_LIST = new ArrayList<>(); /** * Returns a list of {@link WidgetsListBaseEntry} filtered using given widget item filter. All * {@link WidgetItem}s in a single row are sorted (based on label and user), but the overall * list of {@link WidgetsListBaseEntry}s is not sorted. * * @see com.android.launcher3.widget.picker.WidgetsListAdapter#setWidgets(List) */ public synchronized ArrayList<WidgetsListBaseEntry> getFilteredWidgetsListForPicker( Context context, Predicate<WidgetItem> widgetItemFilter) { return EMPTY_WIDGET_LIST; } /** * Returns a list of {@link WidgetsListBaseEntry}. All {@link WidgetItem} in a single row are * sorted (based on label and user), but the overall list of {@link WidgetsListBaseEntry}s is Loading quickstep/src/com/android/launcher3/WidgetPickerActivity.java +4 −1 Original line number Diff line number Diff line Loading @@ -158,7 +158,10 @@ public class WidgetPickerActivity extends BaseActivity { LauncherAppState app = LauncherAppState.getInstance(this); mModel.update(app, null); final ArrayList<WidgetsListBaseEntry> widgets = mModel.getWidgetsListForPicker(app.getContext()); mModel.getFilteredWidgetsListForPicker( app.getContext(), /*widgetItemFilter=*/ item -> item.widgetInfo != null ); MAIN_EXECUTOR.execute(() -> mPopupDataProvider.setAllWidgets(widgets)); }); } Loading src_shortcuts_overrides/com/android/launcher3/model/WidgetsModel.java +27 −9 Original line number Diff line number Diff line Loading @@ -70,27 +70,45 @@ public class WidgetsModel { private final Map<PackageItemInfo, List<WidgetItem>> mWidgetsList = new HashMap<>(); /** * Returns a list of {@link WidgetsListBaseEntry}. All {@link WidgetItem} in a single row * are sorted (based on label and user), but the overall list of * {@link WidgetsListBaseEntry}s is not sorted. * Returns a list of {@link WidgetsListBaseEntry} filtered using given widget item filter. All * {@link WidgetItem}s in a single row are sorted (based on label and user), but the overall * list of {@link WidgetsListBaseEntry}s is not sorted. * * @see com.android.launcher3.widget.picker.WidgetsListAdapter#setWidgets(List) */ public synchronized ArrayList<WidgetsListBaseEntry> getWidgetsListForPicker(Context context) { public synchronized ArrayList<WidgetsListBaseEntry> getFilteredWidgetsListForPicker( Context context, Predicate<WidgetItem> widgetItemFilter) { ArrayList<WidgetsListBaseEntry> result = new ArrayList<>(); AlphabeticIndexCompat indexer = new AlphabeticIndexCompat(context); for (Map.Entry<PackageItemInfo, List<WidgetItem>> entry : mWidgetsList.entrySet()) { PackageItemInfo pkgItem = entry.getKey(); List<WidgetItem> widgetItems = entry.getValue(); List<WidgetItem> widgetItems = entry.getValue() .stream() .filter(widgetItemFilter).toList(); if (!widgetItems.isEmpty()) { String sectionName = (pkgItem.title == null) ? "" : indexer.computeSectionName(pkgItem.title); result.add(WidgetsListHeaderEntry.create(pkgItem, sectionName, widgetItems)); result.add(new WidgetsListContentEntry(pkgItem, sectionName, widgetItems)); } } return result; } /** * Returns a list of {@link WidgetsListBaseEntry}. All {@link WidgetItem} in a single row * are sorted (based on label and user), but the overall list of * {@link WidgetsListBaseEntry}s is not sorted. * * @see com.android.launcher3.widget.picker.WidgetsListAdapter#setWidgets(List) */ public synchronized ArrayList<WidgetsListBaseEntry> getWidgetsListForPicker(Context context) { // return all items return getFilteredWidgetsListForPicker(context, /*widgetItemFilter=*/ item -> true); } /** Returns a mapping of packages to their widgets without static shortcuts. */ public synchronized Map<PackageUserKey, List<WidgetItem>> getAllWidgetsWithoutShortcuts() { Map<PackageUserKey, List<WidgetItem>> packagesToWidgets = new HashMap<>(); Loading Loading
go/src/com/android/launcher3/model/WidgetsModel.java +15 −1 Original line number Diff line number Diff line Loading @@ -33,6 +33,7 @@ import java.util.Collections; import java.util.List; import java.util.Map; import java.util.Set; import java.util.function.Predicate; /** * Widgets data model that is used by the adapters of the widget views and controllers. Loading @@ -47,6 +48,19 @@ public class WidgetsModel { private static final ArrayList<WidgetsListBaseEntry> EMPTY_WIDGET_LIST = new ArrayList<>(); /** * Returns a list of {@link WidgetsListBaseEntry} filtered using given widget item filter. All * {@link WidgetItem}s in a single row are sorted (based on label and user), but the overall * list of {@link WidgetsListBaseEntry}s is not sorted. * * @see com.android.launcher3.widget.picker.WidgetsListAdapter#setWidgets(List) */ public synchronized ArrayList<WidgetsListBaseEntry> getFilteredWidgetsListForPicker( Context context, Predicate<WidgetItem> widgetItemFilter) { return EMPTY_WIDGET_LIST; } /** * Returns a list of {@link WidgetsListBaseEntry}. All {@link WidgetItem} in a single row are * sorted (based on label and user), but the overall list of {@link WidgetsListBaseEntry}s is Loading
quickstep/src/com/android/launcher3/WidgetPickerActivity.java +4 −1 Original line number Diff line number Diff line Loading @@ -158,7 +158,10 @@ public class WidgetPickerActivity extends BaseActivity { LauncherAppState app = LauncherAppState.getInstance(this); mModel.update(app, null); final ArrayList<WidgetsListBaseEntry> widgets = mModel.getWidgetsListForPicker(app.getContext()); mModel.getFilteredWidgetsListForPicker( app.getContext(), /*widgetItemFilter=*/ item -> item.widgetInfo != null ); MAIN_EXECUTOR.execute(() -> mPopupDataProvider.setAllWidgets(widgets)); }); } Loading
src_shortcuts_overrides/com/android/launcher3/model/WidgetsModel.java +27 −9 Original line number Diff line number Diff line Loading @@ -70,27 +70,45 @@ public class WidgetsModel { private final Map<PackageItemInfo, List<WidgetItem>> mWidgetsList = new HashMap<>(); /** * Returns a list of {@link WidgetsListBaseEntry}. All {@link WidgetItem} in a single row * are sorted (based on label and user), but the overall list of * {@link WidgetsListBaseEntry}s is not sorted. * Returns a list of {@link WidgetsListBaseEntry} filtered using given widget item filter. All * {@link WidgetItem}s in a single row are sorted (based on label and user), but the overall * list of {@link WidgetsListBaseEntry}s is not sorted. * * @see com.android.launcher3.widget.picker.WidgetsListAdapter#setWidgets(List) */ public synchronized ArrayList<WidgetsListBaseEntry> getWidgetsListForPicker(Context context) { public synchronized ArrayList<WidgetsListBaseEntry> getFilteredWidgetsListForPicker( Context context, Predicate<WidgetItem> widgetItemFilter) { ArrayList<WidgetsListBaseEntry> result = new ArrayList<>(); AlphabeticIndexCompat indexer = new AlphabeticIndexCompat(context); for (Map.Entry<PackageItemInfo, List<WidgetItem>> entry : mWidgetsList.entrySet()) { PackageItemInfo pkgItem = entry.getKey(); List<WidgetItem> widgetItems = entry.getValue(); List<WidgetItem> widgetItems = entry.getValue() .stream() .filter(widgetItemFilter).toList(); if (!widgetItems.isEmpty()) { String sectionName = (pkgItem.title == null) ? "" : indexer.computeSectionName(pkgItem.title); result.add(WidgetsListHeaderEntry.create(pkgItem, sectionName, widgetItems)); result.add(new WidgetsListContentEntry(pkgItem, sectionName, widgetItems)); } } return result; } /** * Returns a list of {@link WidgetsListBaseEntry}. All {@link WidgetItem} in a single row * are sorted (based on label and user), but the overall list of * {@link WidgetsListBaseEntry}s is not sorted. * * @see com.android.launcher3.widget.picker.WidgetsListAdapter#setWidgets(List) */ public synchronized ArrayList<WidgetsListBaseEntry> getWidgetsListForPicker(Context context) { // return all items return getFilteredWidgetsListForPicker(context, /*widgetItemFilter=*/ item -> true); } /** Returns a mapping of packages to their widgets without static shortcuts. */ public synchronized Map<PackageUserKey, List<WidgetItem>> getAllWidgetsWithoutShortcuts() { Map<PackageUserKey, List<WidgetItem>> packagesToWidgets = new HashMap<>(); Loading