summaryrefslogtreecommitdiffstats
path: root/src/com/android/launcher3/DeleteDropTarget.java
diff options
context:
space:
mode:
authorAdam Cohen <adamcohen@google.com>2013-06-14 17:42:35 -0700
committerAdam Cohen <adamcohen@google.com>2013-06-14 17:43:44 -0700
commit7c4c5108295db764ba091cc0ffd7af335a166449 (patch)
tree2b0d67bad56adba11cf6277c59247e4d54bac63c /src/com/android/launcher3/DeleteDropTarget.java
parenta0b5749433c66b6fed5c6026414ef438a938089b (diff)
downloadandroid_packages_apps_Trebuchet-7c4c5108295db764ba091cc0ffd7af335a166449.tar.gz
android_packages_apps_Trebuchet-7c4c5108295db764ba091cc0ffd7af335a166449.tar.bz2
android_packages_apps_Trebuchet-7c4c5108295db764ba091cc0ffd7af335a166449.zip
HACK: Fixing major persistence regression associated with extra screen to the left
-> Also adding ability to delete shortcuts. Change-Id: I263baf813eae9089f11288494d575a99f0e859c3
Diffstat (limited to 'src/com/android/launcher3/DeleteDropTarget.java')
-rw-r--r--src/com/android/launcher3/DeleteDropTarget.java21
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;