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

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

Merge "Fix bug 2923440 - ActionMode buttons show as action by default"

parents fe0c474c fbb72fdb
Loading
Loading
Loading
Loading
+13 −2
Original line number Diff line number Diff line
@@ -54,13 +54,23 @@ public class MenuInflater {
    
    private Context mContext;

    private int mDefaultShowAsAction;

    /**
     * Constructs a menu inflater.
     * 
     * @see Activity#getMenuInflater()
     */
    public MenuInflater(Context context) {
        this(context, MenuItem.SHOW_AS_ACTION_NEVER);
    }

    /**
     * @hide used internally to change the default showAsAction setting in action modes
     */
    public MenuInflater(Context context, int defaultShowAsAction) {
        mContext = context;
        mDefaultShowAsAction = defaultShowAsAction;
    }

    /**
@@ -247,7 +257,7 @@ public class MenuInflater {
         * - 1: ifRoom
         * - 2: always
         */
        private int itemShowAsAction = MenuItem.SHOW_AS_ACTION_NEVER;
        private int itemShowAsAction;
        
        private String itemListenerMethodName;
        
@@ -262,6 +272,7 @@ public class MenuInflater {
        
        public MenuState(final Menu menu) {
            this.menu = menu;
            this.itemShowAsAction = mDefaultShowAsAction;
            
            resetGroup();
        }
+1 −1
Original line number Diff line number Diff line
@@ -435,7 +435,7 @@ public class ActionBarImpl extends ActionBar {

        @Override
        public MenuInflater getMenuInflater() {
            return new MenuInflater(mContext);
            return new MenuInflater(mContext, MenuItem.SHOW_AS_ACTION_IF_ROOM);
        }

        @Override
+1 −1
Original line number Diff line number Diff line
@@ -112,7 +112,7 @@ public class StandaloneActionMode extends ActionMode implements MenuBuilder.Call

    @Override
    public MenuInflater getMenuInflater() {
        return new MenuInflater(mContext);
        return new MenuInflater(mContext, MenuItem.SHOW_AS_ACTION_IF_ROOM);
    }

    public boolean onMenuItemSelected(MenuBuilder menu, MenuItem item) {