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

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

Merge "Don't show icons in overlay popup menus." into nyc-dev

parents 7f5b3e59 3610d062
Loading
Loading
Loading
Loading
+14 −7
Original line number Diff line number Diff line
@@ -347,14 +347,21 @@ final class CascadingMenuPopup extends MenuPopup implements MenuPresenter, OnKey
        final LayoutInflater inflater = LayoutInflater.from(mContext);
        final MenuAdapter adapter = new MenuAdapter(menu, inflater, mOverflowOnly);

        // Apply "force show icon" setting; if the menu being shown is the top level menu, apply the
        // setting set on this CascadingMenuPopup by its creating code. If it's a submenu, or if no
        // "force" setting was explicitly set, determine the setting by examining the items.
        // Apply "force show icon" setting. There are 4 cases:
        // (1) This is the top level menu. Only add spacing for icons if forced.
        // (2) This is a submenu. Add spacing if any of the visible menu items has an icon.
        // (3) This is a top level menu that is not an overflow menu. Add spacing if any of the
        //     visible menu items has an icon.
        // (4) This is an overflow menu or a top level menu that doesn't have "force" set.
        //     Don't allow spacing.
        if (!isShowing() && mForceShowIcon) {
            adapter.setForceShowIcon(mForceShowIcon);
        } else {
          // Case 1
          adapter.setForceShowIcon(true);
        } else if (isShowing() || !isShowing() && !mForceShowIcon && !mOverflowOnly) {
          // Case 2 or 3
          adapter.setForceShowIcon(MenuPopup.shouldPreserveIconSpacing(menu));
        }
        // Case 4: Else, don't allow spacing for icons.

        final int menuWidth = measureIndividualMenuWidth(adapter, null, mContext, mMenuMaxWidth);
        final MenuPopupWindow popupWindow = createPopupWindow();
+5 −0
Original line number Diff line number Diff line
@@ -187,6 +187,11 @@ public abstract class MenuPopup implements ShowableListMenu, MenuPresenter,
    /**
     * Returns whether icon spacing needs to be preserved for the given menu, based on whether any
     * of its items contains an icon.
     *
     * NOTE: This should only be used for non-overflow-only menus, because this method does not
     * take into account whether the menu items are being shown as part of the popup or or being
     * shown as actions in the action bar.
     *
     * @param menu
     * @return Whether to preserve icon spacing.
     */