diff options
author | Adam Powell <adamp@google.com> | 2010-09-09 17:03:50 -0700 |
---|---|---|
committer | Adam Powell <adamp@google.com> | 2010-09-10 11:51:10 -0700 |
commit | bc234a19f4c74116454e2c77f4739290e761995a (patch) | |
tree | 668ae749379ac0be306c796ed7bc731b18dda8e4 | |
parent | ad8f2191d81181587cb2d41bf0cf08a3da908f94 (diff) | |
download | frameworks_base-bc234a19f4c74116454e2c77f4739290e761995a.zip frameworks_base-bc234a19f4c74116454e2c77f4739290e761995a.tar.gz frameworks_base-bc234a19f4c74116454e2c77f4739290e761995a.tar.bz2 |
Clean up action bar styles
Change-Id: Ib19698e08d643994c4416aac29a43e9197bbe1f3
-rw-r--r-- | api/current.xml | 90 | ||||
-rw-r--r-- | core/java/com/android/internal/widget/ActionBarContextView.java | 37 | ||||
-rw-r--r-- | core/res/res/layout-xlarge/screen_action_bar.xml | 5 | ||||
-rw-r--r-- | core/res/res/layout-xlarge/screen_action_bar_overlay.xml | 5 | ||||
-rw-r--r-- | core/res/res/layout/action_bar_title_item.xml | 6 | ||||
-rw-r--r-- | core/res/res/layout/action_mode_bar.xml | 3 | ||||
-rw-r--r-- | core/res/res/layout/screen_action_bar.xml | 7 | ||||
-rw-r--r-- | core/res/res/layout/screen_action_bar_overlay.xml | 7 | ||||
-rwxr-xr-x | core/res/res/values/attrs.xml | 35 | ||||
-rw-r--r-- | core/res/res/values/public.xml | 8 | ||||
-rw-r--r-- | core/res/res/values/styles.xml | 35 | ||||
-rw-r--r-- | core/res/res/values/themes.xml | 11 |
12 files changed, 176 insertions, 73 deletions
diff --git a/api/current.xml b/api/current.xml index 3c872c5..819c730 100644 --- a/api/current.xml +++ b/api/current.xml @@ -2088,6 +2088,28 @@ visibility="public" > </field> +<field name="actionBarSize" + type="int" + transient="false" + volatile="false" + value="16843563" + static="true" + final="true" + deprecated="not deprecated" + visibility="public" +> +</field> +<field name="actionBarStyle" + type="int" + transient="false" + volatile="false" + value="16843535" + static="true" + final="true" + deprecated="not deprecated" + visibility="public" +> +</field> <field name="actionBarTabBarStyle" type="int" transient="false" @@ -3078,6 +3100,17 @@ visibility="public" > </field> +<field name="closeButtonStyle" + type="int" + transient="false" + volatile="false" + value="16843576" + static="true" + final="true" + deprecated="not deprecated" + visibility="public" +> +</field> <field name="codes" type="int" transient="false" @@ -5388,6 +5421,17 @@ visibility="public" > </field> +<field name="itemPadding" + type="int" + transient="false" + volatile="false" + value="16843575" + static="true" + final="true" + deprecated="not deprecated" + visibility="public" +> +</field> <field name="itemTextAppearance" type="int" transient="false" @@ -9260,6 +9304,17 @@ visibility="public" > </field> +<field name="subtitleTextStyle" + type="int" + transient="false" + volatile="false" + value="16843578" + static="true" + final="true" + deprecated="not deprecated" + visibility="public" +> +</field> <field name="suggestActionMsg" type="int" transient="false" @@ -10096,6 +10151,17 @@ visibility="public" > </field> +<field name="titleTextStyle" + type="int" + transient="false" + volatile="false" + value="16843577" + static="true" + final="true" + deprecated="not deprecated" + visibility="public" +> +</field> <field name="to" type="int" transient="false" @@ -10723,28 +10789,6 @@ visibility="public" > </field> -<field name="windowActionBarSize" - type="int" - transient="false" - volatile="false" - value="16843563" - static="true" - final="true" - deprecated="not deprecated" - visibility="public" -> -</field> -<field name="windowActionBarStyle" - type="int" - transient="false" - volatile="false" - value="16843535" - static="true" - final="true" - deprecated="not deprecated" - visibility="public" -> -</field> <field name="windowActionModeOverlay" type="int" transient="false" @@ -239819,7 +239863,7 @@ deprecated="not deprecated" visibility="public" > -<parameter name="arg0" type="T"> +<parameter name="t" type="T"> </parameter> </method> </interface> diff --git a/core/java/com/android/internal/widget/ActionBarContextView.java b/core/java/com/android/internal/widget/ActionBarContextView.java index acf75e3..6b7b946 100644 --- a/core/java/com/android/internal/widget/ActionBarContextView.java +++ b/core/java/com/android/internal/widget/ActionBarContextView.java @@ -37,7 +37,6 @@ import android.widget.TextView; */ public class ActionBarContextView extends ViewGroup { private int mItemPadding; - private int mItemMargin; private int mActionSpacing; private int mContentHeight; @@ -49,32 +48,36 @@ public class ActionBarContextView extends ViewGroup { private LinearLayout mTitleLayout; private TextView mTitleView; private TextView mSubtitleView; - private Drawable mCloseDrawable; + private int mCloseButtonStyle; + private int mTitleStyleRes; + private int mSubtitleStyleRes; private ActionMenuView mMenuView; public ActionBarContextView(Context context) { - this(context, null, 0); + this(context, null); } public ActionBarContextView(Context context, AttributeSet attrs) { - this(context, attrs, 0); + this(context, attrs, com.android.internal.R.attr.actionModeStyle); } public ActionBarContextView(Context context, AttributeSet attrs, int defStyle) { super(context, attrs, defStyle); - TypedArray a = context.obtainStyledAttributes(attrs, - com.android.internal.R.styleable.Theme); + TypedArray a = context.obtainStyledAttributes(attrs, R.styleable.ActionMode, defStyle, 0); mItemPadding = a.getDimensionPixelOffset( - com.android.internal.R.styleable.Theme_actionButtonPadding, 0); + com.android.internal.R.styleable.ActionMode_itemPadding, 0); setBackgroundDrawable(a.getDrawable( - com.android.internal.R.styleable.Theme_actionModeBackground)); - mCloseDrawable = a.getDrawable( - com.android.internal.R.styleable.Theme_actionModeCloseDrawable); - mItemMargin = mItemPadding / 2; + com.android.internal.R.styleable.ActionMode_background)); + mCloseButtonStyle = a.getResourceId( + com.android.internal.R.styleable.ActionMode_closeButtonStyle, 0); + mTitleStyleRes = a.getResourceId( + com.android.internal.R.styleable.ActionMode_titleTextStyle, 0); + mSubtitleStyleRes = a.getResourceId( + com.android.internal.R.styleable.ActionMode_subtitleTextStyle, 0); mContentHeight = a.getLayoutDimension( - com.android.internal.R.styleable.Theme_windowActionBarSize, 0); + com.android.internal.R.styleable.ActionMode_height, 0); a.recycle(); } @@ -129,9 +132,15 @@ public class ActionBarContextView extends ViewGroup { mSubtitleView = (TextView) mTitleLayout.findViewById(R.id.action_bar_subtitle); if (mTitle != null) { mTitleView.setText(mTitle); + if (mTitleStyleRes != 0) { + mTitleView.setTextAppearance(mContext, mTitleStyleRes); + } } if (mSubtitle != null) { mSubtitleView.setText(mSubtitle); + if (mSubtitleStyleRes != 0) { + mSubtitleView.setTextAppearance(mContext, mSubtitleStyleRes); + } mSubtitleView.setVisibility(VISIBLE); } addView(mTitleLayout); @@ -147,9 +156,7 @@ public class ActionBarContextView extends ViewGroup { public void initForMode(final ActionMode mode) { if (mCloseButton == null) { - mCloseButton = new ImageButton(getContext()); - mCloseButton.setImageDrawable(mCloseDrawable); - mCloseButton.setBackgroundDrawable(null); + mCloseButton = new ImageButton(getContext(), null, mCloseButtonStyle); } mCloseButton.setOnClickListener(new OnClickListener() { public void onClick(View v) { diff --git a/core/res/res/layout-xlarge/screen_action_bar.xml b/core/res/res/layout-xlarge/screen_action_bar.xml index 30a7318..c402556 100644 --- a/core/res/res/layout-xlarge/screen_action_bar.xml +++ b/core/res/res/layout-xlarge/screen_action_bar.xml @@ -30,11 +30,12 @@ This is an optimized layout for a screen with the Action Bar enabled. android:id="@+id/action_bar" android:layout_width="match_parent" android:layout_height="wrap_content" - style="?android:attr/windowActionBarStyle" /> + style="?android:attr/actionBarStyle" /> <com.android.internal.widget.ActionBarContextView android:id="@+id/action_context_bar" android:layout_width="match_parent" - android:layout_height="wrap_content" /> + android:layout_height="wrap_content" + style="?android:attr/actionModeStyle" /> </ViewAnimator> <FrameLayout android:id="@android:id/content" android:layout_width="match_parent" diff --git a/core/res/res/layout-xlarge/screen_action_bar_overlay.xml b/core/res/res/layout-xlarge/screen_action_bar_overlay.xml index cb35ac1..af051ae 100644 --- a/core/res/res/layout-xlarge/screen_action_bar_overlay.xml +++ b/core/res/res/layout-xlarge/screen_action_bar_overlay.xml @@ -34,11 +34,12 @@ the Action Bar enabled overlaying application content. android:id="@+id/action_bar" android:layout_width="match_parent" android:layout_height="wrap_content" - style="?android:attr/windowActionBarStyle" /> + style="?android:attr/actionBarStyle" /> <com.android.internal.widget.ActionBarContextView android:id="@+id/action_context_bar" android:layout_width="match_parent" - android:layout_height="wrap_content" /> + android:layout_height="wrap_content" + style="?android:attr/actionModeStyle" /> </ViewAnimator> <ImageView android:src="?android:attr/windowContentOverlay" android:scaleType="fitXY" diff --git a/core/res/res/layout/action_bar_title_item.xml b/core/res/res/layout/action_bar_title_item.xml index 3c046fe..3864981 100644 --- a/core/res/res/layout/action_bar_title_item.xml +++ b/core/res/res/layout/action_bar_title_item.xml @@ -22,12 +22,10 @@ android:layout_width="wrap_content" android:layout_height="wrap_content" android:singleLine="true" - android:ellipsize="end" - android:textAppearance="?android:attr/textAppearanceMediumInverse" /> + android:ellipsize="end" /> <TextView android:id="@+id/action_bar_subtitle" android:layout_width="wrap_content" android:layout_height="wrap_content" android:singleLine="true" - android:ellipsize="end" - android:textAppearance="?android:attr/textAppearanceSmallInverse" /> + android:ellipsize="end" /> </LinearLayout> diff --git a/core/res/res/layout/action_mode_bar.xml b/core/res/res/layout/action_mode_bar.xml index acf327e..dc09fdc 100644 --- a/core/res/res/layout/action_mode_bar.xml +++ b/core/res/res/layout/action_mode_bar.xml @@ -20,4 +20,5 @@ xmlns:android="http://schemas.android.com/apk/res/android" android:layout_width="match_parent" android:layout_height="wrap_content" - android:visibility="gone" /> + android:visibility="gone" + style="?android:attr/actionModeStyle" /> diff --git a/core/res/res/layout/screen_action_bar.xml b/core/res/res/layout/screen_action_bar.xml index 3c44b8c..b158414 100644 --- a/core/res/res/layout/screen_action_bar.xml +++ b/core/res/res/layout/screen_action_bar.xml @@ -30,11 +30,12 @@ This is an optimized layout for a screen with the Action Bar enabled. android:id="@+id/action_bar" android:layout_width="match_parent" android:layout_height="wrap_content" - style="?android:attr/windowActionBarStyle" /> + style="?android:attr/actionBarStyle" /> <com.android.internal.widget.ActionBarContextView android:id="@+id/action_context_bar" android:layout_width="match_parent" - android:layout_height="wrap_content" /> + android:layout_height="wrap_content" + style="?android:attr/actionModeStyle" /> </ViewAnimator> <FrameLayout android:id="@android:id/content" android:layout_width="match_parent" @@ -45,6 +46,6 @@ This is an optimized layout for a screen with the Action Bar enabled. <LinearLayout android:id="@+id/lower_action_context_bar" android:layout_width="match_parent" android:layout_height="wrap_content" - style="?android:attr/windowActionBarStyle" + style="?android:attr/actionBarStyle" android:visibility="gone" /> </LinearLayout> diff --git a/core/res/res/layout/screen_action_bar_overlay.xml b/core/res/res/layout/screen_action_bar_overlay.xml index c854c6f..92a1ee0 100644 --- a/core/res/res/layout/screen_action_bar_overlay.xml +++ b/core/res/res/layout/screen_action_bar_overlay.xml @@ -34,11 +34,12 @@ the Action Bar enabled overlaying application content. android:id="@+id/action_bar" android:layout_width="match_parent" android:layout_height="wrap_content" - style="?android:attr/windowActionBarStyle" /> + style="?android:attr/actionBarStyle" /> <com.android.internal.widget.ActionBarContextView android:id="@+id/action_context_bar" android:layout_width="match_parent" - android:layout_height="wrap_content" /> + android:layout_height="wrap_content" + style="?android:attr/actionModeStyle" /> </ViewAnimator> <ImageView android:src="?android:attr/windowContentOverlay" android:scaleType="fitXY" @@ -49,6 +50,6 @@ the Action Bar enabled overlaying application content. android:layout_width="match_parent" android:layout_height="wrap_content" android:layout_gravity="bottom" - style="?android:attr/windowActionBarStyle" + style="?android:attr/actionBarStyle" android:visibility="gone" /> </RelativeLayout> diff --git a/core/res/res/values/attrs.xml b/core/res/res/values/attrs.xml index f466e82..7d54ea1 100755 --- a/core/res/res/values/attrs.xml +++ b/core/res/res/values/attrs.xml @@ -267,15 +267,6 @@ have an Action Bar. --> <attr name="windowActionBarOverlay" format="boolean" /> - <!-- Reference to a style for the Action Bar --> - <attr name="windowActionBarStyle" format="reference" /> - - <!-- Size of the Action Bar, including the contextual - bar used to present Action Modes. --> - <attr name="windowActionBarSize" format="dimension" > - <enum name="wrap_content" value="0" /> - </attr> - <!-- Flag indicating whether action modes should overlay window content when there is not reserved space for their UI (such as an Action Bar). --> <attr name="windowActionModeOverlay" format="boolean" /> @@ -478,6 +469,15 @@ <attr name="actionBarTabBarStyle" format="reference" /> <attr name="actionBarTabTextStyle" format="reference" /> <attr name="actionOverflowButtonStyle" format="reference" /> + <attr name="actionModeStyle" format="reference" /> + <!-- Reference to a style for the Action Bar --> + <attr name="actionBarStyle" format="reference" /> + <!-- Size of the Action Bar, including the contextual + bar used to present Action Modes. --> + <attr name="actionBarSize" format="dimension" > + <enum name="wrap_content" value="0" /> + </attr> + <!-- =================== --> <!-- Action mode styles --> @@ -1027,10 +1027,8 @@ <attr name="backgroundDimEnabled" /> <attr name="backgroundDimAmount" /> <attr name="windowActionBar" /> - <attr name="windowActionBarStyle" /> <attr name="windowActionModeOverlay" /> <attr name="windowActionBarOverlay" /> - <attr name="windowActionBarSize" /> </declare-styleable> <!-- The set of attributes that describe a AlertDialog's theme. --> @@ -4081,4 +4079,19 @@ <attr name="height" /> </declare-styleable> + <declare-styleable name="ActionMode"> + <!-- Specifies a style to use for title text. --> + <attr name="titleTextStyle" /> + <!-- Specifies a style to use for subtitle text. --> + <attr name="subtitleTextStyle" /> + <!-- Specifies a background for the action mode bar. --> + <attr name="background" /> + <!-- Specifies a fixed height for the action mode bar. --> + <attr name="height" /> + <!-- Specifies a padding to use between elements on the bar. --> + <attr name="itemPadding" format="dimension" /> + <!-- Specifies a style for the mode's close button. --> + <attr name="closeButtonStyle" format="reference" /> + </declare-styleable> + </resources> diff --git a/core/res/res/values/public.xml b/core/res/res/values/public.xml index 7f168a1..bff22a6 100644 --- a/core/res/res/values/public.xml +++ b/core/res/res/values/public.xml @@ -1299,7 +1299,7 @@ <public type="attr" name="withClass" /> <public type="attr" name="allContactsName" /> <public type="attr" name="windowActionBar" /> - <public type="attr" name="windowActionBarStyle" /> + <public type="attr" name="actionBarStyle" /> <public type="attr" name="navigationMode" /> <public type="attr" name="displayOptions" /> <public type="attr" name="subtitle" /> @@ -1327,7 +1327,7 @@ <public type="attr" name="fragmentOpenExitAnimation" /> <public type="attr" name="fragmentCloseEnterAnimation" /> <public type="attr" name="fragmentCloseExitAnimation" /> - <public type="attr" name="windowActionBarSize" /> + <public type="attr" name="actionBarSize" /> <public type="attr" name="imeSubtypeLocale" /> <public type="attr" name="imeSubtypeMode" /> <public type="attr" name="imeSubtypeExtraValue" /> @@ -1339,6 +1339,10 @@ <public type="attr" name="actionBarTabBarStyle" /> <public type="attr" name="actionBarTabTextStyle" /> <public type="attr" name="actionOverflowButtonStyle" /> + <public type="attr" name="itemPadding" /> + <public type="attr" name="closeButtonStyle" /> + <public type="attr" name="titleTextStyle" /> + <public type="attr" name="subtitleTextStyle" /> <public type="anim" name="animator_fade_in" /> <public type="anim" name="animator_fade_out" /> diff --git a/core/res/res/values/styles.xml b/core/res/res/values/styles.xml index 5c3870d..fa5c70b 100644 --- a/core/res/res/values/styles.xml +++ b/core/res/res/values/styles.xml @@ -879,15 +879,42 @@ <item name="android:background">@android:drawable/bottom_bar</item> </style> - <style name="ActionBar"> + <style name="Widget.ActionBar"> <item name="android:background">@android:drawable/action_bar_background</item> <item name="android:displayOptions">useLogo</item> <item name="android:divider">@android:drawable/action_bar_divider</item> - <item name="android:height">?android:attr/windowActionBarSize</item> + <item name="android:height">?android:attr/actionBarSize</item> <item name="android:paddingLeft">3dip</item> <item name="android:paddingTop">0dip</item> <item name="android:paddingRight">3dip</item> <item name="android:paddingBottom">0dip</item> + <item name="android:titleTextStyle">@android:style/TextAppearance.Widget.ActionBar.Title</item> + <item name="android:subtitleTextStyle">@android:style/TextAppearance.Widget.ActionBar.Subtitle</item> + </style> + + <style name="Widget.ActionMode"> + <item name="android:background">?android:attr/actionModeBackground</item> + <item name="android:height">?android:attr/actionBarSize</item> + <item name="android:itemPadding">?android:attr/actionButtonPadding</item> + <item name="android:closeButtonStyle">@android:style/Widget.ActionButton.CloseMode</item> + <item name="android:titleTextStyle">@android:style/TextAppearance.Widget.ActionMode.Title</item> + <item name="android:subtitleTextStyle">@android:style/TextAppearance.Widget.ActionMode.Subtitle</item> + </style> + + <style name="TextAppearance.Widget.ActionBar.Title" + parent="@android:style/TextAppearance.Medium.Inverse"> + </style> + + <style name="TextAppearance.Widget.ActionBar.Subtitle" + parent="@android:style/TextAppearance.Small.Inverse"> + </style> + + <style name="TextAppearance.Widget.ActionMode.Title" + parent="@android:style/TextAppearance.Medium.Inverse"> + </style> + + <style name="TextAppearance.Widget.ActionMode.Subtitle" + parent="@android:style/TextAppearance.Small.Inverse"> </style> <style name="Widget.ActionButton"> @@ -899,6 +926,10 @@ <item name="android:contentDescription">@string/more_item_label</item> </style> + <style name="Widget.ActionButton.CloseMode"> + <item name="android:src">?android:attr/actionModeCloseDrawable</item> + </style> + <style name="Widget.ActionBarView_TabView"> <item name="android:background">@drawable/minitab_lt</item> <item name="android:paddingLeft">4dip</item> diff --git a/core/res/res/values/themes.xml b/core/res/res/values/themes.xml index b1f6c99..e66e52a 100644 --- a/core/res/res/values/themes.xml +++ b/core/res/res/values/themes.xml @@ -126,8 +126,6 @@ <item name="android:windowSoftInputMode">stateUnspecified|adjustUnspecified</item> <item name="windowActionBar">false</item> <item name="windowActionModeOverlay">false</item> - <item name="windowActionBarStyle">@android:style/ActionBar</item> - <item name="windowActionBarSize">50dip</item> <!-- Dialog attributes --> <item name="alertDialogStyle">@android:style/AlertDialog</item> @@ -200,9 +198,6 @@ <item name="quickContactBadgeStyleSmallWindowSmall">@android:style/Widget.QuickContactBadgeSmall.WindowSmall</item> <item name="quickContactBadgeStyleSmallWindowMedium">@android:style/Widget.QuickContactBadgeSmall.WindowMedium</item> <item name="quickContactBadgeStyleSmallWindowLarge">@android:style/Widget.QuickContactBadgeSmall.WindowLarge</item> - <item name="actionBarTabStyle">@style/Widget.ActionBarView_TabView</item> - <item name="actionBarTabBarStyle">@style/Widget.ActionBarView_TabBar</item> - <item name="actionBarTabTextStyle">@style/Widget.ActionBarView_TabText</item> <!-- Preference styles --> <item name="preferenceScreenStyle">@android:style/Preference.PreferenceScreen</item> @@ -223,6 +218,12 @@ <item name="actionButtonPadding">12dip</item> <item name="actionModeBackground">@android:drawable/action_bar_context_background</item> <item name="actionModeCloseDrawable">@android:drawable/ic_menu_close_clear_cancel</item> + <item name="actionBarTabStyle">@style/Widget.ActionBarView_TabView</item> + <item name="actionBarTabBarStyle">@style/Widget.ActionBarView_TabBar</item> + <item name="actionBarTabTextStyle">@style/Widget.ActionBarView_TabText</item> + <item name="actionModeStyle">@style/Widget.ActionMode</item> + <item name="actionBarStyle">@android:style/Widget.ActionBar</item> + <item name="actionBarSize">50dip</item> </style> <!-- Variant of the default (dark) theme with no title bar --> |