From 2ceb3b508870219cf8b78b0dd8c5b2079eb42f46 Mon Sep 17 00:00:00 2001 From: Sebastian Franco Date: Thu, 1 Dec 2022 15:36:43 -0800 Subject: [PATCH] Adding screen ID parameter in CellLayoutLayoutParams Bug: 188081026 Test: launcher compiles, this test doesn't change existing logic only the model Change-Id: I7bcf6452d5ecb9b50914defc311ad06839220c92 --- .../launcher3/hybridhotseat/HotseatEduDialog.java | 2 +- src/com/android/launcher3/CellLayout.java | 2 +- src/com/android/launcher3/Workspace.java | 2 +- src/com/android/launcher3/WorkspaceLayoutManager.java | 2 +- .../launcher3/celllayout/CellLayoutLayoutParams.java | 11 ++++++++++- src/com/android/launcher3/folder/FolderPagedView.java | 2 +- .../launcher3/graphics/LauncherPreviewRenderer.java | 2 +- 7 files changed, 16 insertions(+), 7 deletions(-) diff --git a/quickstep/src/com/android/launcher3/hybridhotseat/HotseatEduDialog.java b/quickstep/src/com/android/launcher3/hybridhotseat/HotseatEduDialog.java index 80bdb6f153..ba412c9909 100644 --- a/quickstep/src/com/android/launcher3/hybridhotseat/HotseatEduDialog.java +++ b/quickstep/src/com/android/launcher3/hybridhotseat/HotseatEduDialog.java @@ -193,7 +193,7 @@ public class HotseatEduDialog extends AbstractSlideInView implements I icon.setEnabled(false); icon.setImportantForAccessibility(View.IMPORTANT_FOR_ACCESSIBILITY_NO); icon.verifyHighRes(); - CellLayoutLayoutParams lp = new CellLayoutLayoutParams(i, 0, 1, 1); + CellLayoutLayoutParams lp = new CellLayoutLayoutParams(i, 0, 1, 1, -1); mSampleHotseat.addViewToCellLayout(icon, i, info.getViewId(), lp, true); } } diff --git a/src/com/android/launcher3/CellLayout.java b/src/com/android/launcher3/CellLayout.java index 9c5e906c9a..fdc52b5e3d 100644 --- a/src/com/android/launcher3/CellLayout.java +++ b/src/com/android/launcher3/CellLayout.java @@ -267,7 +267,7 @@ public class CellLayout extends ViewGroup { mDragCell[0] = mDragCell[1] = -1; mDragCellSpan[0] = mDragCellSpan[1] = -1; for (int i = 0; i < mDragOutlines.length; i++) { - mDragOutlines[i] = new CellLayoutLayoutParams(0, 0, 0, 0); + mDragOutlines[i] = new CellLayoutLayoutParams(0, 0, 0, 0, -1); } mDragOutlinePaint.setColor(Themes.getAttrColor(context, R.attr.workspaceTextColor)); diff --git a/src/com/android/launcher3/Workspace.java b/src/com/android/launcher3/Workspace.java index 27c9e98e16..fd670c1707 100644 --- a/src/com/android/launcher3/Workspace.java +++ b/src/com/android/launcher3/Workspace.java @@ -582,7 +582,7 @@ public class Workspace extends PagedView } int cellHSpan = mLauncher.getDeviceProfile().inv.numSearchContainerColumns; - CellLayoutLayoutParams lp = new CellLayoutLayoutParams(0, 0, cellHSpan, 1); + CellLayoutLayoutParams lp = new CellLayoutLayoutParams(0, 0, cellHSpan, 1, FIRST_SCREEN_ID); lp.canReorder = false; if (!firstPage.addViewToCellLayout( mFirstPagePinnedItem, 0, R.id.search_container_workspace, lp, true)) { diff --git a/src/com/android/launcher3/WorkspaceLayoutManager.java b/src/com/android/launcher3/WorkspaceLayoutManager.java index 0b3a62f710..91e12faa1d 100644 --- a/src/com/android/launcher3/WorkspaceLayoutManager.java +++ b/src/com/android/launcher3/WorkspaceLayoutManager.java @@ -114,7 +114,7 @@ public interface WorkspaceLayoutManager { ViewGroup.LayoutParams genericLp = child.getLayoutParams(); CellLayoutLayoutParams lp; if (genericLp == null || !(genericLp instanceof CellLayoutLayoutParams)) { - lp = new CellLayoutLayoutParams(x, y, spanX, spanY); + lp = new CellLayoutLayoutParams(x, y, spanX, spanY, screenId); } else { lp = (CellLayoutLayoutParams) genericLp; lp.cellX = x; diff --git a/src/com/android/launcher3/celllayout/CellLayoutLayoutParams.java b/src/com/android/launcher3/celllayout/CellLayoutLayoutParams.java index b14ae8d136..abd4682701 100644 --- a/src/com/android/launcher3/celllayout/CellLayoutLayoutParams.java +++ b/src/com/android/launcher3/celllayout/CellLayoutLayoutParams.java @@ -28,6 +28,9 @@ import androidx.annotation.Nullable; * Represents the logic of where a view is in a CellLayout and its size */ public class CellLayoutLayoutParams extends ViewGroup.MarginLayoutParams { + + public int screenId = -1; + /** * Horizontal location of the item in the grid. */ @@ -106,14 +109,20 @@ public class CellLayoutLayoutParams extends ViewGroup.MarginLayoutParams { this.cellY = source.cellY; this.cellHSpan = source.cellHSpan; this.cellVSpan = source.cellVSpan; + this.screenId = source.screenId; + this.tmpCellX = source.tmpCellX; + this.tmpCellY = source.tmpCellY; + this.useTmpCoords = source.useTmpCoords; } - public CellLayoutLayoutParams(int cellX, int cellY, int cellHSpan, int cellVSpan) { + public CellLayoutLayoutParams(int cellX, int cellY, int cellHSpan, int cellVSpan, + int screenId) { super(CellLayoutLayoutParams.MATCH_PARENT, CellLayoutLayoutParams.MATCH_PARENT); this.cellX = cellX; this.cellY = cellY; this.cellHSpan = cellHSpan; this.cellVSpan = cellVSpan; + this.screenId = screenId; } /** diff --git a/src/com/android/launcher3/folder/FolderPagedView.java b/src/com/android/launcher3/folder/FolderPagedView.java index b87ab17cb3..141388f3c5 100644 --- a/src/com/android/launcher3/folder/FolderPagedView.java +++ b/src/com/android/launcher3/folder/FolderPagedView.java @@ -223,7 +223,7 @@ public class FolderPagedView extends PagedView implements Cli CellLayoutLayoutParams lp = (CellLayoutLayoutParams) textView.getLayoutParams(); if (lp == null) { textView.setLayoutParams(new CellLayoutLayoutParams( - item.cellX, item.cellY, item.spanX, item.spanY)); + item.cellX, item.cellY, item.spanX, item.spanY, item.screenId)); } else { lp.cellX = item.cellX; lp.cellY = item.cellY; diff --git a/src/com/android/launcher3/graphics/LauncherPreviewRenderer.java b/src/com/android/launcher3/graphics/LauncherPreviewRenderer.java index 2361907ed4..772913db8f 100644 --- a/src/com/android/launcher3/graphics/LauncherPreviewRenderer.java +++ b/src/com/android/launcher3/graphics/LauncherPreviewRenderer.java @@ -534,7 +534,7 @@ public class LauncherPreviewRenderer extends ContextWrapper View qsb = mHomeElementInflater.inflate(R.layout.qsb_preview, firstScreen, false); CellLayoutLayoutParams lp = new CellLayoutLayoutParams(0, 0, firstScreen.getCountX(), - 1); + 1, FIRST_SCREEN_ID); lp.canReorder = false; firstScreen.addViewToCellLayout(qsb, 0, R.id.search_container_workspace, lp, true); }