From ce86e194c41d37b40bd4423bd1954d05bde24840 Mon Sep 17 00:00:00 2001 From: Tony Wickham Date: Fri, 18 Sep 2015 16:06:55 -0700 Subject: [PATCH] Show App Info when dragging widgets from the workspace. Bug: 24190195 Change-Id: I65f67b7c1a1ae895035942aa97e40186ea5a206f --- src/com/android/launcher3/InfoDropTarget.java | 4 +++- src/com/android/launcher3/UninstallDropTarget.java | 9 ++++++--- 2 files changed, 9 insertions(+), 4 deletions(-) diff --git a/src/com/android/launcher3/InfoDropTarget.java b/src/com/android/launcher3/InfoDropTarget.java index 006ce5dc06..d444640e62 100644 --- a/src/com/android/launcher3/InfoDropTarget.java +++ b/src/com/android/launcher3/InfoDropTarget.java @@ -50,6 +50,8 @@ public class InfoDropTarget extends UninstallDropTarget { componentName = ((ShortcutInfo) info).intent.getComponent(); } else if (info instanceof PendingAddItemInfo) { componentName = ((PendingAddItemInfo) info).componentName; + } else if (info instanceof LauncherAppWidgetInfo) { + componentName = ((LauncherAppWidgetInfo) info).providerName; } if (componentName != null) { launcher.startApplicationDetailsActivity(componentName, info.user); @@ -70,6 +72,6 @@ public class InfoDropTarget extends UninstallDropTarget { public static boolean supportsDrop(Context context, ItemInfo info) { return info instanceof AppInfo || info instanceof ShortcutInfo - || info instanceof PendingAddItemInfo; + || info instanceof PendingAddItemInfo || info instanceof LauncherAppWidgetInfo; } } diff --git a/src/com/android/launcher3/UninstallDropTarget.java b/src/com/android/launcher3/UninstallDropTarget.java index b69c79da11..73881610b4 100644 --- a/src/com/android/launcher3/UninstallDropTarget.java +++ b/src/com/android/launcher3/UninstallDropTarget.java @@ -87,9 +87,12 @@ public class UninstallDropTarget extends ButtonDropTarget { final Runnable checkIfUninstallWasSuccess = new Runnable() { @Override public void run() { - String packageName = componentInfo.first.getPackageName(); - boolean uninstallSuccessful = !AllAppsList.packageHasActivities( - getContext(), packageName, user); + boolean uninstallSuccessful = false; + if (componentInfo != null) { + String packageName = componentInfo.first.getPackageName(); + uninstallSuccessful = !AllAppsList.packageHasActivities( + getContext(), packageName, user); + } sendUninstallResult(d.dragSource, uninstallSuccessful); } };