Merge "Adding screen ID parameter in CellLayoutLayoutParams" into tm-qpr-dev

This commit is contained in:
Sebastián Franco
2022-12-03 01:32:25 +00:00
committed by Android (Google) Code Review
7 changed files with 16 additions and 7 deletions

View File

@@ -193,7 +193,7 @@ public class HotseatEduDialog extends AbstractSlideInView<Launcher> 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);
}
}

View File

@@ -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));

View File

@@ -582,7 +582,7 @@ public class Workspace<T extends View & PageIndicator> extends PagedView<T>
}
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)) {

View File

@@ -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;

View File

@@ -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;
}
/**

View File

@@ -223,7 +223,7 @@ public class FolderPagedView extends PagedView<PageIndicatorDots> 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;

View File

@@ -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);
}