Fixing a couple small issues with reordering (issue 7064138), (issue 7064337)

Change-Id: Iaaeb37f630a71f8fd54a6064602ddd10d4d4ab91
This commit is contained in:
Adam Cohen
2012-08-27 15:18:53 -07:00
parent 1dc3b9abd5
commit e0489500d2
2 changed files with 54 additions and 8 deletions

View File

@@ -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;