Introducing CellPosMapper which allows mapping between UI position

and model position

Test: atest CellPosMapperTest
Bug: 188081026
Change-Id: If5c6b3df5ad240317bb535c675f6ead94084238e
This commit is contained in:
Sunny Goyal
2023-01-27 14:37:07 -08:00
parent 150b7b0497
commit 669b71f5b3
17 changed files with 385 additions and 88 deletions

View File

@@ -33,6 +33,7 @@ import androidx.annotation.Px;
import com.android.launcher3.accessibility.DragViewStateAnnouncer;
import com.android.launcher3.celllayout.CellLayoutLayoutParams;
import com.android.launcher3.celllayout.CellPosMapper.CellPos;
import com.android.launcher3.dragndrop.DragLayer;
import com.android.launcher3.keyboard.ViewGroupFocusHelper;
import com.android.launcher3.logging.InstanceId;
@@ -268,10 +269,11 @@ public class AppWidgetResizeFrame extends AbstractFloatingView implements View.O
CellLayoutLayoutParams lp = (CellLayoutLayoutParams) mWidgetView.getLayoutParams();
ItemInfo widgetInfo = (ItemInfo) mWidgetView.getTag();
lp.setCellX(widgetInfo.cellX);
lp.setTmpCellX(widgetInfo.cellX);
lp.setCellY(widgetInfo.cellY);
lp.setTmpCellY(widgetInfo.cellY);
CellPos presenterPos = mLauncher.getCellPosMapper().mapModelToPresenter(widgetInfo);
lp.setCellX(presenterPos.cellX);
lp.setTmpCellX(presenterPos.cellX);
lp.setCellY(presenterPos.cellY);
lp.setTmpCellY(presenterPos.cellY);
lp.cellHSpan = widgetInfo.spanX;
lp.cellVSpan = widgetInfo.spanY;
lp.isLockedToGrid = true;