summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
author Adam Powell <adamp@google.com> 2011-08-25 09:29:21 -0700
committer Adam Powell <adamp@google.com> 2011-08-25 11:23:44 -0700
commitaa8e509ba2d22b9ba105faad3349db8d5218ee32 (patch)
tree1c331f5a500fb02677e7b5691ca216dbbebd6850
parent12bde60b39affbfdcb7ef6317e0a5f99c3f41b10 (diff)
Fix bug 5091886 - action bar measurement
Change the measurement order of elements in the action bar. Custom views are now deemed more important and may truncate title/subtitle. Change-Id: I150862f8e48b36bcbd892f49d78c2962c5001ab1
-rw-r--r--core/java/com/android/internal/widget/ActionBarView.java34
1 files changed, 18 insertions, 16 deletions
diff --git a/core/java/com/android/internal/widget/ActionBarView.java b/core/java/com/android/internal/widget/ActionBarView.java
index 4efb29f2ef32..8988c9f81835 100644
--- a/core/java/com/android/internal/widget/ActionBarView.java
+++ b/core/java/com/android/internal/widget/ActionBarView.java
@@ -826,15 +826,18 @@ public class ActionBarView extends AbsActionBarView {
rightOfCenter = Math.max(0, rightOfCenter - mMenuView.getMeasuredWidth());
}
- if (mExpandedActionView == null) {
- boolean showTitle = mTitleLayout != null && mTitleLayout.getVisibility() != GONE &&
- (mDisplayOptions & ActionBar.DISPLAY_SHOW_TITLE) != 0;
- if (showTitle) {
- availableWidth = measureChildView(mTitleLayout, availableWidth,
- MeasureSpec.makeMeasureSpec(mContentHeight, MeasureSpec.EXACTLY), 0);
- leftOfCenter = Math.max(0, leftOfCenter - mTitleLayout.getMeasuredWidth());
- }
+ if (mIndeterminateProgressView != null &&
+ mIndeterminateProgressView.getVisibility() != GONE) {
+ availableWidth = measureChildView(mIndeterminateProgressView, availableWidth,
+ childSpecHeight, 0);
+ rightOfCenter = Math.max(0,
+ rightOfCenter - mIndeterminateProgressView.getMeasuredWidth());
+ }
+
+ final boolean showTitle = mTitleLayout != null && mTitleLayout.getVisibility() != GONE &&
+ (mDisplayOptions & ActionBar.DISPLAY_SHOW_TITLE) != 0;
+ if (mExpandedActionView == null) {
switch (mNavigationMode) {
case ActionBar.NAVIGATION_MODE_LIST:
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;
if (mExpandedActionView != null) {
customView = mExpandedActionView;
@@ -922,6 +917,13 @@ public class ActionBarView extends AbsActionBarView {
customView.measure(
MeasureSpec.makeMeasureSpec(customNavWidth, customNavWidthMode),
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) {