diff options
author | Adam Cohen <adamcohen@google.com> | 2011-05-24 14:07:08 -0700 |
---|---|---|
committer | Adam Cohen <adamcohen@google.com> | 2011-05-24 16:17:13 -0700 |
commit | cb3382b1bfe1a534b1b44f5c4def9b2db605ac90 (patch) | |
tree | 7f1b1e4538e0143f713582b055530d1a53f03499 /src/com/android/launcher2/Folder.java | |
parent | 7d7207f6bca8584c28c8b0b6586f262e543f2d68 (diff) | |
download | android_packages_apps_Trebuchet-cb3382b1bfe1a534b1b44f5c4def9b2db605ac90.tar.gz android_packages_apps_Trebuchet-cb3382b1bfe1a534b1b44f5c4def9b2db605ac90.tar.bz2 android_packages_apps_Trebuchet-cb3382b1bfe1a534b1b44f5c4def9b2db605ac90.zip |
Refactor of Launcher drag and drop to use a DragObject
-> DragObject contains a bunch of parameters instead of pssing
them each individually
Change-Id: I709cf320fe4234d71e19325d5c761dd9a9bba405
Diffstat (limited to 'src/com/android/launcher2/Folder.java')
-rw-r--r-- | src/com/android/launcher2/Folder.java | 28 |
1 files changed, 11 insertions, 17 deletions
diff --git a/src/com/android/launcher2/Folder.java b/src/com/android/launcher2/Folder.java index 0470e41f5..76e9b357f 100644 --- a/src/com/android/launcher2/Folder.java +++ b/src/com/android/launcher2/Folder.java @@ -363,25 +363,23 @@ public class Folder extends LinearLayout implements DragSource, OnItemLongClickL bind(mInfo); } - public boolean acceptDrop(DragSource source, int x, int y, int xOffset, int yOffset, - DragView dragView, Object dragInfo) { - final ItemInfo item = (ItemInfo) dragInfo; + public boolean acceptDrop(DragObject d) { + final ItemInfo item = (ItemInfo) d.dragInfo; final int itemType = item.itemType; return ((itemType == LauncherSettings.Favorites.ITEM_TYPE_APPLICATION || itemType == LauncherSettings.Favorites.ITEM_TYPE_SHORTCUT) && !isFull()); } - public void onDrop(DragSource source, int x, int y, int xOffset, int yOffset, - DragView dragView, Object dragInfo) { + public void onDrop(DragObject d) { ShortcutInfo item; - if (dragInfo instanceof ApplicationInfo) { + if (d.dragInfo instanceof ApplicationInfo) { // Came from all apps -- make a copy - item = ((ApplicationInfo)dragInfo).makeShortcut(); + item = ((ApplicationInfo) d.dragInfo).makeShortcut(); item.spanX = 1; item.spanY = 1; } else { - item = (ShortcutInfo)dragInfo; + item = (ShortcutInfo) d.dragInfo; } mInfo.add(item); LauncherModel.addOrMoveItemInDatabase(mLauncher, item, mInfo.id, 0, item.cellX, item.cellY); @@ -417,19 +415,16 @@ public class Folder extends LinearLayout implements DragSource, OnItemLongClickL mContent.addViewToCellLayout(textView, insert ? 0 : -1, (int)item.id, lp, true); } - public void onDragEnter(DragSource source, int x, int y, int xOffset, int yOffset, - DragView dragView, Object dragInfo) { + public void onDragEnter(DragObject d) { mContent.onDragEnter(); } - public void onDragOver(DragSource source, int x, int y, int xOffset, int yOffset, - DragView dragView, Object dragInfo) { - float[] r = mapPointFromScreenToContent(x, y, null); + public void onDragOver(DragObject d) { + float[] r = mapPointFromScreenToContent(d.x, d.y, null); mContent.visualizeDropLocation(null, null, (int) r[0], (int) r[1], 1, 1); } - public void onDragExit(DragSource source, int x, int y, int xOffset, int yOffset, - DragView dragView, Object dragInfo) { + public void onDragExit(DragObject d) { mContent.onDragExit(); } @@ -453,8 +448,7 @@ public class Folder extends LinearLayout implements DragSource, OnItemLongClickL return true; } - public DropTarget getDropTargetDelegate(DragSource source, int x, int y, int xOffset, int yOffset, - DragView dragView, Object dragInfo) { + public DropTarget getDropTargetDelegate(DragObject d) { return null; } |