Fixing issue where dropping items onto side pages might drop them two pages away. (Bug 6433177)
Change-Id: I7fa745c269e63d699671cdaf0b527f2675ce3081
diff --git a/src/com/android/launcher2/Workspace.java b/src/com/android/launcher2/Workspace.java
index e18d8ef..174d23b 100644
--- a/src/com/android/launcher2/Workspace.java
+++ b/src/com/android/launcher2/Workspace.java
@@ -2385,7 +2385,13 @@
// 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;
}