App Pairs: Implement save, inflate, launch, and delete

This is the third of several patches implementing the App Pairs feature behind a flag.

This patch includes:
- AppPairIcon and associated XML. Actual icon asset is placeholder for now
- Ability to launch split pair on click
- Icon can be moved around, incl. to Taskbar
- App pair can be deleted by dragging to "Remove" drop zone
- Icon persists on Launcher reload

Change-Id: I88aec6fbc814be98f9ef048bbc5af889d0797970
Flag: ENABLE_APP_PAIRS (set to false)
Bug: 274835596
Test: Not included in this CL, but will follow
This commit is contained in:
Jeremy Sim
2023-04-19 20:56:49 -07:00
parent 2a8a40c4a8
commit 94fd07e5da
16 changed files with 523 additions and 85 deletions

View File

@@ -42,6 +42,7 @@ import com.android.launcher3.Launcher;
import com.android.launcher3.LauncherSettings;
import com.android.launcher3.R;
import com.android.launcher3.Utilities;
import com.android.launcher3.apppairs.AppPairIcon;
import com.android.launcher3.folder.Folder;
import com.android.launcher3.folder.FolderIcon;
import com.android.launcher3.logging.InstanceId;
@@ -95,6 +96,8 @@ public class ItemClickHandler {
} else if (tag instanceof FolderInfo) {
if (v instanceof FolderIcon) {
onClickFolderIcon(v);
} else if (v instanceof AppPairIcon) {
onClickAppPairIcon(v);
}
} else if (tag instanceof AppInfo) {
startAppShortcutOrInfoActivity(v, (AppInfo) tag, launcher);
@@ -122,6 +125,17 @@ public class ItemClickHandler {
}
}
/**
* Event handler for an app pair icon click.
*
* @param v The view that was clicked. Must be an instance of {@link AppPairIcon}.
*/
private static void onClickAppPairIcon(View v) {
Launcher launcher = Launcher.getLauncher(v.getContext());
FolderInfo folderInfo = ((AppPairIcon) v).getInfo();
launcher.launchAppPair(folderInfo.contents.get(0), folderInfo.contents.get(1));
}
/**
* Event handler for the app widget view which has not fully restored.
*/