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;
}
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;
}
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;
}
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);
}
}
}
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;
}
Aggregations