use of com.android.launcher3.model.PackageItemInfo in project android_packages_apps_Launcher3 by crdroidandroid.
the class WidgetsModel method getAllWidgetsWithoutShortcuts.
/**
* 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<>();
mWidgetsList.forEach((packageItemInfo, widgetsAndShortcuts) -> {
List<WidgetItem> widgets = widgetsAndShortcuts.stream().filter(item -> item.widgetInfo != null).collect(toList());
if (widgets.size() > 0) {
packagesToWidgets.put(new PackageUserKey(packageItemInfo.packageName, packageItemInfo.user), widgets);
}
});
return packagesToWidgets;
}
use of com.android.launcher3.model.PackageItemInfo in project android_packages_apps_Launcher3 by crdroidandroid.
the class WidgetsModel method getWidgetsListForPicker.
/**
* 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. This list is sorted at the UI when using
* {@link WidgetsDiffReporter}
*
* @see com.android.launcher3.widget.picker.WidgetsListAdapter#setWidgets(List)
*/
public synchronized ArrayList<WidgetsListBaseEntry> getWidgetsListForPicker(Context context) {
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();
String sectionName = (pkgItem.title == null) ? "" : indexer.computeSectionName(pkgItem.title);
result.add(new WidgetsListHeaderEntry(pkgItem, sectionName, widgetItems));
result.add(new WidgetsListContentEntry(pkgItem, sectionName, widgetItems));
}
return result;
}
use of com.android.launcher3.model.PackageItemInfo in project android_packages_apps_Launcher3 by crdroidandroid.
the class WidgetsListTableViewHolderBinderTest method generateSampleAppWithWidgets.
private WidgetsListContentEntry generateSampleAppWithWidgets(String appName, String packageName, int numOfWidgets) {
PackageItemInfo appInfo = new PackageItemInfo(packageName);
appInfo.title = appName;
appInfo.bitmap = BitmapInfo.of(Bitmap.createBitmap(10, 10, Bitmap.Config.ALPHA_8), 0);
return new WidgetsListContentEntry(appInfo, /* titleSectionName= */
"", generateWidgetItems(packageName, numOfWidgets));
}
use of com.android.launcher3.model.PackageItemInfo in project android_packages_apps_Launcher3 by crdroidandroid.
the class SimpleWidgetsSearchAlgorithmTest method createWidgetsHeaderEntry.
private WidgetsListHeaderEntry createWidgetsHeaderEntry(String packageName, String appName, int numOfWidgets) {
List<WidgetItem> widgetItems = generateWidgetItems(packageName, numOfWidgets);
PackageItemInfo pInfo = createPackageItemInfo(packageName, appName, widgetItems.get(0).user);
return new WidgetsListHeaderEntry(pInfo, /* titleSectionName= */
"", widgetItems);
}
use of com.android.launcher3.model.PackageItemInfo in project android_packages_apps_Launcher3 by AOSPA.
the class WidgetsListHeaderViewHolderBinderTest method generateSampleAppHeader.
private WidgetsListHeaderEntry generateSampleAppHeader(String appName, String packageName, int numOfWidgets) {
PackageItemInfo appInfo = new PackageItemInfo(packageName, UserHandle.CURRENT);
appInfo.title = appName;
appInfo.bitmap = BitmapInfo.of(Bitmap.createBitmap(10, 10, Bitmap.Config.ALPHA_8), 0);
return new WidgetsListHeaderEntry(appInfo, /* titleSectionName= */
"", generateWidgetItems(packageName, numOfWidgets));
}
Aggregations