diff options
author | Adam Cohen <adamcohen@google.com> | 2012-03-27 17:09:36 -0700 |
---|---|---|
committer | Adam Cohen <adamcohen@google.com> | 2012-03-27 17:09:36 -0700 |
commit | b209e634a29a0cb5514fafb4e5882ea49ba1cfa7 (patch) | |
tree | a3c9892611f229f250d6814067cf2f628b7e5338 /src/com/android/launcher2/CellLayout.java | |
parent | ea889a294be004f4b1c21e9b874f9e63abfb8bd6 (diff) | |
download | packages_apps_trebuchet-b209e634a29a0cb5514fafb4e5882ea49ba1cfa7.zip packages_apps_trebuchet-b209e634a29a0cb5514fafb4e5882ea49ba1cfa7.tar.gz packages_apps_trebuchet-b209e634a29a0cb5514fafb4e5882ea49ba1cfa7.tar.bz2 |
Fixing small bug where final item position might not match preview
Change-Id: I216bbf2b454f92cf02b2807f684054e4dce6a05d
Diffstat (limited to 'src/com/android/launcher2/CellLayout.java')
-rw-r--r-- | src/com/android/launcher2/CellLayout.java | 12 |
1 files changed, 7 insertions, 5 deletions
diff --git a/src/com/android/launcher2/CellLayout.java b/src/com/android/launcher2/CellLayout.java index ce914e1..fb319fe 100644 --- a/src/com/android/launcher2/CellLayout.java +++ b/src/com/android/launcher2/CellLayout.java @@ -159,6 +159,7 @@ public class CellLayout extends ViewGroup { private Rect mOccupiedRect = new Rect(); private int[] mDirectionVector = new int[2]; int[] mPreviousReorderDirection = new int[2]; + private static final int INVALID_DIRECTION = -100; public CellLayout(Context context) { this(context, null); @@ -2215,15 +2216,16 @@ public class CellLayout extends ViewGroup { // When we are checking drop validity or actually dropping, we don't recompute the // direction vector, since we want the solution to match the preview, and it's possible // that the exact position of the item has changed to result in a new reordering outcome. - if ((mode == MODE_ON_DROP || mode == MODE_ACCEPT_DROP) - && mPreviousReorderDirection[0] != -1) { + if ((mode == MODE_ON_DROP || mode == MODE_ON_DROP_EXTERNAL || mode == MODE_ACCEPT_DROP) + && mPreviousReorderDirection[0] != INVALID_DIRECTION) { mDirectionVector[0] = mPreviousReorderDirection[0]; mDirectionVector[1] = mPreviousReorderDirection[1]; // We reset this vector after drop - if (mode == MODE_ON_DROP) { - mPreviousReorderDirection[0] = -1; - mPreviousReorderDirection[1] = -1; + if (mode == MODE_ON_DROP || mode == MODE_ON_DROP_EXTERNAL) { + mPreviousReorderDirection[0] = INVALID_DIRECTION; + mPreviousReorderDirection[1] = INVALID_DIRECTION; } + } else { getDirectionVectorForDrop(pixelX, pixelY, spanX, spanY, dragView, mDirectionVector); mPreviousReorderDirection[0] = mDirectionVector[0]; |