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

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

Merge "Fix bug 5396097 - menu theme consistency" into ics-mr0

parents 58bf986c 538e565c
Loading
Loading
Loading
Loading
+4 −7
Original line number Diff line number Diff line
@@ -31,9 +31,6 @@ import android.view.View;
import android.view.View.MeasureSpec;
import android.view.ViewConfiguration;
import android.view.ViewGroup;
import android.view.ViewParent;
import android.view.accessibility.AccessibilityEvent;
import android.view.accessibility.AccessibilityNodeInfo;
import android.widget.ImageButton;

import java.util.ArrayList;
@@ -71,8 +68,8 @@ public class ActionMenuPresenter extends BaseMenuPresenter
    final PopupPresenterCallback mPopupPresenterCallback = new PopupPresenterCallback();
    int mOpenSubMenuId;

    public ActionMenuPresenter() {
        super(com.android.internal.R.layout.action_menu_layout,
    public ActionMenuPresenter(Context context) {
        super(context, com.android.internal.R.layout.action_menu_layout,
                com.android.internal.R.layout.action_menu_item_layout);
    }

@@ -98,7 +95,7 @@ public class ActionMenuPresenter extends BaseMenuPresenter
        int width = mWidthLimit;
        if (mReserveOverflow) {
            if (mOverflowButton == null) {
                mOverflowButton = new OverflowMenuButton(mContext);
                mOverflowButton = new OverflowMenuButton(mSystemContext);
                final int spec = MeasureSpec.makeMeasureSpec(0, MeasureSpec.UNSPECIFIED);
                mOverflowButton.measure(spec, spec);
            }
@@ -215,7 +212,7 @@ public class ActionMenuPresenter extends BaseMenuPresenter

        if (hasOverflow) {
            if (mOverflowButton == null) {
                mOverflowButton = new OverflowMenuButton(mContext);
                mOverflowButton = new OverflowMenuButton(mSystemContext);
            }
            ViewGroup parent = (ViewGroup) mOverflowButton.getParent();
            if (parent != mMenuView) {
+8 −3
Original line number Diff line number Diff line
@@ -29,8 +29,10 @@ import java.util.ArrayList;
 * be reused if possible when items change.
 */
public abstract class BaseMenuPresenter implements MenuPresenter {
    protected Context mSystemContext;
    protected Context mContext;
    protected MenuBuilder mMenu;
    protected LayoutInflater mSystemInflater;
    protected LayoutInflater mInflater;
    private Callback mCallback;

@@ -44,10 +46,13 @@ public abstract class BaseMenuPresenter implements MenuPresenter {
    /**
     * Construct a new BaseMenuPresenter.
     *
     * @param context Context for generating system-supplied views
     * @param menuLayoutRes Layout resource ID for the menu container view
     * @param itemLayoutRes Layout resource ID for a single item view
     */
    public BaseMenuPresenter(int menuLayoutRes, int itemLayoutRes) {
    public BaseMenuPresenter(Context context, int menuLayoutRes, int itemLayoutRes) {
        mSystemContext = context;
        mSystemInflater = LayoutInflater.from(context);
        mMenuLayoutRes = menuLayoutRes;
        mItemLayoutRes = itemLayoutRes;
    }
@@ -62,7 +67,7 @@ public abstract class BaseMenuPresenter implements MenuPresenter {
    @Override
    public MenuView getMenuView(ViewGroup root) {
        if (mMenuView == null) {
            mMenuView = (MenuView) mInflater.inflate(mMenuLayoutRes, root, false);
            mMenuView = (MenuView) mSystemInflater.inflate(mMenuLayoutRes, root, false);
            mMenuView.initialize(mMenu);
            updateMenuView(true);
        }
@@ -138,7 +143,7 @@ public abstract class BaseMenuPresenter implements MenuPresenter {
     * @return The new item view
     */
    public MenuView.ItemView createItemView(ViewGroup parent) {
        return (MenuView.ItemView) mInflater.inflate(mItemLayoutRes, parent, false);
        return (MenuView.ItemView) mSystemInflater.inflate(mItemLayoutRes, parent, false);
    }

    /**
+2 −2
Original line number Diff line number Diff line
@@ -43,8 +43,8 @@ public class IconMenuPresenter extends BaseMenuPresenter {
    private static final String VIEWS_TAG = "android:menu:icon";
    private static final String OPEN_SUBMENU_KEY = "android:menu:icon:submenu";

    public IconMenuPresenter() {
        super(com.android.internal.R.layout.icon_menu_layout,
    public IconMenuPresenter(Context context) {
        super(context, com.android.internal.R.layout.icon_menu_layout,
                com.android.internal.R.layout.icon_menu_item_layout);
    }

+1 −1
Original line number Diff line number Diff line
@@ -207,7 +207,7 @@ public class ActionBarContextView extends AbsActionBarView implements AnimatorLi
        });

        final MenuBuilder menu = (MenuBuilder) mode.getMenu();
        mActionMenuPresenter = new ActionMenuPresenter();
        mActionMenuPresenter = new ActionMenuPresenter(mContext);
        mActionMenuPresenter.setReserveOverflow(true);

        final LayoutParams layoutParams = new LayoutParams(LayoutParams.WRAP_CONTENT,
+1 −1
Original line number Diff line number Diff line
@@ -373,7 +373,7 @@ public class ActionBarView extends AbsActionBarView {
            }
        }
        if (mActionMenuPresenter == null) {
            mActionMenuPresenter = new ActionMenuPresenter();
            mActionMenuPresenter = new ActionMenuPresenter(mContext);
            mActionMenuPresenter.setCallback(cb);
            mActionMenuPresenter.setId(com.android.internal.R.id.action_menu_presenter);
            mExpandedMenuPresenter = new ExpandedActionViewMenuPresenter();
Loading