diff options
author | Winson Chung <winsonc@google.com> | 2010-10-24 13:59:29 -0700 |
---|---|---|
committer | Android (Google) Code Review <android-gerrit@google.com> | 2010-10-24 13:59:29 -0700 |
commit | 4c0505dcc2686fcb04ec6340869af4ee825dcb98 (patch) | |
tree | 98eeda2f44ce6998f68ad5d1a5c56f45a01fbaf7 /src/com | |
parent | 42a9dbce8ab88edb68341f5b34eb266efd7a1561 (diff) | |
parent | ece7f5b3b55cab646941123e03589241a61678e2 (diff) | |
download | android_packages_apps_Trebuchet-4c0505dcc2686fcb04ec6340869af4ee825dcb98.tar.gz android_packages_apps_Trebuchet-4c0505dcc2686fcb04ec6340869af4ee825dcb98.tar.bz2 android_packages_apps_Trebuchet-4c0505dcc2686fcb04ec6340869af4ee825dcb98.zip |
Merge "Altering homescreen spacing to match design."
Diffstat (limited to 'src/com')
-rw-r--r-- | src/com/android/launcher2/CellLayout.java | 22 |
1 files changed, 13 insertions, 9 deletions
diff --git a/src/com/android/launcher2/CellLayout.java b/src/com/android/launcher2/CellLayout.java index 8631e2cb6..2da5ac3d2 100644 --- a/src/com/android/launcher2/CellLayout.java +++ b/src/com/android/launcher2/CellLayout.java @@ -144,6 +144,8 @@ public class CellLayout extends ViewGroup implements Dimmable { mCellWidth = a.getDimensionPixelSize(R.styleable.CellLayout_cellWidth, 10); mCellHeight = a.getDimensionPixelSize(R.styleable.CellLayout_cellHeight, 10); + mWidthGap = a.getDimensionPixelSize(R.styleable.CellLayout_widthGap, -1); + mHeightGap = a.getDimensionPixelSize(R.styleable.CellLayout_heightGap, -1); mLeftPadding = a.getDimensionPixelSize(R.styleable.CellLayout_xAxisStartPadding, 10); @@ -734,15 +736,17 @@ public class CellLayout extends ViewGroup implements Dimmable { int numWidthGaps = mCountX - 1; int numHeightGaps = mCountY - 1; - int vSpaceLeft = heightSpecSize - mTopPadding - mBottomPadding - (cellHeight * mCountY); - mHeightGap = vSpaceLeft / numHeightGaps; + if (mWidthGap < 0 || mHeightGap < 0) { + int vSpaceLeft = heightSpecSize - mTopPadding - mBottomPadding - (cellHeight * mCountY); + mHeightGap = vSpaceLeft / numHeightGaps; - int hSpaceLeft = widthSpecSize - mLeftPadding - mRightPadding - (cellWidth * mCountX); - mWidthGap = hSpaceLeft / numWidthGaps; + int hSpaceLeft = widthSpecSize - mLeftPadding - mRightPadding - (cellWidth * mCountX); + mWidthGap = hSpaceLeft / numWidthGaps; - // center it around the min gaps - int minGap = Math.min(mWidthGap, mHeightGap); - mWidthGap = mHeightGap = minGap; + // center it around the min gaps + int minGap = Math.min(mWidthGap, mHeightGap); + mWidthGap = mHeightGap = minGap; + } int count = getChildCount(); @@ -760,9 +764,9 @@ public class CellLayout extends ViewGroup implements Dimmable { } if (widthSpecMode == MeasureSpec.AT_MOST) { int newWidth = mLeftPadding + mRightPadding + (mCountX * cellWidth) + - ((mCountX - 1) * minGap); + ((mCountX - 1) * mWidthGap); int newHeight = mTopPadding + mBottomPadding + (mCountY * cellHeight) + - ((mCountY - 1) * minGap); + ((mCountY - 1) * mHeightGap); setMeasuredDimension(newWidth, newHeight); } else if (widthSpecMode == MeasureSpec.EXACTLY) { setMeasuredDimension(widthSpecSize, heightSpecSize); |