diff --git a/api/current.xml b/api/current.xml
index b0056d7f22243..eead0f53404f8 100644
--- a/api/current.xml
+++ b/api/current.xml
@@ -10657,6 +10657,17 @@
visibility="public"
>
+
+
0 ?
+ mContentHeight : MeasureSpec.getSize(heightMeasureSpec);
+
+ final int verticalPadding = getPaddingTop() + getPaddingBottom();
int availableWidth = contentWidth - getPaddingLeft() - getPaddingRight();
- final int height = mContentHeight - getPaddingTop() - getPaddingBottom();
+ final int height = maxHeight - verticalPadding;
final int childSpecHeight = MeasureSpec.makeMeasureSpec(height, MeasureSpec.AT_MOST);
if (mCloseButton != null) {
@@ -246,7 +252,20 @@ public class ActionBarContextView extends ViewGroup {
MeasureSpec.makeMeasureSpec(customHeight, customHeightMode));
}
- setMeasuredDimension(contentWidth, mContentHeight);
+ if (mContentHeight <= 0) {
+ int measuredHeight = 0;
+ final int count = getChildCount();
+ for (int i = 0; i < count; i++) {
+ View v = getChildAt(i);
+ int paddedViewHeight = v.getMeasuredHeight() + verticalPadding;
+ if (paddedViewHeight > measuredHeight) {
+ measuredHeight = paddedViewHeight;
+ }
+ }
+ setMeasuredDimension(contentWidth, measuredHeight);
+ } else {
+ setMeasuredDimension(contentWidth, maxHeight);
+ }
}
@Override
diff --git a/core/java/com/android/internal/widget/ActionBarView.java b/core/java/com/android/internal/widget/ActionBarView.java
index 73d3c9574a3cc..c3c0db24f6294 100644
--- a/core/java/com/android/internal/widget/ActionBarView.java
+++ b/core/java/com/android/internal/widget/ActionBarView.java
@@ -53,7 +53,6 @@ public class ActionBarView extends ViewGroup {
private static final String TAG = "ActionBarView";
// TODO: This must be defined in the default theme
- private static final int CONTENT_HEIGHT_DIP = 50;
private static final int CONTENT_PADDING_DIP = 3;
private static final int CONTENT_SPACING_DIP = 6;
private static final int CONTENT_ACTION_SPACING_DIP = 12;
@@ -90,12 +89,17 @@ public class ActionBarView extends ViewGroup {
private LinearLayout mTabLayout;
private View mCustomNavView;
+ private int mTitleStyleRes;
+ private int mSubtitleStyleRes;
+
private boolean mShowMenu;
private boolean mUserTitle;
private MenuBuilder mOptionsMenu;
private ActionMenuView mMenuView;
+ private ActionBarContextView mContextView;
+
private ActionMenuItem mLogoNavItem;
private NavigationCallback mCallback;
@@ -151,6 +155,9 @@ public class ActionBarView extends ViewGroup {
setBackgroundDrawable(background);
}
+ mTitleStyleRes = a.getResourceId(R.styleable.ActionBar_titleTextStyle, 0);
+ mSubtitleStyleRes = a.getResourceId(R.styleable.ActionBar_subtitleTextStyle, 0);
+
final int customNavId = a.getResourceId(R.styleable.ActionBar_customNavigationLayout, 0);
if (customNavId != 0) {
LayoutInflater inflater = LayoutInflater.from(context);
@@ -159,11 +166,7 @@ public class ActionBarView extends ViewGroup {
addView(mCustomNavView);
}
- final int padding = a.getDimensionPixelSize(R.styleable.ActionBar_padding,
- (int) (CONTENT_PADDING_DIP * metrics.density + 0.5f));
- setPadding(padding, padding, padding, padding);
- mContentHeight = a.getDimensionPixelSize(R.styleable.ActionBar_height,
- (int) (CONTENT_PADDING_DIP * metrics.density + 0.5f)) - padding * 2;
+ mContentHeight = a.getLayoutDimension(R.styleable.ActionBar_height, 0);
a.recycle();
@@ -473,13 +476,22 @@ public class ActionBarView extends ViewGroup {
mTitleLayout = (LinearLayout) inflater.inflate(R.layout.action_bar_title_item, null);
mTitleView = (TextView) mTitleLayout.findViewById(R.id.action_bar_title);
mSubtitleView = (TextView) mTitleLayout.findViewById(R.id.action_bar_subtitle);
+
+ if (mTitleStyleRes != 0) {
+ mTitleView.setTextAppearance(mContext, mTitleStyleRes);
+ }
if (mTitle != null) {
mTitleView.setText(mTitle);
}
+
+ if (mSubtitleStyleRes != 0) {
+ mSubtitleView.setTextAppearance(mContext, mSubtitleStyleRes);
+ }
if (mSubtitle != null) {
mSubtitleView.setText(mSubtitle);
mSubtitleView.setVisibility(VISIBLE);
}
+
addView(mTitleLayout);
}
@@ -491,6 +503,10 @@ public class ActionBarView extends ViewGroup {
}
}
+ public void setContextView(ActionBarContextView view) {
+ mContextView = view;
+ }
+
@Override
protected void onMeasure(int widthMeasureSpec, int heightMeasureSpec) {
int widthMode = MeasureSpec.getMode(widthMeasureSpec);
@@ -506,9 +522,13 @@ public class ActionBarView extends ViewGroup {
}
int contentWidth = MeasureSpec.getSize(widthMeasureSpec);
+
+ int maxHeight = mContentHeight > 0 ?
+ mContentHeight : MeasureSpec.getSize(heightMeasureSpec);
+ final int verticalPadding = getPaddingTop() + getPaddingBottom();
int availableWidth = contentWidth - getPaddingLeft() - getPaddingRight();
- final int height = mContentHeight - getPaddingTop() - getPaddingBottom();
+ final int height = maxHeight - verticalPadding;
final int childSpecHeight = MeasureSpec.makeMeasureSpec(height, MeasureSpec.AT_MOST);
if (mLogoView != null && mLogoView.getVisibility() != GONE) {
@@ -561,7 +581,24 @@ public class ActionBarView extends ViewGroup {
break;
}
- setMeasuredDimension(contentWidth, mContentHeight);
+ if (mContentHeight <= 0) {
+ int measuredHeight = 0;
+ final int count = getChildCount();
+ for (int i = 0; i < count; i++) {
+ View v = getChildAt(i);
+ int paddedViewHeight = v.getMeasuredHeight() + verticalPadding;
+ if (paddedViewHeight > measuredHeight) {
+ measuredHeight = paddedViewHeight;
+ }
+ }
+ setMeasuredDimension(contentWidth, measuredHeight);
+ } else {
+ setMeasuredDimension(contentWidth, maxHeight);
+ }
+
+ if (mContextView != null) {
+ mContextView.setHeight(getMeasuredHeight());
+ }
}
private int measureChildView(View child, int availableWidth, int childSpecHeight, int spacing) {
diff --git a/core/res/res/anim/push_down_in_no_alpha.xml b/core/res/res/anim/push_down_in_no_alpha.xml
new file mode 100644
index 0000000000000..045d691c1a8b4
--- /dev/null
+++ b/core/res/res/anim/push_down_in_no_alpha.xml
@@ -0,0 +1,20 @@
+
+
+
+
+
+
diff --git a/core/res/res/anim/push_down_out_no_alpha.xml b/core/res/res/anim/push_down_out_no_alpha.xml
new file mode 100644
index 0000000000000..3c2474a4aba59
--- /dev/null
+++ b/core/res/res/anim/push_down_out_no_alpha.xml
@@ -0,0 +1,20 @@
+
+
+
+
+
+
diff --git a/core/res/res/layout-xlarge/screen_action_bar.xml b/core/res/res/layout-xlarge/screen_action_bar.xml
index 41ce8e4674900..30a73184b65ce 100644
--- a/core/res/res/layout-xlarge/screen_action_bar.xml
+++ b/core/res/res/layout-xlarge/screen_action_bar.xml
@@ -24,8 +24,8 @@ This is an optimized layout for a screen with the Action Bar enabled.
+ android:inAnimation="@anim/push_down_in_no_alpha"
+ android:outAnimation="@anim/push_down_out_no_alpha">
+ android:inAnimation="@anim/push_down_in_no_alpha"
+ android:outAnimation="@anim/push_down_out_no_alpha">
diff --git a/core/res/res/layout/screen_action_bar.xml b/core/res/res/layout/screen_action_bar.xml
index f39852b8d3149..3c44b8c465f11 100644
--- a/core/res/res/layout/screen_action_bar.xml
+++ b/core/res/res/layout/screen_action_bar.xml
@@ -24,8 +24,8 @@ This is an optimized layout for a screen with the Action Bar enabled.
+ android:inAnimation="@anim/push_down_in_no_alpha"
+ android:outAnimation="@anim/push_down_out_no_alpha">
+ android:inAnimation="@anim/push_down_in_no_alpha"
+ android:outAnimation="@anim/push_down_out_no_alpha">
diff --git a/core/res/res/values/attrs.xml b/core/res/res/values/attrs.xml
index a75f1a60d23e6..e0608f9d43345 100755
--- a/core/res/res/values/attrs.xml
+++ b/core/res/res/values/attrs.xml
@@ -256,6 +256,12 @@
+
+
+
+
+
@@ -1005,6 +1011,7 @@
+
@@ -4003,8 +4010,6 @@
-
-
diff --git a/core/res/res/values/public.xml b/core/res/res/values/public.xml
index 539f1c010eeec..b84a613d8cdcc 100644
--- a/core/res/res/values/public.xml
+++ b/core/res/res/values/public.xml
@@ -1320,6 +1320,8 @@
+
+
diff --git a/core/res/res/values/styles.xml b/core/res/res/values/styles.xml
index 7e52ebd774a27..2ae3ccd522ef7 100644
--- a/core/res/res/values/styles.xml
+++ b/core/res/res/values/styles.xml
@@ -893,8 +893,11 @@
- @android:drawable/action_bar_background
- useLogo
- @android:drawable/action_bar_divider
- - 56dip
- - 3dip
+ - ?android:attr/windowActionBarSize
+ - 3dip
+ - 3dip
+ - 3dip
+ - 3dip