summaryrefslogtreecommitdiffstats
path: root/src/com/android/launcher3/CellLayout.java
diff options
context:
space:
mode:
authorWinson Chung <winsonc@google.com>2013-09-23 16:53:31 -0700
committerWinson Chung <winsonc@google.com>2013-09-24 11:55:17 -0700
commit2d75f125f4e8bb5358dfdb63096d0493488ac2e5 (patch)
tree3f27bfd9e96f26c7a3beb5a43ffb0c6a43d4fe51 /src/com/android/launcher3/CellLayout.java
parent1e4e6ddb38d0b867d0564be834f3425ed53d46e1 (diff)
downloadandroid_packages_apps_Trebuchet-2d75f125f4e8bb5358dfdb63096d0493488ac2e5.tar.gz
android_packages_apps_Trebuchet-2d75f125f4e8bb5358dfdb63096d0493488ac2e5.tar.bz2
android_packages_apps_Trebuchet-2d75f125f4e8bb5358dfdb63096d0493488ac2e5.zip
Tweaking styles for AllApps and widgets spaces. (Bug 10843502)
- Fixing various issues with Search bar showing when it shouldn't be. Change-Id: I2a553ad93e3422666a883b90a1ff97625bf05831
Diffstat (limited to 'src/com/android/launcher3/CellLayout.java')
-rw-r--r--src/com/android/launcher3/CellLayout.java35
1 files changed, 22 insertions, 13 deletions
diff --git a/src/com/android/launcher3/CellLayout.java b/src/com/android/launcher3/CellLayout.java
index 30ca7376b..22492ac31 100644
--- a/src/com/android/launcher3/CellLayout.java
+++ b/src/com/android/launcher3/CellLayout.java
@@ -949,9 +949,11 @@ public class CellLayout extends ViewGroup {
int heightSpecMode = MeasureSpec.getMode(heightMeasureSpec);
int widthSize = MeasureSpec.getSize(widthMeasureSpec);
int heightSize = MeasureSpec.getSize(heightMeasureSpec);
+ int childWidthSize = widthSize - (getPaddingLeft() + getPaddingRight());
+ int childHeightSize = heightSize - (getPaddingTop() + getPaddingBottom());
if (mFixedCellWidth < 0 || mFixedCellHeight < 0) {
- int cw = grid.calculateCellWidth(widthSize, mCountX);
- int ch = grid.calculateCellHeight(heightSize, mCountY);
+ int cw = grid.calculateCellWidth(childWidthSize, mCountX);
+ int ch = grid.calculateCellHeight(childHeightSize, mCountY);
if (cw != mCellWidth || ch != mCellHeight) {
mCellWidth = cw;
mCellHeight = ch;
@@ -960,8 +962,8 @@ public class CellLayout extends ViewGroup {
}
}
- int newWidth = widthSize;
- int newHeight = heightSize;
+ int newWidth = childWidthSize;
+ int newHeight = childHeightSize;
if (mFixedWidth > 0 && mFixedHeight > 0) {
newWidth = mFixedWidth;
newHeight = mFixedHeight;
@@ -973,8 +975,8 @@ public class CellLayout extends ViewGroup {
int numHeightGaps = mCountY - 1;
if (mOriginalWidthGap < 0 || mOriginalHeightGap < 0) {
- int hSpace = widthSize - getPaddingLeft() - getPaddingRight();
- int vSpace = heightSize - getPaddingTop() - getPaddingBottom();
+ int hSpace = childWidthSize;
+ int vSpace = childHeightSize;
int hFreeSpace = hSpace - (mCountX * mCellWidth);
int vFreeSpace = vSpace - (mCountY * mCellHeight);
mWidthGap = Math.min(mMaxGap, numWidthGaps > 0 ? (hFreeSpace / numWidthGaps) : 0);
@@ -990,15 +992,19 @@ public class CellLayout extends ViewGroup {
int maxHeight = 0;
for (int i = 0; i < count; i++) {
View child = getChildAt(i);
- int childWidthMeasureSpec = MeasureSpec.makeMeasureSpec(newWidth - getPaddingLeft() -
- getPaddingRight(), MeasureSpec.EXACTLY);
- int childheightMeasureSpec = MeasureSpec.makeMeasureSpec(newHeight - getPaddingTop() -
- getPaddingBottom(), MeasureSpec.EXACTLY);
+ int childWidthMeasureSpec = MeasureSpec.makeMeasureSpec(newWidth,
+ MeasureSpec.EXACTLY);
+ int childheightMeasureSpec = MeasureSpec.makeMeasureSpec(newHeight,
+ MeasureSpec.EXACTLY);
child.measure(childWidthMeasureSpec, childheightMeasureSpec);
maxWidth = Math.max(maxWidth, child.getMeasuredWidth());
maxHeight = Math.max(maxHeight, child.getMeasuredHeight());
}
- setMeasuredDimension(maxWidth, maxHeight);
+ if (mFixedWidth > 0 && mFixedHeight > 0) {
+ setMeasuredDimension(maxWidth, maxHeight);
+ } else {
+ setMeasuredDimension(widthSize, heightSize);
+ }
}
@Override
@@ -1006,8 +1012,11 @@ public class CellLayout extends ViewGroup {
int count = getChildCount();
for (int i = 0; i < count; i++) {
View child = getChildAt(i);
- child.layout(getPaddingLeft(), getPaddingTop(),
- r - l - getPaddingRight(), b - t - getPaddingBottom());
+ int left = getPaddingLeft();
+ int top = getPaddingTop();
+ child.layout(left, top,
+ left + r - l,
+ top + b - t);
}
}