Search in sources :

Example 1 with SubMenuBuilder

use of android.support.v7.internal.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)

Example 2 with SubMenuBuilder

use of android.support.v7.internal.view.menu.SubMenuBuilder in project iosched by google.

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)

Example 3 with SubMenuBuilder

use of android.support.v7.internal.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 4 with SubMenuBuilder

use of android.support.v7.internal.view.menu.SubMenuBuilder in project AisenWeiBo by wangdan.

the class CardMenuPresenter method onRestoreInstanceState.

@Override
public void onRestoreInstanceState(Parcelable state) {
    SavedState saved = (SavedState) state;
    if (saved.openSubMenuId > 0) {
        MenuItem item = mMenu.findItem(saved.openSubMenuId);
        if (item != null) {
            SubMenuBuilder subMenu = (SubMenuBuilder) item.getSubMenu();
            onSubMenuSelected(subMenu);
        }
    }
}
Also used : SubMenuBuilder(android.support.v7.view.menu.SubMenuBuilder) MenuItem(android.view.MenuItem)

Example 5 with SubMenuBuilder

use of android.support.v7.internal.view.menu.SubMenuBuilder in project AisenWeiBo by wangdan.

the class CardMenuPresenter method onSubMenuSelected.

public boolean onSubMenuSelected(SubMenuBuilder subMenu) {
    if (!subMenu.hasVisibleItems())
        return false;
    SubMenuBuilder topSubMenu = subMenu;
    while (topSubMenu.getParentMenu() != mMenu) {
        topSubMenu = (SubMenuBuilder) topSubMenu.getParentMenu();
    }
    mOpenSubMenuId = subMenu.getItem().getItemId();
    boolean preserveIconSpacing = false;
    final int count = subMenu.size();
    for (int i = 0; i < count; i++) {
        MenuItem childItem = subMenu.getItem(i);
        if (childItem.isVisible() && childItem.getIcon() != null) {
            preserveIconSpacing = true;
            break;
        }
    }
    subMenu.addMenuPresenter(this, mContext);
    mActionButtonPopup = new ActionButtonSubmenu(mContext, subMenu, anchorView);
    mActionButtonPopup.setForceShowIcon(preserveIconSpacing);
    mActionButtonPopup.show();
    super.onSubMenuSelected(subMenu);
    return true;
}
Also used : SubMenuBuilder(android.support.v7.view.menu.SubMenuBuilder) MenuItem(android.view.MenuItem)

Aggregations

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