Show resize frame when widget is added.

I referenced the code in Workspace.java that updates the widget view's
layout params before showing the resize frame.

Test: manual, AddWidgetTest and AddConfigWidgetTest tapl tests
Bug: 183437963
Change-Id: I6655917878fa22d6084b4bf39fc0661e7278d6f9
This commit is contained in:
Yogisha Dixit
2021-03-22 14:13:03 +00:00
parent 9b8932f579
commit 037a5362d8
4 changed files with 47 additions and 1 deletions

View File

@@ -262,6 +262,14 @@ public class AppWidgetResizeFrame extends AbstractFloatingView implements View.O
}
}
CellLayout.LayoutParams lp = (CellLayout.LayoutParams) mWidgetView.getLayoutParams();
ItemInfo widgetInfo = (ItemInfo) mWidgetView.getTag();
lp.cellX = lp.tmpCellX = widgetInfo.cellX;
lp.cellY = lp.tmpCellY = widgetInfo.cellY;
lp.cellHSpan = widgetInfo.spanX;
lp.cellVSpan = widgetInfo.spanY;
lp.isLockedToGrid = true;
// When we create the resize frame, we first mark all cells as unoccupied. The appropriate
// cells (same if not resized, or different) will be marked as occupied when the resize
// frame is dismissed.
@@ -270,7 +278,7 @@ public class AppWidgetResizeFrame extends AbstractFloatingView implements View.O
mLauncher.getStatsLogManager()
.logger()
.withInstanceId(logInstanceId)
.withItemInfo((ItemInfo) mWidgetView.getTag())
.withItemInfo(widgetInfo)
.log(LAUNCHER_WIDGET_RESIZE_STARTED);
setOnKeyListener(this);