use of com.android.internal.view.menu.SubMenuBuilder in project android_frameworks_base by DirtyUnicorns.
the class ActionMenuPresenter 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 com.android.internal.view.menu.SubMenuBuilder in project android_frameworks_base by AOSPA.
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) {
// responsibility to display the new submenu.
return false;
}
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;
}
}
mActionButtonPopup = new ActionButtonSubmenu(mContext, subMenu, anchor);
mActionButtonPopup.setForceShowIcon(preserveIconSpacing);
mActionButtonPopup.show();
super.onSubMenuSelected(subMenu);
return true;
}
use of com.android.internal.view.menu.SubMenuBuilder in project android_frameworks_base by AOSPA.
the class ActionMenuPresenter 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 com.android.internal.view.menu.SubMenuBuilder in project android_frameworks_base by crdroidandroid.
the class ActionMenuPresenter 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 com.android.internal.view.menu.SubMenuBuilder in project android_frameworks_base by crdroidandroid.
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) {
// responsibility to display the new submenu.
return false;
}
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;
}
}
mActionButtonPopup = new ActionButtonSubmenu(mContext, subMenu, anchor);
mActionButtonPopup.setForceShowIcon(preserveIconSpacing);
mActionButtonPopup.show();
super.onSubMenuSelected(subMenu);
return true;
}
Aggregations