diff options
author | Adam Cohen <adamcohen@google.com> | 2012-08-16 17:55:58 -0700 |
---|---|---|
committer | Adam Cohen <adamcohen@google.com> | 2012-08-20 21:49:43 -0700 |
commit | 307fe23f125cbbd5512ad8d4660025f2ab68f30b (patch) | |
tree | 0bb74d508939237e628e96fade69d3b5ccf3c07b /src/com/android/launcher2/Workspace.java | |
parent | 5c768e2fac95f8b8b2d6b5c523d7e1cdc968e395 (diff) | |
download | android_packages_apps_Trebuchet-307fe23f125cbbd5512ad8d4660025f2ab68f30b.tar.gz android_packages_apps_Trebuchet-307fe23f125cbbd5512ad8d4660025f2ab68f30b.tar.bz2 android_packages_apps_Trebuchet-307fe23f125cbbd5512ad8d4660025f2ab68f30b.zip |
Adding the ability to scale the hotseat or items in the hotseat
--> A bunch of stuff breaks when scaling the hotseat. More specifically,
drag and drop animations between hotseat and workspace,
scaling on pick up, folder animations, determination of
item placement. This CL fixes these issues so that the
hotseat or hotseat items are ready to be scaled.
--> For now, using 90% scale factor for 7-inch+ UIs
Change-Id: Iac098409347e76139e4d726a071397b56ac684d2
Diffstat (limited to 'src/com/android/launcher2/Workspace.java')
-rw-r--r-- | src/com/android/launcher2/Workspace.java | 20 |
1 files changed, 7 insertions, 13 deletions
diff --git a/src/com/android/launcher2/Workspace.java b/src/com/android/launcher2/Workspace.java index d1d47f5f6..504f9dcfe 100644 --- a/src/com/android/launcher2/Workspace.java +++ b/src/com/android/launcher2/Workspace.java @@ -1892,11 +1892,11 @@ public class Workspace extends SmoothPagedView final int bmpWidth = b.getWidth(); final int bmpHeight = b.getHeight(); - mLauncher.getDragLayer().getLocationInDragLayer(child, mTempXY); + float scale = mLauncher.getDragLayer().getLocationInDragLayer(child, mTempXY); int dragLayerX = - Math.round(mTempXY[0] - (bmpWidth - child.getScaleX() * child.getWidth()) / 2); + Math.round(mTempXY[0] - (bmpWidth - scale * child.getWidth()) / 2); int dragLayerY = - Math.round(mTempXY[1] - (bmpHeight - child.getScaleY() * bmpHeight) / 2 + Math.round(mTempXY[1] - (bmpHeight - scale * bmpHeight) / 2 - DRAG_BITMAP_PADDING / 2); Point dragVisualizeOffset = null; @@ -1926,7 +1926,7 @@ public class Workspace extends SmoothPagedView } mDragController.startDrag(b, dragLayerX, dragLayerY, source, child.getTag(), - DragController.DRAG_ACTION_MOVE, dragVisualizeOffset, dragRect, child.getScaleX()); + DragController.DRAG_ACTION_MOVE, dragVisualizeOffset, dragRect, scale); b.recycle(); // Show the scrolling indicator when you pick up an item @@ -1966,7 +1966,7 @@ public class Workspace extends SmoothPagedView // We want the point to be mapped to the dragTarget. if (mLauncher.isHotseatLayout(dropTargetLayout)) { - mapPointFromSelfToSibling(mLauncher.getHotseat(), mDragViewVisualCenter); + mapPointFromSelfToHotseatLayout(mLauncher.getHotseat(), mDragViewVisualCenter); } else { mapPointFromSelfToChild(dropTargetLayout, mDragViewVisualCenter, null); } @@ -2577,18 +2577,12 @@ public class Workspace extends SmoothPagedView cachedInverseMatrix.mapPoints(xy); } - /* - * Maps a point from the Workspace's coordinate system to another sibling view's. (Workspace - * covers the full screen) - */ - void mapPointFromSelfToSibling(View v, float[] xy) { - xy[0] = xy[0] - v.getLeft(); - xy[1] = xy[1] - v.getTop(); - } void mapPointFromSelfToHotseatLayout(Hotseat hotseat, float[] xy) { + hotseat.getLayout().getMatrix().invert(mTempInverseMatrix); xy[0] = xy[0] - hotseat.getLeft() - hotseat.getLayout().getLeft(); xy[1] = xy[1] - hotseat.getTop() - hotseat.getLayout().getTop(); + mTempInverseMatrix.mapPoints(xy); } /* |