summaryrefslogtreecommitdiffstats
path: root/src/com/android/launcher2/AppWidgetResizeFrame.java
diff options
context:
space:
mode:
authorAdam Cohen <adamcohen@google.com>2012-08-27 15:18:53 -0700
committerAdam Cohen <adamcohen@google.com>2012-08-27 15:19:51 -0700
commite0489500d2a2cf410cb3cb687cbc59e966d7084e (patch)
tree97a156ad6b62621815cc6402190d196846697f2c /src/com/android/launcher2/AppWidgetResizeFrame.java
parent1dc3b9abd5ab0a39bab7694669d6784b89d362ef (diff)
downloadandroid_packages_apps_Trebuchet-e0489500d2a2cf410cb3cb687cbc59e966d7084e.tar.gz
android_packages_apps_Trebuchet-e0489500d2a2cf410cb3cb687cbc59e966d7084e.tar.bz2
android_packages_apps_Trebuchet-e0489500d2a2cf410cb3cb687cbc59e966d7084e.zip
Fixing a couple small issues with reordering (issue 7064138), (issue 7064337)
Change-Id: Iaaeb37f630a71f8fd54a6064602ddd10d4d4ab91
Diffstat (limited to 'src/com/android/launcher2/AppWidgetResizeFrame.java')
-rw-r--r--src/com/android/launcher2/AppWidgetResizeFrame.java19
1 files changed, 17 insertions, 2 deletions
diff --git a/src/com/android/launcher2/AppWidgetResizeFrame.java b/src/com/android/launcher2/AppWidgetResizeFrame.java
index 2070eb638..eb60054cb 100644
--- a/src/com/android/launcher2/AppWidgetResizeFrame.java
+++ b/src/com/android/launcher2/AppWidgetResizeFrame.java
@@ -57,6 +57,7 @@ public class AppWidgetResizeFrame extends FrameLayout {
private int mBottomTouchRegionAdjustment = 0;
int[] mDirectionVector = new int[2];
+ int[] mLastDirectionVector = new int[2];
final int SNAP_DURATION = 150;
final int BACKGROUND_PADDING = 24;
@@ -293,17 +294,31 @@ public class AppWidgetResizeFrame extends FrameLayout {
if (mLeftBorderActive || mRightBorderActive) {
spanX += hSpanInc;
cellX += cellXInc;
- mDirectionVector[0] = mLeftBorderActive ? -1 : 1;
+ if (hSpanDelta != 0) {
+ mDirectionVector[0] = mLeftBorderActive ? -1 : 1;
+ }
}
if (mTopBorderActive || mBottomBorderActive) {
spanY += vSpanInc;
cellY += cellYInc;
- mDirectionVector[1] = mTopBorderActive ? -1 : 1;
+ if (vSpanDelta != 0) {
+ mDirectionVector[1] = mTopBorderActive ? -1 : 1;
+ }
}
if (!onDismiss && vSpanDelta == 0 && hSpanDelta == 0) return;
+ // We always want the final commit to match the feedback, so we make sure to use the
+ // last used direction vector when committing the resize / reorder.
+ if (onDismiss) {
+ mDirectionVector[0] = mLastDirectionVector[0];
+ mDirectionVector[1] = mLastDirectionVector[1];
+ } else {
+ mLastDirectionVector[0] = mDirectionVector[0];
+ mLastDirectionVector[1] = mDirectionVector[1];
+ }
+
if (mCellLayout.createAreaForResize(cellX, cellY, spanX, spanY, mWidgetView,
mDirectionVector, onDismiss)) {
lp.tmpCellX = cellX;