use of com.actionbarsherlock.view.SubMenu 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.SubMenu in project ActionBarSherlock by JakeWharton.
the class SampleList method onCreateOptionsMenu.
@Override
public boolean onCreateOptionsMenu(Menu menu) {
SubMenu sub = menu.addSubMenu("Theme");
sub.add(0, R.style.Theme_Sherlock, 0, "Default");
sub.add(0, R.style.Theme_Sherlock_Light, 0, "Light");
sub.add(0, R.style.Theme_Sherlock_Light_DarkActionBar, 0, "Light (Dark Action Bar)");
sub.getItem().setShowAsAction(MenuItem.SHOW_AS_ACTION_ALWAYS | MenuItem.SHOW_AS_ACTION_WITH_TEXT);
return true;
}
use of com.actionbarsherlock.view.SubMenu in project ActionBarSherlock by JakeWharton.
the class SampleList method onCreateOptionsMenu.
@Override
public boolean onCreateOptionsMenu(Menu menu) {
SubMenu sub = menu.addSubMenu("Theme");
sub.add(0, R.style.Theme_Sherlock, 0, "Default");
sub.add(0, R.style.Theme_Sherlock_Light, 0, "Light");
sub.add(0, R.style.Theme_Sherlock_Light_DarkActionBar, 0, "Light (Dark Action Bar)");
sub.getItem().setShowAsAction(MenuItem.SHOW_AS_ACTION_ALWAYS | MenuItem.SHOW_AS_ACTION_WITH_TEXT);
return true;
}
use of com.actionbarsherlock.view.SubMenu in project Ushahidi_Android by ushahidi.
the class ShareActionProvider method onPrepareSubMenu.
/**
* {@inheritDoc}
*/
@Override
public void onPrepareSubMenu(SubMenu subMenu) {
// Clear since the order of items may change.
subMenu.clear();
ActivityChooserModel dataModel = ActivityChooserModel.get(mContext, mShareHistoryFileName);
PackageManager packageManager = mContext.getPackageManager();
final int expandedActivityCount = dataModel.getActivityCount();
final int collapsedActivityCount = Math.min(expandedActivityCount, mMaxShownActivityCount);
// Populate the sub-menu with a sub set of the activities.
for (int i = 0; i < collapsedActivityCount; i++) {
ResolveInfo activity = dataModel.getActivity(i);
subMenu.add(0, i, i, activity.loadLabel(packageManager)).setIcon(activity.loadIcon(packageManager)).setOnMenuItemClickListener(mOnMenuItemClickListener);
}
if (collapsedActivityCount < expandedActivityCount) {
// Add a sub-menu for showing all activities as a list item.
SubMenu expandedSubMenu = subMenu.addSubMenu(Menu.NONE, collapsedActivityCount, collapsedActivityCount, mContext.getString(R.string.abs__activity_chooser_view_see_all));
for (int i = 0; i < expandedActivityCount; i++) {
ResolveInfo activity = dataModel.getActivity(i);
expandedSubMenu.add(0, i, i, activity.loadLabel(packageManager)).setIcon(activity.loadIcon(packageManager)).setOnMenuItemClickListener(mOnMenuItemClickListener);
}
}
}
use of com.actionbarsherlock.view.SubMenu in project little-bear-dictionary by daimajia.
the class FileImportActivity method onCreateOptionsMenu.
@Override
public boolean onCreateOptionsMenu(Menu menu) {
SubMenu subMenu = menu.addSubMenu(R.string.setting_import);
subMenu.add(0, ORDER_DEFAULT, 0, getString(R.string.sort_default));
subMenu.add(0, ORDER_ABC, 0, getString(R.string.sort_abc));
subMenu.add(0, ORDER_TYPE, 0, getString(R.string.sort_type));
subMenu.add(0, ORDER_SIZE, 0, getString(R.string.sort_size));
subMenu.getItem().setShowAsAction(MenuItem.SHOW_AS_ACTION_ALWAYS | MenuItem.SHOW_AS_ACTION_WITH_TEXT);
return true;
}
Aggregations