diff options
Diffstat (limited to 'src/com/android/launcher3/DeleteDropTarget.java')
-rw-r--r-- | src/com/android/launcher3/DeleteDropTarget.java | 21 |
1 files changed, 12 insertions, 9 deletions
diff --git a/src/com/android/launcher3/DeleteDropTarget.java b/src/com/android/launcher3/DeleteDropTarget.java index a1090dc54..0ccdae1a7 100644 --- a/src/com/android/launcher3/DeleteDropTarget.java +++ b/src/com/android/launcher3/DeleteDropTarget.java @@ -128,13 +128,18 @@ public class DeleteDropTarget extends ButtonDropTarget { @Override public boolean acceptDrop(DragObject d) { - // We can remove everything including App shortcuts, folders, widgets, etc. - if ((d.dragInfo instanceof LauncherAppWidgetInfo) || - (d.dragInfo instanceof PendingAddWidgetInfo)) { - return true; - } else { - return false; + return willAcceptDrop(d.dragInfo); + } + + public static boolean willAcceptDrop(Object info) { + if (info instanceof ItemInfo) { + ItemInfo item = (ItemInfo) info; + if (item.itemType == LauncherSettings.Favorites.ITEM_TYPE_APPWIDGET || + item.itemType == LauncherSettings.Favorites.ITEM_TYPE_SHORTCUT) { + return true; + } } + return false; } @Override @@ -149,9 +154,7 @@ public class DeleteDropTarget extends ButtonDropTarget { // If we are dragging an application from AppsCustomize, only show the control if we can // delete the app (it was downloaded), and rename the string to "uninstall" in such a case - - if ((info instanceof LauncherAppWidgetInfo) || - (info instanceof PendingAddWidgetInfo)) { + if (willAcceptDrop(info)) { isVisible = true; } else { isVisible = false; |