use of com.android.launcher3.widget.util.WidgetSizes in project android_packages_apps_Launcher3 by crdroidandroid.
the class WidgetsTableUtilsTest method initTestWidgets.
private void initTestWidgets() {
List<Point> widgetSizes = List.of(new Point(1, 1), new Point(2, 2), new Point(2, 3), new Point(2, 4), new Point(4, 4));
ArrayList<WidgetItem> widgetItems = new ArrayList<>();
widgetSizes.stream().forEach(widgetSize -> {
ShadowPackageManager packageManager = shadowOf(mContext.getPackageManager());
AppWidgetProviderInfo info = new AppWidgetProviderInfo();
info.provider = ComponentName.createRelative(TEST_PACKAGE, ".WidgetProvider_" + widgetSize.x + "x" + widgetSize.y);
LauncherAppWidgetProviderInfo widgetInfo = LauncherAppWidgetProviderInfo.fromProviderInfo(mContext, info);
widgetInfo.spanX = widgetSize.x;
widgetInfo.spanY = widgetSize.y;
ReflectionHelpers.setField(widgetInfo, "providerInfo", packageManager.addReceiverIfNotPresent(widgetInfo.provider));
widgetItems.add(new WidgetItem(widgetInfo, mTestProfile, mIconCache));
});
mWidget1x1 = widgetItems.get(0);
mWidget2x2 = widgetItems.get(1);
mWidget2x3 = widgetItems.get(2);
mWidget2x4 = widgetItems.get(3);
mWidget4x4 = widgetItems.get(4);
}
Aggregations