summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorAdam Cohen <adamcohen@google.com>2012-03-27 17:09:36 -0700
committerAdam Cohen <adamcohen@google.com>2012-03-27 17:09:36 -0700
commitb209e634a29a0cb5514fafb4e5882ea49ba1cfa7 (patch)
treea3c9892611f229f250d6814067cf2f628b7e5338 /src
parentea889a294be004f4b1c21e9b874f9e63abfb8bd6 (diff)
downloadandroid_packages_apps_Trebuchet-b209e634a29a0cb5514fafb4e5882ea49ba1cfa7.tar.gz
android_packages_apps_Trebuchet-b209e634a29a0cb5514fafb4e5882ea49ba1cfa7.tar.bz2
android_packages_apps_Trebuchet-b209e634a29a0cb5514fafb4e5882ea49ba1cfa7.zip
Fixing small bug where final item position might not match preview
Change-Id: I216bbf2b454f92cf02b2807f684054e4dce6a05d
Diffstat (limited to 'src')
-rw-r--r--src/com/android/launcher2/CellLayout.java12
1 files changed, 7 insertions, 5 deletions
diff --git a/src/com/android/launcher2/CellLayout.java b/src/com/android/launcher2/CellLayout.java
index ce914e17a..fb319fe0c 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];