use of com.actionbarsherlock.view.MenuItem in project ActionBarSherlock by JakeWharton.
the class MenuBuilder method addIntentOptions.
public int addIntentOptions(int group, int id, int categoryOrder, ComponentName caller, Intent[] specifics, Intent intent, int flags, MenuItem[] outSpecificItems) {
PackageManager pm = mContext.getPackageManager();
final List<ResolveInfo> lri = pm.queryIntentActivityOptions(caller, specifics, intent, 0);
final int N = lri != null ? lri.size() : 0;
if ((flags & FLAG_APPEND_TO_GROUP) == 0) {
removeGroup(group);
}
for (int i = 0; i < N; i++) {
final ResolveInfo ri = lri.get(i);
Intent rintent = new Intent(ri.specificIndex < 0 ? intent : specifics[ri.specificIndex]);
rintent.setComponent(new ComponentName(ri.activityInfo.applicationInfo.packageName, ri.activityInfo.name));
final MenuItem item = add(group, id, categoryOrder, ri.loadLabel(pm)).setIcon(ri.loadIcon(pm)).setIntent(rintent);
if (outSpecificItems != null && ri.specificIndex >= 0) {
outSpecificItems[ri.specificIndex] = item;
}
}
return N;
}
use of com.actionbarsherlock.view.MenuItem in project ActionBarSherlock by JakeWharton.
the class MenuWrapper method addInternal.
private MenuItem addInternal(android.view.MenuItem nativeItem) {
MenuItem item = new MenuItemWrapper(nativeItem);
mNativeMap.put(nativeItem, item);
return item;
}
use of com.actionbarsherlock.view.MenuItem in project ActionBarSherlock by JakeWharton.
the class MenuWrapper method addInternal.
private SubMenu addInternal(android.view.SubMenu nativeSubMenu) {
SubMenu subMenu = new SubMenuWrapper(nativeSubMenu);
android.view.MenuItem nativeItem = nativeSubMenu.getItem();
MenuItem item = subMenu.getItem();
mNativeMap.put(nativeItem, item);
return subMenu;
}
use of com.actionbarsherlock.view.MenuItem in project ActionBarSherlock by JakeWharton.
the class ActionBarView method onRestoreInstanceState.
@Override
public void onRestoreInstanceState(Parcelable p) {
SavedState state = (SavedState) p;
super.onRestoreInstanceState(state.getSuperState());
if (state.expandedMenuItemId != 0 && mExpandedMenuPresenter != null && mOptionsMenu != null) {
final MenuItem item = mOptionsMenu.findItem(state.expandedMenuItemId);
if (item != null) {
item.expandActionView();
}
}
if (state.isOverflowOpen) {
postShowOverflowMenu();
}
}
use of com.actionbarsherlock.view.MenuItem in project ActionBarSherlock by JakeWharton.
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);
}
}
}
Aggregations