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

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

Merge "Fix bug 5174277 - Trouble with Menus"

parents 4ee36669 1d07e16c
Loading
Loading
Loading
Loading
+3 −1
Original line number Diff line number Diff line
@@ -34,6 +34,8 @@ import java.util.ArrayList;
 * MenuPresenter for list-style menus.
 */
public class ListMenuPresenter implements MenuPresenter, AdapterView.OnItemClickListener {
    private static final String TAG = "ListMenuPresenter";

    Context mContext;
    LayoutInflater mInflater;
    MenuBuilder mMenu;
@@ -76,7 +78,7 @@ public class ListMenuPresenter implements MenuPresenter, AdapterView.OnItemClick
    public void initForMenu(Context context, MenuBuilder menu) {
        if (mThemeRes != 0) {
            mContext = new ContextThemeWrapper(context, mThemeRes);
        } else if (mContext == null) {
        } else if (mContext != null) {
            mContext = context;
        }
        mInflater = LayoutInflater.from(mContext);
+11 −1
Original line number Diff line number Diff line
@@ -384,7 +384,7 @@ public class PhoneWindow extends Window implements MenuBuilder.Callback {
                st.menu.stopDispatchingItemsChanged();
                if ((cb == null) || !cb.onCreatePanelMenu(st.featureId, st.menu)) {
                    // Ditch the menu created above
                    st.menu = null;
                    st.setMenu(null);

                    if (mActionBar != null) {
                        // Don't show it in the action bar either
@@ -3207,7 +3207,17 @@ public class PhoneWindow extends Window implements MenuBuilder.Callback {
        }

        void setMenu(MenuBuilder menu) {
            if (menu == this.menu) return;

            if (this.menu != null) {
                this.menu.removeMenuPresenter(iconMenuPresenter);
                this.menu.removeMenuPresenter(listMenuPresenter);
            }
            this.menu = menu;
            if (menu != null) {
                if (iconMenuPresenter != null) menu.addMenuPresenter(iconMenuPresenter);
                if (listMenuPresenter != null) menu.addMenuPresenter(listMenuPresenter);
            }
        }

        MenuView getListMenuView(MenuPresenter.Callback cb) {