Prevent Home from crashing because of wrongly generated ids.
Change-Id: I51afba418291e8c909d1b2b0396e7c0c55b23631
This commit is contained in:
@@ -124,8 +124,7 @@ public class CellLayout extends ViewGroup {
|
||||
// Generate an id for each view, this assumes we have at most 256x256 cells
|
||||
// per workspace screen
|
||||
final LayoutParams cellParams = (LayoutParams) params;
|
||||
child.setId(((getId() & 0xFF) << 16) |
|
||||
(cellParams.cellX & 0xFF) << 8 | (cellParams.cellY & 0xFF));
|
||||
cellParams.regenerateId = true;
|
||||
|
||||
super.addView(child, index, params);
|
||||
}
|
||||
@@ -497,6 +496,11 @@ public class CellLayout extends ViewGroup {
|
||||
lp.setup(cellWidth, cellHeight, mWidthGap, mHeightGap, longAxisStartPadding,
|
||||
shortAxisStartPadding);
|
||||
}
|
||||
|
||||
if (lp.regenerateId) {
|
||||
child.setId(((getId() & 0xFF) << 16) | (lp.cellX & 0xFF) << 8 | (lp.cellY & 0xFF));
|
||||
lp.regenerateId = false;
|
||||
}
|
||||
|
||||
int childWidthMeasureSpec = MeasureSpec.makeMeasureSpec(lp.width, MeasureSpec.EXACTLY);
|
||||
int childheightMeasureSpec =
|
||||
@@ -835,6 +839,8 @@ out: for (int i = x; i < x + spanX - 1 && x < xCount; i++) {
|
||||
@ViewDebug.ExportedProperty
|
||||
int y;
|
||||
|
||||
boolean regenerateId;
|
||||
|
||||
public LayoutParams(Context c, AttributeSet attrs) {
|
||||
super(c, attrs);
|
||||
cellHSpan = 1;
|
||||
|
||||
Reference in New Issue
Block a user