Tweaking styles for AllApps and widgets spaces. (Bug 10843502)

- Fixing various issues with Search bar showing when it shouldn't be.

Change-Id: I2a553ad93e3422666a883b90a1ff97625bf05831
This commit is contained in:
Winson Chung
2013-09-23 16:53:31 -07:00
parent 1e4e6ddb38
commit 2d75f125f4
10 changed files with 72 additions and 98 deletions

View File

@@ -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);
}
}