Loading core/java/com/android/internal/view/menu/ActionMenuItemView.java +24 −2 Original line number Diff line number Diff line Loading @@ -18,6 +18,7 @@ package com.android.internal.view.menu; import android.content.Context; import android.content.res.Resources; import android.content.res.TypedArray; import android.graphics.Rect; import android.graphics.drawable.Drawable; import android.text.TextUtils; Loading Loading @@ -46,8 +47,8 @@ public class ActionMenuItemView extends LinearLayout private ImageButton mImageButton; private Button mTextButton; private boolean mAllowTextWithIcon; private boolean mShowTextAllCaps; private boolean mExpandedFormat; private int mMinWidth; public ActionMenuItemView(Context context) { this(context, null); Loading @@ -62,7 +63,11 @@ public class ActionMenuItemView extends LinearLayout final Resources res = context.getResources(); mAllowTextWithIcon = res.getBoolean( com.android.internal.R.bool.config_allowActionMenuItemTextWithIcon); mShowTextAllCaps = res.getBoolean(com.android.internal.R.bool.config_actionMenuItemAllCaps); TypedArray a = context.obtainStyledAttributes(attrs, com.android.internal.R.styleable.ActionMenuItemView, 0, 0); mMinWidth = a.getDimensionPixelSize( com.android.internal.R.styleable.ActionMenuItemView_minWidth, 0); a.recycle(); } @Override Loading Loading @@ -228,4 +233,21 @@ public class ActionMenuItemView extends LinearLayout cheatSheet.show(); return true; } @Override protected void onMeasure(int widthMeasureSpec, int heightMeasureSpec) { super.onMeasure(widthMeasureSpec, heightMeasureSpec); final int widthMode = MeasureSpec.getMode(widthMeasureSpec); final int specSize = MeasureSpec.getSize(widthMeasureSpec); final int oldMeasuredWidth = getMeasuredWidth(); final int targetWidth = widthMode == MeasureSpec.AT_MOST ? Math.min(specSize, mMinWidth) : mMinWidth; if (widthMode != MeasureSpec.EXACTLY && mMinWidth > 0 && oldMeasuredWidth < targetWidth) { // Remeasure at exactly the minimum width. super.onMeasure(MeasureSpec.makeMeasureSpec(targetWidth, MeasureSpec.EXACTLY), heightMeasureSpec); } } } core/java/com/android/internal/view/menu/BaseMenuPresenter.java +7 −0 Original line number Diff line number Diff line Loading @@ -91,7 +91,14 @@ public abstract class BaseMenuPresenter implements MenuPresenter { MenuItemImpl item = visibleItems.get(i); if (shouldIncludeItem(childIndex, item)) { final View convertView = parent.getChildAt(childIndex); final MenuItemImpl oldItem = convertView instanceof MenuView.ItemView ? ((MenuView.ItemView) convertView).getItemData() : null; final View itemView = getItemView(item, convertView, parent); if (item != oldItem) { // Don't let old states linger with new data. itemView.setPressed(false); itemView.jumpDrawablesToCurrentState(); } if (itemView != convertView) { addItemView(itemView, childIndex); } Loading core/java/com/android/internal/widget/ActionBarView.java +1 −0 Original line number Diff line number Diff line Loading @@ -518,6 +518,7 @@ public class ActionBarView extends AbsActionBarView { public void setHomeButtonEnabled(boolean enable) { mHomeLayout.setEnabled(enable); mHomeLayout.setFocusable(enable); // Make sure the home button has an accurate content description for accessibility. if (!enable) { mHomeLayout.setContentDescription(null); Loading core/res/res/values-sw600dp/dimens.xml +2 −0 Original line number Diff line number Diff line Loading @@ -54,5 +54,7 @@ <!-- Compensate for double margin : preference_screen_side_margin + 4 (frame background shadow) = -preference_screen_side_margin_negative --> <dimen name="preference_screen_side_margin_negative">-4dp</dimen> <!-- Minimum width for an action button in the menu area of an action bar --> <dimen name="action_button_min_width">64dip</dimen> </resources> core/res/res/values/attrs.xml +4 −0 Original line number Diff line number Diff line Loading @@ -2394,6 +2394,10 @@ <attr name="description" /> </declare-styleable> <declare-styleable name="ActionMenuItemView"> <attr name="minWidth" /> </declare-styleable> <!-- =============================== --> <!-- Widget package class attributes --> <!-- =============================== --> Loading Loading
core/java/com/android/internal/view/menu/ActionMenuItemView.java +24 −2 Original line number Diff line number Diff line Loading @@ -18,6 +18,7 @@ package com.android.internal.view.menu; import android.content.Context; import android.content.res.Resources; import android.content.res.TypedArray; import android.graphics.Rect; import android.graphics.drawable.Drawable; import android.text.TextUtils; Loading Loading @@ -46,8 +47,8 @@ public class ActionMenuItemView extends LinearLayout private ImageButton mImageButton; private Button mTextButton; private boolean mAllowTextWithIcon; private boolean mShowTextAllCaps; private boolean mExpandedFormat; private int mMinWidth; public ActionMenuItemView(Context context) { this(context, null); Loading @@ -62,7 +63,11 @@ public class ActionMenuItemView extends LinearLayout final Resources res = context.getResources(); mAllowTextWithIcon = res.getBoolean( com.android.internal.R.bool.config_allowActionMenuItemTextWithIcon); mShowTextAllCaps = res.getBoolean(com.android.internal.R.bool.config_actionMenuItemAllCaps); TypedArray a = context.obtainStyledAttributes(attrs, com.android.internal.R.styleable.ActionMenuItemView, 0, 0); mMinWidth = a.getDimensionPixelSize( com.android.internal.R.styleable.ActionMenuItemView_minWidth, 0); a.recycle(); } @Override Loading Loading @@ -228,4 +233,21 @@ public class ActionMenuItemView extends LinearLayout cheatSheet.show(); return true; } @Override protected void onMeasure(int widthMeasureSpec, int heightMeasureSpec) { super.onMeasure(widthMeasureSpec, heightMeasureSpec); final int widthMode = MeasureSpec.getMode(widthMeasureSpec); final int specSize = MeasureSpec.getSize(widthMeasureSpec); final int oldMeasuredWidth = getMeasuredWidth(); final int targetWidth = widthMode == MeasureSpec.AT_MOST ? Math.min(specSize, mMinWidth) : mMinWidth; if (widthMode != MeasureSpec.EXACTLY && mMinWidth > 0 && oldMeasuredWidth < targetWidth) { // Remeasure at exactly the minimum width. super.onMeasure(MeasureSpec.makeMeasureSpec(targetWidth, MeasureSpec.EXACTLY), heightMeasureSpec); } } }
core/java/com/android/internal/view/menu/BaseMenuPresenter.java +7 −0 Original line number Diff line number Diff line Loading @@ -91,7 +91,14 @@ public abstract class BaseMenuPresenter implements MenuPresenter { MenuItemImpl item = visibleItems.get(i); if (shouldIncludeItem(childIndex, item)) { final View convertView = parent.getChildAt(childIndex); final MenuItemImpl oldItem = convertView instanceof MenuView.ItemView ? ((MenuView.ItemView) convertView).getItemData() : null; final View itemView = getItemView(item, convertView, parent); if (item != oldItem) { // Don't let old states linger with new data. itemView.setPressed(false); itemView.jumpDrawablesToCurrentState(); } if (itemView != convertView) { addItemView(itemView, childIndex); } Loading
core/java/com/android/internal/widget/ActionBarView.java +1 −0 Original line number Diff line number Diff line Loading @@ -518,6 +518,7 @@ public class ActionBarView extends AbsActionBarView { public void setHomeButtonEnabled(boolean enable) { mHomeLayout.setEnabled(enable); mHomeLayout.setFocusable(enable); // Make sure the home button has an accurate content description for accessibility. if (!enable) { mHomeLayout.setContentDescription(null); Loading
core/res/res/values-sw600dp/dimens.xml +2 −0 Original line number Diff line number Diff line Loading @@ -54,5 +54,7 @@ <!-- Compensate for double margin : preference_screen_side_margin + 4 (frame background shadow) = -preference_screen_side_margin_negative --> <dimen name="preference_screen_side_margin_negative">-4dp</dimen> <!-- Minimum width for an action button in the menu area of an action bar --> <dimen name="action_button_min_width">64dip</dimen> </resources>
core/res/res/values/attrs.xml +4 −0 Original line number Diff line number Diff line Loading @@ -2394,6 +2394,10 @@ <attr name="description" /> </declare-styleable> <declare-styleable name="ActionMenuItemView"> <attr name="minWidth" /> </declare-styleable> <!-- =============================== --> <!-- Widget package class attributes --> <!-- =============================== --> Loading