summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--src/com/android/launcher3/InfoDropTarget.java27
1 files changed, 11 insertions, 16 deletions
diff --git a/src/com/android/launcher3/InfoDropTarget.java b/src/com/android/launcher3/InfoDropTarget.java
index 2ad43b6ff..d27ddd958 100644
--- a/src/com/android/launcher3/InfoDropTarget.java
+++ b/src/com/android/launcher3/InfoDropTarget.java
@@ -62,8 +62,15 @@ public class InfoDropTarget extends ButtonDropTarget {
}
}
- private boolean isFromAllApps(DragSource source) {
- return (source instanceof AppsCustomizePagedView);
+ private ComponentName dragItemComponentName(Object dragInfo) {
+ if (dragInfo instanceof AppInfo) {
+ return ((AppInfo) dragInfo).componentName;
+ } else if (dragInfo instanceof ShortcutInfo) {
+ return ((ShortcutInfo) dragInfo).intent.getComponent();
+ } else if (dragInfo instanceof PendingAddItemInfo) {
+ return ((PendingAddItemInfo) dragInfo).componentName;
+ }
+ return null;
}
@Override
@@ -71,14 +78,7 @@ public class InfoDropTarget extends ButtonDropTarget {
// acceptDrop is called just before onDrop. We do the work here, rather than
// in onDrop, because it allows us to reject the drop (by returning false)
// so that the object being dragged isn't removed from the drag source.
- ComponentName componentName = null;
- if (d.dragInfo instanceof AppInfo) {
- componentName = ((AppInfo) d.dragInfo).componentName;
- } else if (d.dragInfo instanceof ShortcutInfo) {
- componentName = ((ShortcutInfo) d.dragInfo).intent.getComponent();
- } else if (d.dragInfo instanceof PendingAddItemInfo) {
- componentName = ((PendingAddItemInfo) d.dragInfo).componentName;
- }
+ ComponentName componentName = dragItemComponentName(d.dragInfo);
if (componentName != null) {
mLauncher.startApplicationDetailsActivity(componentName);
}
@@ -90,12 +90,7 @@ public class InfoDropTarget extends ButtonDropTarget {
@Override
public void onDragStart(DragSource source, Object info, int dragAction) {
- boolean isVisible = true;
-
- // Hide this button unless we are dragging something from AllApps
- if (!isFromAllApps(source)) {
- isVisible = false;
- }
+ boolean isVisible = dragItemComponentName(info) != null;
mActive = isVisible;
mDrawable.resetTransition();