mirror of
https://github.com/LawnchairLauncher/lawnchair.git
synced 2026-03-04 09:56:49 +00:00
ShortcutInfo renamed to WorkspaceItemInfo
Will get rid of ShortcutInfoCompat in a follow up cl Change-Id: I7d7d9c938635f59b216290ba28bea9d0e0721a7d
This commit is contained in:
@@ -244,13 +244,13 @@ public class InstallShortcutReceiver extends BroadcastReceiver {
|
||||
return convertToLauncherActivityIfPossible(info);
|
||||
}
|
||||
|
||||
public static ShortcutInfo fromShortcutIntent(Context context, Intent data) {
|
||||
public static WorkspaceItemInfo fromShortcutIntent(Context context, Intent data) {
|
||||
PendingInstallShortcutInfo info = createPendingInfo(context, data);
|
||||
return info == null ? null : (ShortcutInfo) info.getItemInfo().first;
|
||||
return info == null ? null : (WorkspaceItemInfo) info.getItemInfo().first;
|
||||
}
|
||||
|
||||
public static ShortcutInfo fromActivityInfo(LauncherActivityInfo info, Context context) {
|
||||
return (ShortcutInfo) (new PendingInstallShortcutInfo(info, context).getItemInfo().first);
|
||||
public static WorkspaceItemInfo fromActivityInfo(LauncherActivityInfo info, Context context) {
|
||||
return (WorkspaceItemInfo) (new PendingInstallShortcutInfo(info, context).getItemInfo().first);
|
||||
}
|
||||
|
||||
public static void queueShortcut(ShortcutInfoCompat info, Context context) {
|
||||
@@ -483,11 +483,11 @@ public class InstallShortcutReceiver extends BroadcastReceiver {
|
||||
// Set default values until proper values is loaded.
|
||||
appInfo.title = "";
|
||||
appInfo.applyFrom(app.getIconCache().getDefaultIcon(user));
|
||||
final ShortcutInfo si = appInfo.makeShortcut();
|
||||
final WorkspaceItemInfo si = appInfo.makeWorkspaceItem();
|
||||
if (Looper.myLooper() == LauncherModel.getWorkerLooper()) {
|
||||
app.getIconCache().getTitleAndIcon(si, activityInfo, false /* useLowResIcon */);
|
||||
} else {
|
||||
app.getModel().updateAndBindShortcutInfo(() -> {
|
||||
app.getModel().updateAndBindWorkspaceItem(() -> {
|
||||
app.getIconCache().getTitleAndIcon(
|
||||
si, activityInfo, false /* useLowResIcon */);
|
||||
return si;
|
||||
@@ -495,7 +495,7 @@ public class InstallShortcutReceiver extends BroadcastReceiver {
|
||||
}
|
||||
return Pair.create((ItemInfo) si, (Object) activityInfo);
|
||||
} else if (shortcutInfo != null) {
|
||||
ShortcutInfo si = new ShortcutInfo(shortcutInfo, mContext);
|
||||
WorkspaceItemInfo si = new WorkspaceItemInfo(shortcutInfo, mContext);
|
||||
LauncherIcons li = LauncherIcons.obtain(mContext);
|
||||
si.applyFrom(li.createShortcutIcon(shortcutInfo));
|
||||
li.recycle();
|
||||
@@ -513,7 +513,7 @@ public class InstallShortcutReceiver extends BroadcastReceiver {
|
||||
widgetInfo.spanY = Math.min(info.spanY, idp.numRows);
|
||||
return Pair.create((ItemInfo) widgetInfo, (Object) providerInfo);
|
||||
} else {
|
||||
ShortcutInfo si = createShortcutInfo(data, LauncherAppState.getInstance(mContext));
|
||||
WorkspaceItemInfo si = createWorkspaceItemInfo(data, LauncherAppState.getInstance(mContext));
|
||||
return Pair.create((ItemInfo) si, null);
|
||||
}
|
||||
}
|
||||
@@ -625,18 +625,18 @@ public class InstallShortcutReceiver extends BroadcastReceiver {
|
||||
return new PendingInstallShortcutInfo(info, original.mContext);
|
||||
}
|
||||
|
||||
private static ShortcutInfo createShortcutInfo(Intent data, LauncherAppState app) {
|
||||
private static WorkspaceItemInfo createWorkspaceItemInfo(Intent data, LauncherAppState app) {
|
||||
Intent intent = data.getParcelableExtra(Intent.EXTRA_SHORTCUT_INTENT);
|
||||
String name = data.getStringExtra(Intent.EXTRA_SHORTCUT_NAME);
|
||||
Parcelable bitmap = data.getParcelableExtra(Intent.EXTRA_SHORTCUT_ICON);
|
||||
|
||||
if (intent == null) {
|
||||
// If the intent is null, we can't construct a valid ShortcutInfo, so we return null
|
||||
Log.e(TAG, "Can't construct ShorcutInfo with null intent");
|
||||
// If the intent is null, return null as we can't construct a valid WorkspaceItemInfo
|
||||
Log.e(TAG, "Can't construct WorkspaceItemInfo with null intent");
|
||||
return null;
|
||||
}
|
||||
|
||||
final ShortcutInfo info = new ShortcutInfo();
|
||||
final WorkspaceItemInfo info = new WorkspaceItemInfo();
|
||||
|
||||
// Only support intents for current user for now. Intents sent from other
|
||||
// users wouldn't get here without intent forwarding anyway.
|
||||
|
||||
Reference in New Issue
Block a user