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
This commit is contained in:
@@ -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);
|
||||
}
|
||||
|
||||
/*
|
||||
|
||||
Reference in New Issue
Block a user