List of usage examples for android.view SubMenu add
public MenuItem add(int groupId, int itemId, int order, CharSequence title);
From source file:org.alfresco.mobile.android.application.extension.samsung.pen.SNoteEditorActivity.java
@Override public boolean onCreateOptionsMenu(Menu menu) { toolsSubMenu = menu.addSubMenu(Menu.NONE, SNoteMenuActionItem.MENU_EDITOR_TOOLS, Menu.FIRST, R.string.editor_tools);/* w w w. j a v a 2 s .c o m*/ toolsSubMenu.setIcon(R.drawable.ic_edit); toolsSubMenu.getItem().setShowAsAction(MenuItem.SHOW_AS_ACTION_ALWAYS); // TOOLS MENU MenuItem mi = toolsSubMenu.add(Menu.NONE, SNoteMenuActionItem.MENU_EDITOR_PEN, Menu.FIRST + SNoteMenuActionItem.MENU_EDITOR_PEN, R.string.editor_pen); mi.setIcon(R.drawable.ic_edit); mi.setShowAsAction(MenuItem.SHOW_AS_ACTION_IF_ROOM); mi = toolsSubMenu.add(Menu.NONE, SNoteMenuActionItem.MENU_EDITOR_TEXT, Menu.FIRST + SNoteMenuActionItem.MENU_EDITOR_TEXT, R.string.editor_text); mi.setIcon(R.drawable.ic_text); mi.setShowAsAction(MenuItem.SHOW_AS_ACTION_IF_ROOM); mi = toolsSubMenu.add(Menu.NONE, SNoteMenuActionItem.MENU_EDITOR_SELECTION, Menu.FIRST + SNoteMenuActionItem.MENU_EDITOR_SELECTION, R.string.editor_selection); mi.setIcon(R.drawable.ic_selection); mi.setShowAsAction(MenuItem.SHOW_AS_ACTION_IF_ROOM); mi = toolsSubMenu.add(Menu.NONE, SNoteMenuActionItem.MENU_EDITOR_ERASER, Menu.FIRST + SNoteMenuActionItem.MENU_EDITOR_ERASER, R.string.editor_eraser); mi.setIcon(R.drawable.ic_eraser); mi.setShowAsAction(MenuItem.SHOW_AS_ACTION_IF_ROOM); // TOOL SETTINGS MENU SubMenu toolsSettingSubMenu = menu.addSubMenu(Menu.NONE, SNoteMenuActionItem.MENU_EDITOR_SETTINGS, Menu.FIRST + SNoteMenuActionItem.MENU_EDITOR_SETTINGS, R.string.editor_tools_settings); toolsSettingSubMenu.setIcon(R.drawable.ic_action_settings); toolsSettingSubMenu.getItem().setShowAsAction(MenuItem.SHOW_AS_ACTION_ALWAYS); mi = toolsSettingSubMenu.add(Menu.NONE, SNoteMenuActionItem.MENU_EDITOR_SETTINGS_PEN, Menu.FIRST + SNoteMenuActionItem.MENU_EDITOR_SETTINGS_PEN, R.string.editor_pen); mi.setIcon(R.drawable.ic_edit); mi.setShowAsAction(MenuItem.SHOW_AS_ACTION_IF_ROOM); mi = toolsSettingSubMenu.add(Menu.NONE, SNoteMenuActionItem.MENU_EDITOR_SETTINGS_TEXT, Menu.FIRST + SNoteMenuActionItem.MENU_EDITOR_SETTINGS_TEXT, R.string.editor_text); mi.setIcon(R.drawable.ic_text); mi.setShowAsAction(MenuItem.SHOW_AS_ACTION_IF_ROOM); mi = toolsSettingSubMenu.add(Menu.NONE, SNoteMenuActionItem.MENU_EDITOR_SETTINGS_SELECTION, Menu.FIRST + SNoteMenuActionItem.MENU_EDITOR_SETTINGS_SELECTION, R.string.editor_selection); mi.setIcon(R.drawable.ic_selection); mi.setShowAsAction(MenuItem.SHOW_AS_ACTION_IF_ROOM); mi = toolsSettingSubMenu.add(Menu.NONE, SNoteMenuActionItem.MENU_EDITOR_SETTINGS_ERASER, Menu.FIRST + SNoteMenuActionItem.MENU_EDITOR_SETTINGS_ERASER, R.string.editor_eraser); mi.setIcon(R.drawable.ic_eraser); mi.setShowAsAction(MenuItem.SHOW_AS_ACTION_IF_ROOM); // ADD MENU SubMenu addSubMenu = menu.addSubMenu(Menu.NONE, SNoteMenuActionItem.MENU_EDITOR_ADD, Menu.FIRST + SNoteMenuActionItem.MENU_EDITOR_ADD, R.string.editor_add_menu); addSubMenu.setIcon(R.drawable.ic_add); addSubMenu.getItem().setShowAsAction(MenuItem.SHOW_AS_ACTION_ALWAYS); // IMAGE mi = addSubMenu.add(Menu.NONE, SNoteMenuActionItem.MENU_EDITOR_ADD_IMAGE, Menu.FIRST + SNoteMenuActionItem.MENU_EDITOR_ADD_IMAGE, R.string.editor_add_image); mi.setIcon(R.drawable.ic_add_image); mi.setShowAsAction(MenuItem.SHOW_AS_ACTION_IF_ROOM); // PAGES SubMenu pagesMenu = menu.addSubMenu(Menu.NONE, SNoteMenuActionItem.MENU_EDITOR_PAGE, Menu.FIRST + SNoteMenuActionItem.MENU_EDITOR_PAGE, R.string.editor_pages); pagesMenu.setIcon(R.drawable.ic_pages); pagesMenu.getItem().setShowAsAction(MenuItem.SHOW_AS_ACTION_ALWAYS); mi = pagesMenu.add(Menu.NONE, SNoteMenuActionItem.MENU_EDITOR_PAGE_MOVE, Menu.FIRST + SNoteMenuActionItem.MENU_EDITOR_PAGE_MOVE, R.string.editor_pages_move); mi.setIcon(R.drawable.ic_pages); mi.setShowAsAction(MenuItem.SHOW_AS_ACTION_IF_ROOM); mi = pagesMenu.add(Menu.NONE, SNoteMenuActionItem.MENU_EDITOR_PAGE_ADD, Menu.FIRST + SNoteMenuActionItem.MENU_EDITOR_PAGE_ADD, R.string.editor_pages_add); mi.setIcon(R.drawable.ic_add_page); mi.setShowAsAction(MenuItem.SHOW_AS_ACTION_IF_ROOM); mi = pagesMenu.add(Menu.NONE, SNoteMenuActionItem.MENU_EDITOR_PAGE_DELETE, Menu.FIRST + SNoteMenuActionItem.MENU_EDITOR_PAGE_DELETE, R.string.editor_pages_remove); mi.setIcon(R.drawable.ic_delete); mi.setShowAsAction(MenuItem.SHOW_AS_ACTION_IF_ROOM); // EXTRA SETTINGS // SAVE mi = menu.add(Menu.NONE, SNoteMenuActionItem.MENU_EDITOR_SAVE, Menu.FIRST + SNoteMenuActionItem.MENU_EDITOR_SAVE, R.string.editor_save); mi.setShowAsAction(MenuItem.SHOW_AS_ACTION_NEVER); super.onCreateOptionsMenu(menu); return true; }
From source file:org.thbz.hanguldrill.MainActivity.java
@Override public boolean onCreateOptionsMenu(Menu menu) { // Inflate the menu; this adds items to the action bar if it is present. getMenuInflater().inflate(R.menu.main_activity_actions, menu); try {//ww w . j a v a2s . c om MenuItem configListItem = menu.findItem(R.id.action_configlist); String[] configIds = Settings.ConfigManager.getAllConfigIds(this); if (configListItem.hasSubMenu() && configIds.length > 0) { SubMenu configMenu = configListItem.getSubMenu(); if (configMenu == null) { if (BuildConfig.DEBUG) Log.d(TAG, "configMenu = null"); } else { // On ajoute une entre pour chacune des configurations existantes for (int i = 0; i < configIds.length; i++) { String configId = configIds[i]; Settings.Configuration config = Settings.ConfigManager.getConfigFromId(this, configId); String name = config.getName(this); configMenu.add(Menu.NONE, START_MENUITEM_ID + i, i, name); } } // Set configMenu title try { Settings.Configuration lastSelectedConfig = Settings.ConfigManager.getLastSelectedConfig(this); if (lastSelectedConfig != null) { String configName = lastSelectedConfig.getName(this); if (configName != null) { if (configName.length() > 15) configName = configName.substring(0, 13) + "\u2026"; configListItem.setTitle(configName); } } } catch (ClassCastException exc) { toastError("Exception : " + exc.getMessage()); } } } catch (InternalException exc) { if (BuildConfig.DEBUG) if (BuildConfig.DEBUG) Log.e(TAG, "Erreur interne", exc); } return super.onCreateOptionsMenu(menu); }
From source file:com.grarak.kerneladiutor.activities.NavigationActivity.java
private void appendFragments(boolean setShortcuts) { sActualFragments.clear();//from w w w .ja v a2 s. c o m Menu menu = mNavigationView.getMenu(); menu.clear(); SubMenu lastSubMenu = null; for (NavigationFragment navigationFragment : sFragments) { Fragment fragment = navigationFragment.mFragment; int id = navigationFragment.mId; Drawable drawable = ContextCompat.getDrawable(this, Utils.DONATED && Prefs.getBoolean("section_icons", false, this) && navigationFragment.mDrawable != 0 ? navigationFragment.mDrawable : R.drawable.ic_blank); if (fragment == null) { lastSubMenu = menu.addSubMenu(id); sActualFragments.put(id, null); } else if (Prefs.getBoolean(fragment.getClass().getSimpleName() + "_enabled", true, this)) { MenuItem menuItem = lastSubMenu == null ? menu.add(0, id, 0, id) : lastSubMenu.add(0, id, 0, id); menuItem.setIcon(drawable); menuItem.setCheckable(true); if (mSelection != 0) { mNavigationView.setCheckedItem(mSelection); } sActualFragments.put(id, fragment); } } if (setShortcuts) { setShortcuts(); } }
From source file:id.ridon.keude.AppDetailsData.java
@Override public boolean onPrepareOptionsMenu(Menu menu) { super.onPrepareOptionsMenu(menu); menu.clear();// w w w.j a v a2 s . co m if (app == null) return true; if (app.canAndWantToUpdate()) { MenuItemCompat.setShowAsAction( menu.add(Menu.NONE, INSTALL, 0, R.string.menu_upgrade).setIcon(R.drawable.ic_menu_refresh), MenuItemCompat.SHOW_AS_ACTION_ALWAYS | MenuItemCompat.SHOW_AS_ACTION_WITH_TEXT); } // Check count > 0 due to incompatible apps resulting in an empty list. if (!app.isInstalled() && app.suggestedVercode > 0 && adapter.getCount() > 0) { MenuItemCompat.setShowAsAction( menu.add(Menu.NONE, INSTALL, 1, R.string.menu_install).setIcon(android.R.drawable.ic_menu_add), MenuItemCompat.SHOW_AS_ACTION_ALWAYS | MenuItemCompat.SHOW_AS_ACTION_WITH_TEXT); } else if (app.isInstalled()) { MenuItemCompat.setShowAsAction( menu.add(Menu.NONE, UNINSTALL, 1, R.string.menu_uninstall) .setIcon(android.R.drawable.ic_menu_delete), MenuItemCompat.SHOW_AS_ACTION_IF_ROOM | MenuItemCompat.SHOW_AS_ACTION_WITH_TEXT); if (mPm.getLaunchIntentForPackage(app.id) != null) { MenuItemCompat.setShowAsAction( menu.add(Menu.NONE, LAUNCH, 1, R.string.menu_launch) .setIcon(android.R.drawable.ic_media_play), MenuItemCompat.SHOW_AS_ACTION_ALWAYS | MenuItemCompat.SHOW_AS_ACTION_WITH_TEXT); } } MenuItemCompat.setShowAsAction( menu.add(Menu.NONE, SHARE, 1, R.string.menu_share).setIcon(android.R.drawable.ic_menu_share), MenuItemCompat.SHOW_AS_ACTION_IF_ROOM | MenuItemCompat.SHOW_AS_ACTION_WITH_TEXT); menu.add(Menu.NONE, IGNOREALL, 2, R.string.menu_ignore_all) .setIcon(android.R.drawable.ic_menu_close_clear_cancel).setCheckable(true) .setChecked(app.ignoreAllUpdates); if (app.hasUpdates()) { menu.add(Menu.NONE, IGNORETHIS, 2, R.string.menu_ignore_this) .setIcon(android.R.drawable.ic_menu_close_clear_cancel).setCheckable(true) .setChecked(app.ignoreThisUpdate >= app.suggestedVercode); } if (app.webURL.length() > 0) { menu.add(Menu.NONE, WEBSITE, 3, R.string.menu_website).setIcon(android.R.drawable.ic_menu_view); } if (app.trackerURL.length() > 0) { menu.add(Menu.NONE, ISSUES, 4, R.string.menu_issues).setIcon(android.R.drawable.ic_menu_view); } if (app.sourceURL.length() > 0) { menu.add(Menu.NONE, SOURCE, 5, R.string.menu_source).setIcon(android.R.drawable.ic_menu_view); } if (app.bitcoinAddr != null || app.litecoinAddr != null || app.dogecoinAddr != null || app.flattrID != null || app.donateURL != null) { SubMenu donate = menu.addSubMenu(Menu.NONE, DONATE, 7, R.string.menu_donate) .setIcon(android.R.drawable.ic_menu_send); if (app.bitcoinAddr != null) donate.add(Menu.NONE, BITCOIN, 8, R.string.menu_bitcoin); if (app.litecoinAddr != null) donate.add(Menu.NONE, LITECOIN, 8, R.string.menu_litecoin); if (app.dogecoinAddr != null) donate.add(Menu.NONE, DOGECOIN, 8, R.string.menu_dogecoin); if (app.flattrID != null) donate.add(Menu.NONE, FLATTR, 9, R.string.menu_flattr); if (app.donateURL != null) donate.add(Menu.NONE, DONATE_URL, 10, R.string.menu_website); } if (app.isInstalled() && fdroidApp.bluetoothAdapter != null) { // ignore on devices without Bluetooth menu.add(Menu.NONE, SEND_VIA_BLUETOOTH, 6, R.string.send_via_bluetooth); } return true; }
From source file:com.ruesga.rview.MainActivity.java
private void updateAccountCustomFilters() { // Remove all custom filters and re-add them final DrawerNavigationMenu menu = (DrawerNavigationMenu) mBinding.drawerNavigationView.getMenu(); int myFiltersGroupIndex = menu.findGroupIndex(R.id.category_my_filters); MenuItem group = menu.getItem(myFiltersGroupIndex); SubMenu myFiltersSubMenu = group.getSubMenu(); int count = myFiltersSubMenu.size() - 1; for (int i = count; i >= 0; i--) { ((DrawerNavigationSubMenu) myFiltersSubMenu).removeItemAt(i); }/*from w w w . ja va 2 s . c om*/ mCustomFilters = Preferences.getAccountCustomFilters(this, mAccount); if (mCustomFilters != null) { int i = 0; for (CustomFilter filter : mCustomFilters) { int id = MY_FILTERS_GROUP_BASE_ID + i; String title = filter.mName + DrawerNavigationView.SEPARATOR + filter.mQuery.toString() + DrawerNavigationView.SEPARATOR + "ic_close"; MenuItem item = myFiltersSubMenu.add(group.getGroupId(), id, Menu.NONE, title); item.setIcon(R.drawable.ic_filter); item.setCheckable(true); i++; } } menu.setGroupVisible(R.id.category_my_filters, !mModel.isAccountExpanded && mCustomFilters != null && !mCustomFilters.isEmpty()); mBinding.drawerNavigationView.setCheckedItem(mModel.currentNavigationItemId); }
From source file:mp.teardrop.LibraryActivity.java
@Override public boolean onContextItemSelected(MenuItem item) { if (item.getGroupId() == MENU_GROUP_ROUND_BUTTON) { Limiter limiter = mPagerAdapter.getCurrentLimiter(); Intent intent = null;// w w w .j a v a 2 s .c om switch (mPagerAdapter.getCurrentType()) { case MediaUtils.TYPE_FILE: intent = new Intent(); intent.putExtra(LibraryAdapter.DATA_TYPE, MediaUtils.TYPE_FILE); intent.putExtra("file", limiter == null ? "/" : limiter.data.toString()); break; case MediaUtils.TYPE_UNIFIED: if (limiter != null && limiter.type <= 20) { intent = new Intent(); intent.putExtra(LibraryAdapter.DATA_TYPE, limiter.type); intent.putExtra(LibraryAdapter.DATA_ID, (Long) limiter.data); } //else continue with null limiter, which will play the entire MediaStore break; } mRoundPlayAllButton.setVisibility(View.GONE); pickSongs(intent, item.getItemId() == MENU_PLAY_ALL ? ACTION_PLAY_ALL : ACTION_ENQUEUE_ALL); return true; } if (item.getGroupId() != 0) { return super.onContextItemSelected(item); } final Intent intent = item.getIntent(); switch (item.getItemId()) { case MENU_EXPAND: expand(intent); if (mDefaultAction == ACTION_LAST_USED && mLastAction != ACTION_EXPAND) { mLastAction = ACTION_EXPAND; } break; case MENU_ENQUEUE: pickSongs(intent, ACTION_ENQUEUE); break; case MENU_PLAY: pickSongs(intent, ACTION_PLAY); break; case MENU_PLAY_ALL: pickSongs(intent, ACTION_PLAY_ALL); break; case MENU_ENQUEUE_ALL: pickSongs(intent, ACTION_ENQUEUE_ALL); break; case MENU_NEW_PLAYLIST: { NewPlaylistDialog dialog = new NewPlaylistDialog(this, null, R.string.create, intent); dialog.setDismissMessage(mHandler.obtainMessage(MSG_NEW_PLAYLIST, dialog)); dialog.show(); break; } case MENU_RENAME_PLAYLIST: { NewPlaylistDialog dialog = new NewPlaylistDialog(this, intent.getStringExtra("title"), R.string.rename, intent); dialog.setDismissMessage(mHandler.obtainMessage(MSG_RENAME_PLAYLIST, dialog)); dialog.show(); break; } case MENU_DELETE: String delete_message = getString(R.string.delete_item, intent.getStringExtra("title")); AlertDialog.Builder dialog = new AlertDialog.Builder(this); dialog.setTitle(R.string.delete); dialog.setMessage(delete_message) .setPositiveButton(R.string.delete, new DialogInterface.OnClickListener() { public void onClick(DialogInterface dialog, int id) { mHandler.sendMessage(mHandler.obtainMessage(MSG_DELETE, intent)); } }).setNegativeButton(R.string.cancel, new DialogInterface.OnClickListener() { public void onClick(DialogInterface dialog, int id) { } }); dialog.create().show(); break; case MENU_ADD_TO_PLAYLIST: { SubMenu playlistMenu = item.getSubMenu(); playlistMenu.add(0, MENU_NEW_PLAYLIST, 0, R.string.new_playlist).setIntent(intent); Cursor cursor = Playlist.queryPlaylists(getContentResolver()); if (cursor != null) { for (int i = 0, count = cursor.getCount(); i != count; ++i) { cursor.moveToPosition(i); long id = cursor.getLong(0); String name = cursor.getString(1); Intent copy = new Intent(intent); copy.putExtra("playlist", id); copy.putExtra("playlistName", name); playlistMenu.add(0, MENU_SELECT_PLAYLIST, 0, name).setIntent(copy); } cursor.close(); } break; } case MENU_SELECT_PLAYLIST: mHandler.sendMessage(mHandler.obtainMessage(MSG_ADD_TO_PLAYLIST, intent)); break; case MENU_MORE_FROM_ARTIST: { String selection = "_id="; selection += intent.getLongExtra(LibraryAdapter.DATA_ID, LibraryAdapter.INVALID_ID); setLimiter(-1, selection); updateLimiterViews(); break; } case MENU_MORE_FROM_ALBUM: setLimiter(-1, "_id=" + intent.getLongExtra(LibraryAdapter.DATA_ID, LibraryAdapter.INVALID_ID)); updateLimiterViews(); break; } return true; }
From source file:org.csp.everyaware.offline.Map.java
/*************************** OPTION MENU ***************************************************/ public boolean onCreateOptionsMenu(Menu menu) { String[] menuItems = getResources().getStringArray(R.array.map_optionmenu); SubMenu mapSubMenu = menu.addSubMenu("Map Modes").setIcon(android.R.drawable.ic_menu_mapmode); mapSubMenu.add(1, Menu.FIRST, Menu.FIRST, "Hybrid").setCheckable(false); mapSubMenu.add(1, Menu.FIRST + 1, Menu.FIRST, "Normal").setCheckable(false); mapSubMenu.add(1, Menu.FIRST + 2, Menu.FIRST + 2, "Satellite").setCheckable(false); mapSubMenu.add(1, Menu.FIRST + 3, Menu.FIRST + 3, "Terrain").setCheckable(false); return super.onCreateOptionsMenu(menu); }
From source file:com.ruesga.rview.MainActivity.java
private void updateAccountsDrawerInfo() { // Remove all accounts and re-add them final DrawerNavigationMenu menu = (DrawerNavigationMenu) mBinding.drawerNavigationView.getMenu(); int otherAccountGroupIndex = menu.findGroupIndex(R.id.category_other_accounts); MenuItem group = menu.getItem(otherAccountGroupIndex); SubMenu otherAccountsSubMenu = group.getSubMenu(); int count = otherAccountsSubMenu.size() - 1; for (int i = count; i > 0; i--) { ((DrawerNavigationSubMenu) otherAccountsSubMenu).removeItemAt(i); }//from w w w. j a va 2s. c o m int i = 0; for (Account account : mAccounts) { // Current account if (mAccount.isSameAs(account)) { i++; continue; } int id = OTHER_ACCOUNTS_GROUP_BASE_ID + i; String title = account.getAccountDisplayName() + DrawerNavigationView.SEPARATOR + account.getRepositoryDisplayName() + DrawerNavigationView.SEPARATOR + "ic_delete" + DrawerNavigationView.SEPARATOR + "false"; MenuItem item = otherAccountsSubMenu.add(group.getGroupId(), id, Menu.NONE, title); PicassoHelper.bindAvatar(this, PicassoHelper.getPicassoClient(this), account, account.mAccount, item, PicassoHelper.getDefaultAvatar(this, R.color.primaryDarkForeground)); i++; } if (mAccount != null) { updateAccountStatus(); } }
From source file:org.medcare.Dicom.DicomActivity.java
/** * Create some menu options./*ww w . j a va2s. c om*/ * * @see android.app.Activity#onCreateOptionsMenu(android.view.Menu) */ @Override public boolean onCreateOptionsMenu(Menu menu) { // SubMenu fileMenu = menu.addSubMenu("Fichier"); SubMenu editMenu = menu.addSubMenu("Processing"); // fileMenu.add(FILE, Quitter_MENU_ITEM, 1, "Quitter"); SubMenu ctMenu = menu.addSubMenu("CT"); SubMenu mrMenu = menu.addSubMenu("MR"); SubMenu otMenu = menu.addSubMenu("OT"); SubMenu usMenu = menu.addSubMenu("US"); SubMenu divMenu = menu.addSubMenu("AUTRES"); SubMenu collabMenu = menu.addSubMenu("COLLAB"); ctMenu.add(CT, CT_MONO2_12_lomb_an2, 0, "CT-MONO2-12-lomb-an2"); ctMenu.add(CT, CT_MONO2_16_brain, 1, "CT-MONO2-16-brain"); ctMenu.add(CT, CT_MONO2_16_chest, 2, "CT-MONO2-16-chest"); ctMenu.add(CT, CT_MONO2_16_ort, 3, "CT-MONO2-16-ort"); ctMenu.add(CT, CT_MONO2_8_abdo, 4, "CT-MONO2-8-abdo"); ctMenu.add(CT, CT_MONO2_16_ankle, 5, "CT-MONO2-16-ankle"); mrMenu.add(MR, MR_MONO2_12_an2, 0, "MR-MONO2-12-an2"); mrMenu.add(MR, MR_MONO2_12_angio_an1, 1, "MR-MONO2-12-angio-an1"); mrMenu.add(MR, MR_MONO2_12_shoulder, 2, "MR-MONO2-12-shoulder"); mrMenu.add(MR, MR_MONO2_16_head, 3, "MR-MONO2-16-head"); mrMenu.add(MR, MR_MONO2_16_knee, 4, "MR-MONO2-16-knee"); mrMenu.add(MR, MR_MONO2_8_16x_heart, 5, "MR-MONO2-8-16x-heart"); otMenu.add(OT, OT_MONO2_8_a7, 0, "OT-MONO2-8-a7"); otMenu.add(OT, OT_MONO2_8_colon, 1, "OT-MONO2-8-colon"); otMenu.add(OT, OT_MONO2_8_hip, 2, "OT-MONO2-8-hip"); otMenu.add(OT, OT_PAL_8_face, 3, "OT-PAL-8-face"); usMenu.add(US, US_MONO2_8_8x_execho, 0, "US-MONO2-8-8x-execho"); usMenu.add(US, US_PAL_8_10x_echo, 1, "US-PAL-8-10x-echo"); usMenu.add(US, US_RGB_8_epicard, 2, "US-RGB-8-epicard"); divMenu.add(DIV, CR_MONO1_10_chest, 0, "CR_MONO1_10_chest"); divMenu.add(DIV, R_MONO1_10_chest, 1, "R-MONO1-10-chest"); divMenu.add(DIV, NM_MONO2_16_13x_heart, 2, "NM-MONO2-16-13x-heart"); divMenu.add(DIV, XA_MONO2_8_12x_catheter, 3, "XA-MONO2-8-12x-catheter"); collabMenu.add(COLLAB, SET_CONNECT, 3, getString(R.string.main_menu_set_connect)); collabMenu.add(COLLAB, QUIT, 4, getString(R.string.main_menu_quit)); editMenu.add(EDIT, initialise_MENU_ITEM, 0, "reInit"); editMenu.add(EDIT, zoomIn_MENU_ITEM, 1, "zoomIn"); editMenu.add(EDIT, zoomOut_MENU_ITEM, 2, "zoomOut"); editMenu.add(EDIT, multiseuillage_MENU_ITEM, 3, "thresholding"); editMenu.add(EDIT, binarisation_MENU_ITEM, 4, "binarization"); editMenu.add(EDIT, median_MENU_ITEM, 5, "median"); editMenu.add(EDIT, inversion_MENU_ITEM, 6, "inversion"); editMenu.add(EDIT, gradient_MENU_ITEM, 7, "gradient"); editMenu.add(EDIT, segmentation_MENU_ITEM, 8, "segmentation"); return super.onCreateOptionsMenu(menu); }
From source file:com.dycody.android.idealnote.ListFragment.java
private void initSortingSubmenu() { final String[] arrayDb = getResources().getStringArray(R.array.sortable_columns); final String[] arrayDialog = getResources().getStringArray(R.array.sortable_columns_human_readable); int selected = Arrays.asList(arrayDb).indexOf(prefs.getString(Constants.PREF_SORTING_COLUMN, arrayDb[0])); SubMenu sortMenu = this.menu.findItem(R.id.menu_sort).getSubMenu(); for (int i = 0; i < arrayDialog.length; i++) { if (sortMenu.findItem(i) == null) { sortMenu.add(Constants.MENU_SORT_GROUP_ID, i, i, arrayDialog[i]); }/*from w ww . j av a2s.c o m*/ if (i == selected) sortMenu.getItem(i).setChecked(true); } sortMenu.setGroupCheckable(Constants.MENU_SORT_GROUP_ID, true, true); }