OSDN Git Service

Fixing issue where dropping items onto side pages might drop them two pages away...
authorWinson Chung <winsonc@google.com>
Mon, 18 Jun 2012 22:09:17 +0000 (15:09 -0700)
committerWinson Chung <winsonc@google.com>
Mon, 18 Jun 2012 22:09:39 +0000 (15:09 -0700)
Change-Id: I7fa745c269e63d699671cdaf0b527f2675ce3081

src/com/android/launcher2/Workspace.java

index e18d8ef..174d23b 100644 (file)
@@ -2385,7 +2385,13 @@ public class Workspace extends SmoothPagedView
         // Here we store the final page that will be dropped to, if the workspace in fact
         // receives the drop
         if (mInScrollArea) {
-            mDropToLayout = mDragOverlappingLayout;
+            if (isPageMoving()) {
+                // If the user drops while the page is scrolling, we should use that page as the
+                // destination instead of the page that is being hovered over.
+                mDropToLayout = (CellLayout) getPageAt(getNextPage());
+            } else {
+                mDropToLayout = mDragOverlappingLayout;
+            }
         } else {
             mDropToLayout = mDragTargetLayout;
         }