Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit ca4100da authored by Adam Powell's avatar Adam Powell Committed by Android (Google) Code Review
Browse files

Merge "Fix bug 5534667 - Action bar icons need more space on tablet" into ics-mr1

parents f136aa34 24340afb
Loading
Loading
Loading
Loading
+24 −2
Original line number Diff line number Diff line
@@ -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;
@@ -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);
@@ -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
@@ -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);
        }
    }
}
+7 −0
Original line number Diff line number Diff line
@@ -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);
                    }
+1 −0
Original line number Diff line number Diff line
@@ -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);
+2 −0
Original line number Diff line number Diff line
@@ -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>
+4 −0
Original line number Diff line number Diff line
@@ -2394,6 +2394,10 @@
        <attr name="description" />
    </declare-styleable>

    <declare-styleable name="ActionMenuItemView">
        <attr name="minWidth" />
    </declare-styleable>

    <!-- =============================== -->
    <!-- Widget package class attributes -->
    <!-- =============================== -->
Loading