am f721b398
: Merge "Prevent cases of bogus action bar measurement." into honeycomb-mr2
* commit 'f721b398ad69503e1212e5fe8a44d176d25f135a': Prevent cases of bogus action bar measurement.
This commit is contained in:
@ -410,7 +410,7 @@ public class ActionBarContextView extends ViewGroup implements AnimatorListener
|
|||||||
availableWidth -= child.getMeasuredWidth();
|
availableWidth -= child.getMeasuredWidth();
|
||||||
availableWidth -= spacing;
|
availableWidth -= spacing;
|
||||||
|
|
||||||
return availableWidth;
|
return Math.max(0, availableWidth);
|
||||||
}
|
}
|
||||||
|
|
||||||
private int positionChild(View child, int x, int y, int contentHeight) {
|
private int positionChild(View child, int x, int y, int contentHeight) {
|
||||||
|
@ -635,48 +635,48 @@ public class ActionBarView extends ViewGroup {
|
|||||||
mHomeLayout.measure(MeasureSpec.makeMeasureSpec(availableWidth, MeasureSpec.AT_MOST),
|
mHomeLayout.measure(MeasureSpec.makeMeasureSpec(availableWidth, MeasureSpec.AT_MOST),
|
||||||
MeasureSpec.makeMeasureSpec(height, MeasureSpec.EXACTLY));
|
MeasureSpec.makeMeasureSpec(height, MeasureSpec.EXACTLY));
|
||||||
final int homeWidth = mHomeLayout.getMeasuredWidth();
|
final int homeWidth = mHomeLayout.getMeasuredWidth();
|
||||||
availableWidth -= homeWidth;
|
availableWidth = Math.max(0, availableWidth - homeWidth);
|
||||||
leftOfCenter -= homeWidth;
|
leftOfCenter = Math.max(0, availableWidth - homeWidth);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (mMenuView != null) {
|
if (mMenuView != null) {
|
||||||
availableWidth = measureChildView(mMenuView, availableWidth,
|
availableWidth = measureChildView(mMenuView, availableWidth,
|
||||||
childSpecHeight, 0);
|
childSpecHeight, 0);
|
||||||
rightOfCenter -= mMenuView.getMeasuredWidth();
|
rightOfCenter = Math.max(0, rightOfCenter - mMenuView.getMeasuredWidth());
|
||||||
}
|
}
|
||||||
|
|
||||||
boolean showTitle = mTitleLayout != null && mTitleLayout.getVisibility() != GONE &&
|
boolean showTitle = mTitleLayout != null && mTitleLayout.getVisibility() != GONE &&
|
||||||
(mDisplayOptions & ActionBar.DISPLAY_SHOW_TITLE) != 0;
|
(mDisplayOptions & ActionBar.DISPLAY_SHOW_TITLE) != 0;
|
||||||
if (showTitle) {
|
if (showTitle) {
|
||||||
availableWidth = measureChildView(mTitleLayout, availableWidth, childSpecHeight, 0);
|
availableWidth = measureChildView(mTitleLayout, availableWidth, childSpecHeight, 0);
|
||||||
leftOfCenter -= mTitleLayout.getMeasuredWidth();
|
leftOfCenter = Math.max(0, leftOfCenter - mTitleLayout.getMeasuredWidth());
|
||||||
}
|
}
|
||||||
|
|
||||||
switch (mNavigationMode) {
|
switch (mNavigationMode) {
|
||||||
case ActionBar.NAVIGATION_MODE_LIST:
|
case ActionBar.NAVIGATION_MODE_LIST:
|
||||||
if (mListNavLayout != null) {
|
if (mListNavLayout != null) {
|
||||||
final int itemPaddingSize = showTitle ? mItemPadding * 2 : mItemPadding;
|
final int itemPaddingSize = showTitle ? mItemPadding * 2 : mItemPadding;
|
||||||
availableWidth -= itemPaddingSize;
|
availableWidth = Math.max(0, availableWidth - itemPaddingSize);
|
||||||
leftOfCenter -= itemPaddingSize;
|
leftOfCenter = Math.max(0, leftOfCenter - itemPaddingSize);
|
||||||
mListNavLayout.measure(
|
mListNavLayout.measure(
|
||||||
MeasureSpec.makeMeasureSpec(availableWidth, MeasureSpec.AT_MOST),
|
MeasureSpec.makeMeasureSpec(availableWidth, MeasureSpec.AT_MOST),
|
||||||
MeasureSpec.makeMeasureSpec(height, MeasureSpec.EXACTLY));
|
MeasureSpec.makeMeasureSpec(height, MeasureSpec.EXACTLY));
|
||||||
final int listNavWidth = mListNavLayout.getMeasuredWidth();
|
final int listNavWidth = mListNavLayout.getMeasuredWidth();
|
||||||
availableWidth -= listNavWidth;
|
availableWidth = Math.max(0, availableWidth - listNavWidth);
|
||||||
leftOfCenter -= listNavWidth;
|
leftOfCenter = Math.max(0, leftOfCenter - listNavWidth);
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
case ActionBar.NAVIGATION_MODE_TABS:
|
case ActionBar.NAVIGATION_MODE_TABS:
|
||||||
if (mTabScrollView != null) {
|
if (mTabScrollView != null) {
|
||||||
final int itemPaddingSize = showTitle ? mItemPadding * 2 : mItemPadding;
|
final int itemPaddingSize = showTitle ? mItemPadding * 2 : mItemPadding;
|
||||||
availableWidth -= itemPaddingSize;
|
availableWidth = Math.max(0, availableWidth - itemPaddingSize);
|
||||||
leftOfCenter -= itemPaddingSize;
|
leftOfCenter = Math.max(0, leftOfCenter - itemPaddingSize);
|
||||||
mTabScrollView.measure(
|
mTabScrollView.measure(
|
||||||
MeasureSpec.makeMeasureSpec(availableWidth, MeasureSpec.AT_MOST),
|
MeasureSpec.makeMeasureSpec(availableWidth, MeasureSpec.AT_MOST),
|
||||||
MeasureSpec.makeMeasureSpec(height, MeasureSpec.EXACTLY));
|
MeasureSpec.makeMeasureSpec(height, MeasureSpec.EXACTLY));
|
||||||
final int tabWidth = mTabScrollView.getMeasuredWidth();
|
final int tabWidth = mTabScrollView.getMeasuredWidth();
|
||||||
availableWidth -= tabWidth;
|
availableWidth = Math.max(0, availableWidth - tabWidth);
|
||||||
leftOfCenter -= tabWidth;
|
leftOfCenter = Math.max(0, leftOfCenter - tabWidth);
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
@ -685,7 +685,8 @@ public class ActionBarView extends ViewGroup {
|
|||||||
mIndeterminateProgressView.getVisibility() != GONE) {
|
mIndeterminateProgressView.getVisibility() != GONE) {
|
||||||
availableWidth = measureChildView(mIndeterminateProgressView, availableWidth,
|
availableWidth = measureChildView(mIndeterminateProgressView, availableWidth,
|
||||||
childSpecHeight, 0);
|
childSpecHeight, 0);
|
||||||
rightOfCenter -= mIndeterminateProgressView.getMeasuredWidth();
|
rightOfCenter = Math.max(0,
|
||||||
|
rightOfCenter - mIndeterminateProgressView.getMeasuredWidth());
|
||||||
}
|
}
|
||||||
|
|
||||||
if ((mDisplayOptions & ActionBar.DISPLAY_SHOW_CUSTOM) != 0 && mCustomNavView != null) {
|
if ((mDisplayOptions & ActionBar.DISPLAY_SHOW_CUSTOM) != 0 && mCustomNavView != null) {
|
||||||
@ -764,7 +765,7 @@ public class ActionBarView extends ViewGroup {
|
|||||||
availableWidth -= child.getMeasuredWidth();
|
availableWidth -= child.getMeasuredWidth();
|
||||||
availableWidth -= spacing;
|
availableWidth -= spacing;
|
||||||
|
|
||||||
return availableWidth;
|
return Math.max(0, availableWidth);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
Reference in New Issue
Block a user