From 1c01b6a138ee1926c552f45242887c4980f0b036 Mon Sep 17 00:00:00 2001 From: Romain Guy Date: Wed, 14 Apr 2010 14:56:34 -0700 Subject: [PATCH] Prevent view ids collisions in the workspace. Bug #2498787 Change-Id: I8f007eb2759d00f52e05e776a70510ba3a213ae9 --- src/com/android/launcher2/CellLayout.java | 11 ++--------- 1 file changed, 2 insertions(+), 9 deletions(-) diff --git a/src/com/android/launcher2/CellLayout.java b/src/com/android/launcher2/CellLayout.java index 9d39c2ca78..56b62ba911 100644 --- a/src/com/android/launcher2/CellLayout.java +++ b/src/com/android/launcher2/CellLayout.java @@ -136,8 +136,8 @@ public class CellLayout extends ViewGroup { public void addView(View child, int index, ViewGroup.LayoutParams params) { // Generate an id for each view, this assumes we have at most 256x256 cells // per workspace screen - final LayoutParams cellParams = (LayoutParams) params; - cellParams.regenerateId = true; + final LayoutParams lp = (LayoutParams) params; + child.setId(((getId() & 0xFF) << 16) | (lp.cellX & 0xFF) << 8 | (lp.cellY & 0xFF)); super.addView(child, index, params); } @@ -536,11 +536,6 @@ public class CellLayout extends ViewGroup { 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 = MeasureSpec.makeMeasureSpec(lp.height, MeasureSpec.EXACTLY); @@ -889,8 +884,6 @@ out: for (int i = x; i < x + spanX - 1 && x < xCount; i++) { @ViewDebug.ExportedProperty int y; - boolean regenerateId; - boolean dropped; public LayoutParams(Context c, AttributeSet attrs) {