Merge "Fix bug 5091886 - action bar measurement"

This commit is contained in:
Adam Powell
2011-08-25 11:49:13 -07:00
committed by Android (Google) Code Review

View File

@@ -826,15 +826,18 @@ public class ActionBarView extends AbsActionBarView {
rightOfCenter = Math.max(0, rightOfCenter - mMenuView.getMeasuredWidth()); rightOfCenter = Math.max(0, rightOfCenter - mMenuView.getMeasuredWidth());
} }
if (mExpandedActionView == null) { if (mIndeterminateProgressView != null &&
boolean showTitle = mTitleLayout != null && mTitleLayout.getVisibility() != GONE && mIndeterminateProgressView.getVisibility() != GONE) {
(mDisplayOptions & ActionBar.DISPLAY_SHOW_TITLE) != 0; availableWidth = measureChildView(mIndeterminateProgressView, availableWidth,
if (showTitle) { childSpecHeight, 0);
availableWidth = measureChildView(mTitleLayout, availableWidth, rightOfCenter = Math.max(0,
MeasureSpec.makeMeasureSpec(mContentHeight, MeasureSpec.EXACTLY), 0); rightOfCenter - mIndeterminateProgressView.getMeasuredWidth());
leftOfCenter = Math.max(0, leftOfCenter - mTitleLayout.getMeasuredWidth()); }
}
final boolean showTitle = mTitleLayout != null && mTitleLayout.getVisibility() != GONE &&
(mDisplayOptions & ActionBar.DISPLAY_SHOW_TITLE) != 0;
if (mExpandedActionView == null) {
switch (mNavigationMode) { switch (mNavigationMode) {
case ActionBar.NAVIGATION_MODE_LIST: case ActionBar.NAVIGATION_MODE_LIST:
if (mListNavLayout != null) { if (mListNavLayout != null) {
@@ -865,14 +868,6 @@ public class ActionBarView extends AbsActionBarView {
} }
} }
if (mIndeterminateProgressView != null &&
mIndeterminateProgressView.getVisibility() != GONE) {
availableWidth = measureChildView(mIndeterminateProgressView, availableWidth,
childSpecHeight, 0);
rightOfCenter = Math.max(0,
rightOfCenter - mIndeterminateProgressView.getMeasuredWidth());
}
View customView = null; View customView = null;
if (mExpandedActionView != null) { if (mExpandedActionView != null) {
customView = mExpandedActionView; customView = mExpandedActionView;
@@ -922,6 +917,13 @@ public class ActionBarView extends AbsActionBarView {
customView.measure( customView.measure(
MeasureSpec.makeMeasureSpec(customNavWidth, customNavWidthMode), MeasureSpec.makeMeasureSpec(customNavWidth, customNavWidthMode),
MeasureSpec.makeMeasureSpec(customNavHeight, customNavHeightMode)); MeasureSpec.makeMeasureSpec(customNavHeight, customNavHeightMode));
availableWidth -= horizontalMargin + customView.getMeasuredWidth();
}
if (mExpandedActionView == null && showTitle) {
availableWidth = measureChildView(mTitleLayout, availableWidth,
MeasureSpec.makeMeasureSpec(mContentHeight, MeasureSpec.EXACTLY), 0);
leftOfCenter = Math.max(0, leftOfCenter - mTitleLayout.getMeasuredWidth());
} }
if (mContentHeight <= 0) { if (mContentHeight <= 0) {