diff options
Diffstat (limited to 'src/com/android/launcher3/popup/SystemShortcut.java')
-rw-r--r-- | src/com/android/launcher3/popup/SystemShortcut.java | 23 |
1 files changed, 23 insertions, 0 deletions
diff --git a/src/com/android/launcher3/popup/SystemShortcut.java b/src/com/android/launcher3/popup/SystemShortcut.java index 3fb5ea136..dfe344211 100644 --- a/src/com/android/launcher3/popup/SystemShortcut.java +++ b/src/com/android/launcher3/popup/SystemShortcut.java @@ -181,6 +181,29 @@ public abstract class SystemShortcut<T extends BaseDraggingActivity> extends Ite } } + public static final Factory<BaseDraggingActivity> UNINSTALL = (activity, itemInfo) -> + PackageManagerHelper.isSystemApp(activity, + itemInfo.getTargetComponent().getPackageName()) + ? null : new UnInstall(activity, itemInfo); + + + public static class UnInstall extends SystemShortcut { + + public UnInstall(BaseDraggingActivity target, ItemInfo itemInfo) { + super(R.drawable.ic_uninstall_no_shadow, R.string.uninstall_drop_target_label, + target, itemInfo); + } + + @Override + public void onClick(View view) { + String packageName = mItemInfo.getTargetComponent().getPackageName(); + Intent intent = new PackageManagerHelper( + view.getContext()).getUninstallIntent(packageName); + mTarget.startActivitySafely(view, intent, mItemInfo, null); + AbstractFloatingView.closeAllOpenViews(mTarget); + } + } + public static void dismissTaskMenuView(BaseDraggingActivity activity) { AbstractFloatingView.closeOpenViews(activity, true, AbstractFloatingView.TYPE_ALL & ~AbstractFloatingView.TYPE_REBIND_SAFE); |