diff options
author | The Android Open Source Project <initial-contribution@android.com> | 2009-02-13 12:57:53 -0800 |
---|---|---|
committer | The Android Open Source Project <initial-contribution@android.com> | 2009-02-13 12:57:53 -0800 |
commit | 98baae654dc6e69eecb5ffab2f86c5ab217a762c (patch) | |
tree | c949cee572fe7424493e7b54247ce8462813f361 /src/com/android/launcher/CellLayout.java | |
parent | 15a8880cb1b9010ce4503c10c1666568d49415b1 (diff) | |
download | android_packages_apps_Trebuchet-98baae654dc6e69eecb5ffab2f86c5ab217a762c.tar.gz android_packages_apps_Trebuchet-98baae654dc6e69eecb5ffab2f86c5ab217a762c.tar.bz2 android_packages_apps_Trebuchet-98baae654dc6e69eecb5ffab2f86c5ab217a762c.zip |
auto import from //branches/cupcake/...@131421
Diffstat (limited to 'src/com/android/launcher/CellLayout.java')
-rw-r--r-- | src/com/android/launcher/CellLayout.java | 21 |
1 files changed, 8 insertions, 13 deletions
diff --git a/src/com/android/launcher/CellLayout.java b/src/com/android/launcher/CellLayout.java index 3e5a74ac6..ff8bff420 100644 --- a/src/com/android/launcher/CellLayout.java +++ b/src/com/android/launcher/CellLayout.java @@ -357,16 +357,10 @@ public class CellLayout extends ViewGroup { } cellInfo.valid = cellInfo.vacantCells.size() > 0; - if (cellInfo.valid) { - int[] xy = new int[2]; - if (cellInfo.findCellForSpan(xy, 1, 1)) { - cellInfo.cellX = xy[0]; - cellInfo.cellY = xy[1]; - cellInfo.spanY = 1; - cellInfo.spanX = 1; - } - } + // Assume the caller will perform their own cell searching, otherwise we + // risk causing an unnecessary rebuild after findCellForSpan() + return cellInfo; } @@ -665,9 +659,9 @@ public class CellLayout extends ViewGroup { * * @param width Width in pixels * @param height Height in pixels - * @param cellInfo {@link CellInfo} to fill with calculated span parameters + * @param Horizontal and vertical spans required */ - public void rectToCell(int width, int height, CellInfo cellInfo) { + public int[] rectToCell(int width, int height) { // Always assume we're working with the smallest span to make sure we // reserve enough space in both orientations. int actualWidth = mCellWidth + mWidthGap; @@ -675,8 +669,9 @@ public class CellLayout extends ViewGroup { int smallerSize = Math.min(actualWidth, actualHeight); // Always round up to next largest cell - cellInfo.spanX = (width + smallerSize) / smallerSize; - cellInfo.spanY = (height + smallerSize) / smallerSize; + int spanX = (width + smallerSize) / smallerSize; + int spanY = (height + smallerSize) / smallerSize; + return new int[] { spanX, spanY }; } /** |