diff options
author | Adam Powell <adamp@google.com> | 2011-06-22 21:14:42 -0700 |
---|---|---|
committer | Android (Google) Code Review <android-gerrit@google.com> | 2011-06-22 21:14:42 -0700 |
commit | d9b0ee029fa4d098c7597b4074b9c59e558e6c38 (patch) | |
tree | 74f0e10673aabe1a4ca59d6eaf59c04de3e013d7 /core | |
parent | 8b4512ef203ee0bc3bca33224f1e03f2c1e59546 (diff) | |
parent | 0d5d1b7e8cc06b4c62a863314debbb8b24554f1f (diff) | |
download | frameworks_base-d9b0ee029fa4d098c7597b4074b9c59e558e6c38.zip frameworks_base-d9b0ee029fa4d098c7597b4074b9c59e558e6c38.tar.gz frameworks_base-d9b0ee029fa4d098c7597b4074b9c59e558e6c38.tar.bz2 |
Merge "Tweak action bar metrics."
Diffstat (limited to 'core')
-rw-r--r-- | core/java/com/android/internal/widget/ActionBarView.java | 39 | ||||
-rw-r--r-- | core/res/res/layout/action_bar_home.xml | 5 | ||||
-rw-r--r-- | core/res/res/values-land/dimens.xml | 2 | ||||
-rw-r--r-- | core/res/res/values/dimens.xml | 2 | ||||
-rw-r--r-- | core/res/res/values/styles.xml | 16 |
5 files changed, 48 insertions, 16 deletions
diff --git a/core/java/com/android/internal/widget/ActionBarView.java b/core/java/com/android/internal/widget/ActionBarView.java index c475eff..6204b4e 100644 --- a/core/java/com/android/internal/widget/ActionBarView.java +++ b/core/java/com/android/internal/widget/ActionBarView.java @@ -50,6 +50,7 @@ import android.view.View; import android.view.ViewGroup; import android.view.ViewParent; import android.view.Window; +import android.view.View.MeasureSpec; import android.widget.AdapterView; import android.widget.FrameLayout; import android.widget.ImageView; @@ -742,8 +743,14 @@ public class ActionBarView extends AbsActionBarView { View homeLayout = mExpandedActionView != null ? mExpandedHomeLayout : mHomeLayout; if (homeLayout.getVisibility() != GONE) { - homeLayout.measure( - MeasureSpec.makeMeasureSpec(availableWidth, MeasureSpec.AT_MOST), + final LayoutParams lp = homeLayout.getLayoutParams(); + int homeWidthSpec; + if (lp.width < 0) { + homeWidthSpec = MeasureSpec.makeMeasureSpec(availableWidth, MeasureSpec.AT_MOST); + } else { + homeWidthSpec = MeasureSpec.makeMeasureSpec(lp.width, MeasureSpec.EXACTLY); + } + homeLayout.measure(homeWidthSpec, MeasureSpec.makeMeasureSpec(height, MeasureSpec.EXACTLY)); final int homeWidth = homeLayout.getMeasuredWidth(); availableWidth = Math.max(0, availableWidth - homeWidth); @@ -1120,6 +1127,34 @@ public class ActionBarView extends AbsActionBarView { width += iconLp.leftMargin + mIconView.getMeasuredWidth() + iconLp.rightMargin; height = Math.max(height, iconLp.topMargin + mIconView.getMeasuredHeight() + iconLp.bottomMargin); + + final int widthMode = MeasureSpec.getMode(widthMeasureSpec); + final int heightMode = MeasureSpec.getMode(heightMeasureSpec); + final int widthSize = MeasureSpec.getSize(widthMeasureSpec); + final int heightSize = MeasureSpec.getSize(heightMeasureSpec); + + switch (widthMode) { + case MeasureSpec.AT_MOST: + width = Math.min(width, widthSize); + break; + case MeasureSpec.EXACTLY: + width = widthSize; + break; + case MeasureSpec.UNSPECIFIED: + default: + break; + } + switch (heightMode) { + case MeasureSpec.AT_MOST: + height = Math.min(height, heightSize); + break; + case MeasureSpec.EXACTLY: + height = heightSize; + break; + case MeasureSpec.UNSPECIFIED: + default: + break; + } setMeasuredDimension(width, height); } diff --git a/core/res/res/layout/action_bar_home.xml b/core/res/res/layout/action_bar_home.xml index 7f7c55c..835e039 100644 --- a/core/res/res/layout/action_bar_home.xml +++ b/core/res/res/layout/action_bar_home.xml @@ -25,12 +25,11 @@ android:visibility="gone" android:layout_width="wrap_content" android:layout_height="wrap_content" - android:layout_marginRight="-4dip" /> + android:layout_marginRight="-8dip" /> <ImageView android:id="@android:id/home" android:layout_width="wrap_content" android:layout_height="wrap_content" - android:paddingLeft="8dip" - android:paddingRight="8dip" + android:layout_marginRight="8dip" android:paddingTop="@dimen/action_bar_icon_vertical_padding" android:paddingBottom="@dimen/action_bar_icon_vertical_padding" android:layout_gravity="center" diff --git a/core/res/res/values-land/dimens.xml b/core/res/res/values-land/dimens.xml index 35f0077..4dd9334 100644 --- a/core/res/res/values-land/dimens.xml +++ b/core/res/res/values-land/dimens.xml @@ -31,6 +31,8 @@ <!-- Default height of an action bar. --> <dimen name="action_bar_default_height">40dip</dimen> + <!-- Vertical padding around action bar icons. --> + <dimen name="action_bar_icon_vertical_padding">4dip</dimen> <!-- Size of clock font in LockScreen on Unsecure unlock screen. --> <dimen name="keyguard_lockscreen_clock_font_size">80sp</dimen> diff --git a/core/res/res/values/dimens.xml b/core/res/res/values/dimens.xml index 43c7fb1..9933b6f 100644 --- a/core/res/res/values/dimens.xml +++ b/core/res/res/values/dimens.xml @@ -118,7 +118,7 @@ <!-- Default height of an action bar. --> <dimen name="action_bar_default_height">48dip</dimen> <!-- Vertical padding around action bar icons. --> - <dimen name="action_bar_icon_vertical_padding">4dip</dimen> + <dimen name="action_bar_icon_vertical_padding">8dip</dimen> <!-- Size of clock font in LockScreen on Unsecure unlock screen. --> <dimen name="keyguard_lockscreen_clock_font_size">80sp</dimen> diff --git a/core/res/res/values/styles.xml b/core/res/res/values/styles.xml index 72a5797..67be63e 100644 --- a/core/res/res/values/styles.xml +++ b/core/res/res/values/styles.xml @@ -1118,9 +1118,9 @@ <style name="Widget.ActionButton"> <item name="android:background">?android:attr/selectableItemBackground</item> - <item name="android:paddingLeft">16dip</item> - <item name="android:paddingRight">16dip</item> - <item name="android:minWidth">64dip</item> + <item name="android:paddingLeft">12dip</item> + <item name="android:paddingRight">12dip</item> + <item name="android:minWidth">56dip</item> <item name="android:minHeight">?android:attr/actionBarSize</item> </style> @@ -1788,18 +1788,16 @@ </style> <style name="Widget.Holo.ActionButton" parent="Widget.ActionButton"> - <item name="android:minWidth">64dip</item> + <item name="android:minWidth">56dip</item> <item name="android:gravity">center</item> - <item name="android:paddingLeft">16dip</item> - <item name="android:paddingRight">16dip</item> + <item name="android:paddingLeft">12dip</item> + <item name="android:paddingRight">12dip</item> <item name="android:scaleType">center</item> </style> <style name="Widget.Holo.ActionButton.Overflow"> <item name="android:src">@android:drawable/ic_menu_moreoverflow_holo_dark</item> <item name="android:background">?android:attr/selectableItemBackground</item> - <item name="android:paddingLeft">16dip</item> - <item name="android:paddingRight">16dip</item> <item name="android:contentDescription">@string/action_menu_overflow_description</item> </style> @@ -2142,8 +2140,6 @@ <style name="Widget.Holo.Light.ActionButton.Overflow"> <item name="android:src">@android:drawable/ic_menu_moreoverflow_holo_light</item> - <item name="android:paddingLeft">16dip</item> - <item name="android:paddingRight">16dip</item> <item name="android:contentDescription">@string/action_menu_overflow_description</item> </style> |