summaryrefslogtreecommitdiffstats
path: root/src/com
diff options
context:
space:
mode:
authorWinson Chung <winsonc@google.com>2010-10-22 14:54:12 -0700
committerWinson Chung <winsonc@google.com>2010-10-24 13:31:32 -0700
commitece7f5b3b55cab646941123e03589241a61678e2 (patch)
tree9e98e54e195e01009f8611cf2e341a3a2ce2e61b /src/com
parent3b838ff548c129c8ea087a73f21e77a503d58f97 (diff)
downloadandroid_packages_apps_Trebuchet-ece7f5b3b55cab646941123e03589241a61678e2.tar.gz
android_packages_apps_Trebuchet-ece7f5b3b55cab646941123e03589241a61678e2.tar.bz2
android_packages_apps_Trebuchet-ece7f5b3b55cab646941123e03589241a61678e2.zip
Altering homescreen spacing to match design.
Change-Id: I8b859992fe843d0cf688cb84bcbaab6dbeccb6fb
Diffstat (limited to 'src/com')
-rw-r--r--src/com/android/launcher2/CellLayout.java22
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);