Search in sources :

Example 1 with SubMenuBuilder

use of android.support.v7.view.menu.SubMenuBuilder in project HoloEverywhere by Prototik.

the class ActionMenuPresenter method onSubMenuSelected.

public boolean onSubMenuSelected(SubMenuBuilder subMenu) {
    if (!subMenu.hasVisibleItems()) {
        return false;
    }
    SubMenuBuilder topSubMenu = subMenu;
    while (topSubMenu.getParentMenu() != mMenu) {
        topSubMenu = (SubMenuBuilder) topSubMenu.getParentMenu();
    }
    View anchor = findViewForItem(topSubMenu.getItem());
    if (anchor == null) {
        if (mOverflowButton == null) {
            return false;
        }
        anchor = mOverflowButton;
    }
    mOpenSubMenuId = subMenu.getItem().getItemId();
    mActionButtonPopup = new ActionButtonSubmenu(mContext, subMenu);
    mActionButtonPopup.setAnchorView(anchor);
    mActionButtonPopup.show();
    super.onSubMenuSelected(subMenu);
    return true;
}
Also used : ActionMenuChildView(android.support.v7.internal.view.menu.ActionMenuView.ActionMenuChildView) View(android.view.View)

Example 2 with SubMenuBuilder

use of android.support.v7.view.menu.SubMenuBuilder in project material-components-android by material-components.

the class NavigationMenu method addSubMenu.

@Override
public SubMenu addSubMenu(int group, int id, int categoryOrder, CharSequence title) {
    final MenuItemImpl item = (MenuItemImpl) addInternal(group, id, categoryOrder, title);
    final SubMenuBuilder subMenu = new NavigationSubMenu(getContext(), this, item);
    item.setSubMenu(subMenu);
    return subMenu;
}
Also used : SubMenuBuilder(android.support.v7.view.menu.SubMenuBuilder) MenuItemImpl(android.support.v7.view.menu.MenuItemImpl)

Aggregations

ActionMenuChildView (android.support.v7.internal.view.menu.ActionMenuView.ActionMenuChildView)1 MenuItemImpl (android.support.v7.view.menu.MenuItemImpl)1 SubMenuBuilder (android.support.v7.view.menu.SubMenuBuilder)1 View (android.view.View)1