Scale widgets when dragging and dropping in multi-window mode.

This change mimics the non-MW mode behavior when dragging and
dropping widgets by taking the app widget scale into consideration.
This ensures a consistant drag and drop experience between
MW mode and non-MW mode.

* Uses cell data (cell height/width, spanX/Y) to get the expected
widget sizes.
* Scales sizes when necessary.

Bug: 32176631
Change-Id: Icdaf73ecd89a30e57fe7f405292d793f2d6a3ee8
This commit is contained in:
Jon Miranda
2016-12-05 12:04:44 -08:00
parent 4633be64e8
commit f7ff3fe58a
3 changed files with 57 additions and 18 deletions

View File

@@ -3467,14 +3467,14 @@ public class Workspace extends PagedView
mLauncher.getDragLayer().getDescendantCoordRelativeToSelf(layout, loc, true);
resetTransitionTransform(layout);
float dragViewScaleX;
float dragViewScaleY;
float dragViewScaleX = 1f;
float dragViewScaleY = 1f;
if (scale) {
dragViewScaleX = (1.0f * r.width()) / dragView.getMeasuredWidth();
dragViewScaleY = (1.0f * r.height()) / dragView.getMeasuredHeight();
} else {
dragViewScaleX = 1f;
dragViewScaleY = 1f;
float width = info.spanX * layout.mCellWidth;
float height = info.spanY * layout.mCellHeight;
dragViewScaleX = r.width() / width;
dragViewScaleY = r.height() / height;
}
// The animation will scale the dragView about its center, so we need to center about