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

Commit d86fd61c authored by Oren Blasberg's avatar Oren Blasberg Committed by Android (Google) Code Review
Browse files

Merge "Call the onDismiss listener in submenus." into nyc-dev

parents 4c78ba65 4348688e
Loading
Loading
Loading
Loading
+0 −8
Original line number Diff line number Diff line
@@ -65,7 +65,6 @@ public class MenuBuilder implements Menu {

    private final Context mContext;
    private final Resources mResources;
    private final boolean mShowCascadingMenus;

    /**
     * Whether the shortcuts should be qwerty-accessible. Use isQwertyMode()
@@ -188,9 +187,6 @@ public class MenuBuilder implements Menu {
    public MenuBuilder(Context context) {
        mContext = context;
        mResources = context.getResources();
        mShowCascadingMenus = context.getResources().getBoolean(
                com.android.internal.R.bool.config_enableCascadingSubmenus);
        
        mItems = new ArrayList<MenuItemImpl>();
        
        mVisibleItems = new ArrayList<MenuItemImpl>();
@@ -915,10 +911,6 @@ public class MenuBuilder implements Menu {
                close(true /* closeAllMenus */);
            }
        } else if (itemImpl.hasSubMenu() || providerHasSubMenu) {
            if (!mShowCascadingMenus) {
                close(false /* closeAllMenus */);
            }

            if (!itemImpl.hasSubMenu()) {
                itemImpl.setSubMenu(new SubMenuBuilder(getContext(), this, itemImpl));
            }
+11 −1
Original line number Diff line number Diff line
@@ -240,8 +240,11 @@ final class StandardMenuPopup extends MenuPopup implements OnDismissListener, On
            mTreeObserver = null;
        }
        mShownAnchorView.removeOnAttachStateChangeListener(mAttachStateChangeListener);

        if (mOnDismissListener != null) {
            mOnDismissListener.onDismiss();
        }
    }

    @Override
    public void updateMenuView(boolean cleared) {
@@ -265,6 +268,13 @@ final class StandardMenuPopup extends MenuPopup implements OnDismissListener, On
            subPopup.setPresenterCallback(mPresenterCallback);
            subPopup.setForceShowIcon(mAdapter.getForceShowIcon());

            // Pass responsibility for handling onDismiss to the submenu.
            subPopup.setOnDismissListener(mOnDismissListener);
            mOnDismissListener = null;

            // Close this menu popup to make room for the submenu popup.
            dismiss();

            // Show the new sub-menu popup at the same location as this popup.
            if (subPopup.tryShow(mXOffset, mYOffset)) {
                if (mPresenterCallback != null) {