summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorAdam Cohen <adamcohen@google.com>2013-07-09 15:32:37 -0700
committerAdam Cohen <adamcohen@google.com>2013-07-09 15:47:46 -0700
commitd6e7aa31546fd8c1d047a581c141c12fc23c047e (patch)
tree80d1e7e79705e53877f910d29d18022fda60a81a
parent3bc8e1738721fb82bcd4366782cb7baf55ee3dd8 (diff)
downloadandroid_packages_apps_Trebuchet-d6e7aa31546fd8c1d047a581c141c12fc23c047e.zip
android_packages_apps_Trebuchet-d6e7aa31546fd8c1d047a581c141c12fc23c047e.tar.gz
android_packages_apps_Trebuchet-d6e7aa31546fd8c1d047a581c141c12fc23c047e.tar.bz2
Fix widget resizing (Which stopped working at some point)
-> Also, deferring empty screen removal until after the drop animation in order to reduce buggy transitions -> Also fixing workspace layout on tablet Change-Id: I1ae9fdaf592262f959424f321efa6df4298f85cc
-rw-r--r--res/layout-sw720dp/launcher.xml1
-rw-r--r--src/com/android/launcher3/AppWidgetResizeFrame.java14
-rw-r--r--src/com/android/launcher3/Workspace.java7
3 files changed, 13 insertions, 9 deletions
diff --git a/res/layout-sw720dp/launcher.xml b/res/layout-sw720dp/launcher.xml
index 33fafea..dff3b26 100644
--- a/res/layout-sw720dp/launcher.xml
+++ b/res/layout-sw720dp/launcher.xml
@@ -57,6 +57,7 @@
android:paddingEnd="@dimen/workspace_right_padding"
android:paddingTop="@dimen/workspace_top_padding"
android:paddingBottom="@dimen/workspace_bottom_padding"
+ android:layout_gravity="center"
launcher:defaultScreen="@integer/config_workspaceDefaultScreen"
launcher:cellCountX="@integer/cell_count_x"
launcher:cellCountY="@integer/cell_count_y"
diff --git a/src/com/android/launcher3/AppWidgetResizeFrame.java b/src/com/android/launcher3/AppWidgetResizeFrame.java
index 8e968f8..346c0c3 100644
--- a/src/com/android/launcher3/AppWidgetResizeFrame.java
+++ b/src/com/android/launcher3/AppWidgetResizeFrame.java
@@ -58,6 +58,7 @@ public class AppWidgetResizeFrame extends FrameLayout {
int[] mDirectionVector = new int[2];
int[] mLastDirectionVector = new int[2];
+ int[] mTmpPt = new int[2];
final int SNAP_DURATION = 150;
final int BACKGROUND_PADDING = 24;
@@ -399,18 +400,17 @@ public class AppWidgetResizeFrame extends FrameLayout {
public void snapToWidget(boolean animate) {
final DragLayer.LayoutParams lp = (DragLayer.LayoutParams) getLayoutParams();
- int xOffset = mCellLayout.getLeft() + mCellLayout.getPaddingLeft()
- + mDragLayer.getPaddingLeft() - mWorkspace.getScrollX();
- int yOffset = mCellLayout.getTop() + mCellLayout.getPaddingTop()
- + mDragLayer.getPaddingTop() - mWorkspace.getScrollY();
-
int newWidth = mWidgetView.getWidth() + 2 * mBackgroundPadding - mWidgetPaddingLeft -
mWidgetPaddingRight;
int newHeight = mWidgetView.getHeight() + 2 * mBackgroundPadding - mWidgetPaddingTop -
mWidgetPaddingBottom;
- int newX = mWidgetView.getLeft() - mBackgroundPadding + xOffset + mWidgetPaddingLeft;
- int newY = mWidgetView.getTop() - mBackgroundPadding + yOffset + mWidgetPaddingTop;
+ mTmpPt[0] = mWidgetView.getLeft();
+ mTmpPt[1] = mWidgetView.getTop();
+ mDragLayer.getDescendantCoordRelativeToSelf(mCellLayout.getShortcutsAndWidgets(), mTmpPt);
+
+ int newX = mTmpPt[0] - mBackgroundPadding + mWidgetPaddingLeft;
+ int newY = mTmpPt[1] - mBackgroundPadding + mWidgetPaddingTop;
// We need to make sure the frame's touchable regions lie fully within the bounds of the
// DragLayer. We allow the actual handles to be clipped, but we shift the touch regions
diff --git a/src/com/android/launcher3/Workspace.java b/src/com/android/launcher3/Workspace.java
index d366a16..851cce5 100644
--- a/src/com/android/launcher3/Workspace.java
+++ b/src/com/android/launcher3/Workspace.java
@@ -2384,6 +2384,7 @@ public class Workspace extends SmoothPagedView
if (finalResizeRunnable != null) {
finalResizeRunnable.run();
}
+ stripEmptyScreens();
}
};
mAnimatingViewIntoPlace = true;
@@ -3364,6 +3365,10 @@ public class Workspace extends SmoothPagedView
mDragController.removeDropTarget((DropTarget) mDragInfo.cell);
}
}
+ // If we move the item to anything not on the Workspace, check if any empty
+ // screens need to be removed. If we dropped back on the workspace, this will
+ // be done post drop animation.
+ stripEmptyScreens();
}
} else if (mDragInfo != null) {
CellLayout cellLayout;
@@ -3380,8 +3385,6 @@ public class Workspace extends SmoothPagedView
mDragOutline = null;
mDragInfo = null;
- stripEmptyScreens();
-
// Hide the scrolling indicator after you pick up an item
hideScrollingIndicator(false);
}