HACK: Fixing major persistence regression associated with extra screen to the left
-> Also adding ability to delete shortcuts.
Change-Id: I263baf813eae9089f11288494d575a99f0e859c3
diff --git a/src/com/android/launcher3/DeleteDropTarget.java b/src/com/android/launcher3/DeleteDropTarget.java
index a1090dc..0ccdae1 100644
--- a/src/com/android/launcher3/DeleteDropTarget.java
+++ b/src/com/android/launcher3/DeleteDropTarget.java
@@ -128,13 +128,18 @@
@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 @@
// 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;