use of com.android.launcher3.icons.IconProvider in project android_packages_apps_Trebuchet by LineageOS.
the class IconPackHeaderPreference method onRadioElementSelected.
@Override
public void onRadioElementSelected(String key) {
if (icons == null) {
return;
}
final IconProvider iconProvider = new IconProvider(context);
final PackageManager pm = context.getPackageManager();
final LauncherApps launcherApps = context.getSystemService(LauncherApps.class);
new GetLaunchableInfoTask(pm, launcherApps, PREVIEW_ICON_NUM, (aiList) -> {
for (int i = 0; i < icons.length; i++) {
icons[i].setImageDrawable(iconProvider.getIcon(aiList.get(i), PREVIEW_ICON_DPI));
}
}).execute();
}
use of com.android.launcher3.icons.IconProvider in project android_packages_apps_Trebuchet by LineageOS.
the class Utilities method getFullDrawable.
/**
* Returns the full drawable for info without any flattening or pre-processing.
*
* @param outObj this is set to the internal data associated with {@param info},
* eg {@link LauncherActivityInfo} or {@link ShortcutInfo}.
*/
public static Drawable getFullDrawable(Launcher launcher, ItemInfo info, int width, int height, Object[] outObj) {
LauncherAppState appState = LauncherAppState.getInstance(launcher);
if (info.itemType == LauncherSettings.Favorites.ITEM_TYPE_APPLICATION) {
LauncherActivityInfo activityInfo = launcher.getSystemService(LauncherApps.class).resolveActivity(info.getIntent(), info.user);
outObj[0] = activityInfo;
return activityInfo == null ? null : new IconProvider(launcher).getIconForUI(activityInfo, launcher.getDeviceProfile().inv.fillResIconDpi);
} else if (info.itemType == LauncherSettings.Favorites.ITEM_TYPE_DEEP_SHORTCUT) {
if (info instanceof PendingAddShortcutInfo) {
ShortcutConfigActivityInfo activityInfo = ((PendingAddShortcutInfo) info).activityInfo;
outObj[0] = activityInfo;
return activityInfo.getFullResIcon(appState.getIconCache());
}
if (info.getIntent() == null || info.getIntent().getPackage() == null)
return null;
List<ShortcutInfo> si = ShortcutKey.fromItemInfo(info).buildRequest(launcher).query(ShortcutRequest.ALL);
if (si.isEmpty()) {
return null;
} else {
outObj[0] = si.get(0);
return ShortcutCachingLogic.getIcon(launcher, si.get(0), appState.getInvariantDeviceProfile().fillResIconDpi);
}
} else if (info.itemType == LauncherSettings.Favorites.ITEM_TYPE_FOLDER) {
FolderAdaptiveIcon icon = FolderAdaptiveIcon.createFolderAdaptiveIcon(launcher, info.id, new Point(width, height));
if (icon == null) {
return null;
}
outObj[0] = icon;
return icon;
} else {
return null;
}
}
Aggregations