List of usage examples for android.view Menu add
public MenuItem add(int groupId, int itemId, int order, @StringRes int titleRes);
From source file:com.getchute.android.photopickerplus.ui.fragment.FragmentRoot.java
@SuppressLint("NewApi") @Override/*from w w w . j ava2s . co m*/ public void onCreateOptionsMenu(Menu menu, MenuInflater inflater) { super.onCreateOptionsMenu(menu, inflater); MenuItem menuItemUse = menu.add(0, AssetActivity.USE_ITEM, 0, R.string.button_use_media); menuItemUse.setShowAsAction(MenuItem.SHOW_AS_ACTION_ALWAYS); }
From source file:com.janela.mobile.ui.user.HomeActivity.java
@Override public void onLoadFinished(Loader<List<User>> listLoader, List<User> orgs) { this.orgs = orgs; int sharedPreferencesOrgId = sharedPreferences.getInt(PREF_ORG_ID, -1); int targetOrgId = org == null ? sharedPreferencesOrgId : org.getId(); Menu menu = navigationView.getMenu(); menu.removeGroup(R.id.user_select);/*from w w w. j a v a2s. co m*/ for (int i = 0; i < orgs.size(); ++i) { final MenuItem item = menu.add(R.id.user_select, i, Menu.NONE, orgs.get(i).getLogin()); avatars.bind(item, orgs.get(i)); if (orgs.get(i).getId() == targetOrgId) { setOrg(orgs.get(i)); } } // If the target org is invalid (e.g. first login), select the first one if (targetOrgId == -1 && orgs.size() > 0) { setOrg(orgs.get(0)); } menu.setGroupVisible(R.id.user_select, false); }
From source file:edu.cmu.cylab.starslinger.view.PickRecipientsActivity.java
@Override public boolean onCreateOptionsMenu(Menu menu) { MenuItem iAdd = menu.add(0, MENU_CONTACTINVITE, 0, R.string.menu_SelectShareApp) .setIcon(R.drawable.ic_action_add_person); MenuItemCompat.setShowAsAction(iAdd, MenuItemCompat.SHOW_AS_ACTION_IF_ROOM); MenuItem iHelp = menu.add(0, MENU_HELP, 0, R.string.menu_Help).setIcon(R.drawable.ic_action_help); MenuItemCompat.setShowAsAction(iHelp, MenuItemCompat.SHOW_AS_ACTION_ALWAYS); menu.add(0, MENU_CONTACTINVITE, 0, R.string.menu_SelectShareApp).setIcon(R.drawable.ic_action_add_person); menu.add(0, MENU_FEEDBACK, 0, R.string.menu_sendFeedback).setIcon(android.R.drawable.ic_menu_send); return true;// w w w. j a v a 2 s . com }
From source file:net.gaast.giggity.ChooserActivity.java
@Override public boolean onCreateOptionsMenu(Menu menu) { super.onCreateOptionsMenu(menu); menu.add(Menu.NONE, 1, 5, R.string.settings).setShortcut('0', 's') .setIcon(R.drawable.ic_settings_white_24dp).setShowAsAction(MenuItem.SHOW_AS_ACTION_ALWAYS); menu.add(Menu.NONE, 2, 7, R.string.add_dialog).setShortcut('0', 'a').setIcon(R.drawable.ic_add_white_24dp) .setShowAsAction(MenuItem.SHOW_AS_ACTION_ALWAYS); return true;//from w w w .j ava2 s . c o m }
From source file:com.zapto.park.ParkActivity.java
public boolean onCreateOptionsMenu(Menu menu) { super.onCreateOptionsMenu(menu); MenuItem item1 = menu.add(Menu.NONE, 1, Menu.NONE, "Create Employee"); item1.setIcon(android.R.drawable.ic_menu_myplaces); MenuItem item4 = menu.add(Menu.NONE, 4, Menu.NONE, "Update Log"); item4.setIcon(android.R.drawable.ic_menu_more); MenuItem item3 = menu.add(Menu.NONE, 3, Menu.NONE, "View Log"); item3.setIcon(android.R.drawable.ic_menu_gallery); MenuItem item2 = menu.add(Menu.NONE, 2, Menu.NONE, "Settings"); item2.setIcon(android.R.drawable.ic_menu_manage); MenuItem item5 = menu.add(Menu.NONE, 5, Menu.NONE, "Send Emails"); item5.setIcon(android.R.drawable.ic_menu_more); MenuItem item6 = menu.add(Menu.NONE, 6, Menu.NONE, "SMTP Settings"); item6.setIcon(android.R.drawable.ic_menu_more); /*// ww w . j av a 2 s. c o m MenuItem item5 = menu.add(Menu.NONE, 5, Menu.NONE, "Get Dirs"); item5.setIcon(android.R.drawable.ic_menu_manage); */ return true; }
From source file:com.graphics.FingerPaint.java
@Override public boolean onCreateOptionsMenu(Menu menu) { super.onCreateOptionsMenu(menu); menu.add(0, COLOR_MENU_ID, 0, "Color").setShortcut('3', 'c'); menu.add(0, EMBOSS_MENU_ID, 0, "Emboss").setShortcut('4', 's'); menu.add(0, BLUR_MENU_ID, 0, "Blur").setShortcut('5', 'z'); menu.add(0, ERASE_MENU_ID, 0, "Erase").setShortcut('5', 'z'); menu.add(0, SRCATOP_MENU_ID, 0, "SrcATop").setShortcut('5', 'z'); /****/* ww w . ja v a 2 s .co m*/ * Is this the mechanism to extend with filter effects? Intent intent = * new Intent(null, getIntent().getData()); * intent.addCategory(Intent.CATEGORY_ALTERNATIVE); * menu.addIntentOptions( Menu.ALTERNATIVE, 0, new ComponentName(this, * NotesList.class), null, intent, 0, null); *****/ return true; }
From source file:com.plnyyanks.frcnotebook.activities.ViewEvent.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.view_event, menu); if (event != null && !event.isOfficial()) { //allow updating of scores via URL for unofficial events, but not for official ones menu.add(0, ID_ADD_MATCHES, Menu.NONE, R.string.action_add_matches); }//from w w w . j ava 2 s . c o m return true; }
From source file:com.giantturtle.badenumbersquiz.PrepareYourSelfActivity.java
@Override public boolean onCreateOptionsMenu(Menu menu) { super.onCreateOptionsMenu(menu); getMenuInflater().inflate(R.menu.activity_screen_slide, menu); menu.findItem(R.id.action_previous).setEnabled(mPager.getCurrentItem() > 0); // Add either a "next" or "finish" button to the action bar, depending on which page // is currently selected. MenuItem item = menu.add(Menu.NONE, R.id.action_next, Menu.NONE, (mPager.getCurrentItem() == mPagerAdapter.getCount() - 1)//ako je predposlednja stranica onda da prikae finish, a ako nije predposlednja ? R.string.action_finish : R.string.action_next); item.setShowAsAction(MenuItem.SHOW_AS_ACTION_IF_ROOM | MenuItem.SHOW_AS_ACTION_WITH_TEXT); return true;//w ww. ja va 2 s . co m }
From source file:org.alfresco.mobile.android.application.fragments.sync.SyncCursorAdapter.java
public void getMenu(Menu menu, Integer statut, boolean rootSynced) { MenuItem mi;//from w ww .j ava 2 s . c om switch (statut) { case SyncContentStatus.STATUS_HIDDEN: mi = menu.add(Menu.NONE, R.id.menu_action_favorite_group, Menu.FIRST, R.string.favorite); mi.setShowAsAction(MenuItem.SHOW_AS_ACTION_NEVER); break; case SyncContentStatus.STATUS_FAILED: case SyncContentStatus.STATUS_REQUEST_USER: mi = menu.add(Menu.NONE, R.id.menu_sync_resolution, Menu.FIRST, R.string.sync_resolve_conflict); mi.setShowAsAction(MenuItem.SHOW_AS_ACTION_NEVER); break; default: if (rootSynced) { mi = menu.add(Menu.NONE, R.id.menu_action_sync_group_unsync, Menu.FIRST, R.string.unsync); mi.setShowAsAction(MenuItem.SHOW_AS_ACTION_NEVER); } break; } }
From source file:gov.nasa.arc.geocam.geocam.GeoCamMobile.java
@Override public boolean onCreateOptionsMenu(Menu menu) { super.onCreateOptionsMenu(menu); MenuItem settingsItem = menu.add(0, SETTINGS_ID, 0, R.string.main_menu_settings); settingsItem.setIcon(getResources().getDrawable(android.R.drawable.ic_menu_preferences)); MenuItem aboutItem = menu.add(1, ABOUT_ID, 0, R.string.main_menu_about); aboutItem.setIcon(getResources().getDrawable(android.R.drawable.ic_menu_info_details)); MenuItem exitItem = menu.add(2, EXIT_ID, 0, R.string.main_menu_exit); exitItem.setIcon(getResources().getDrawable(android.R.drawable.ic_menu_close_clear_cancel)); if (TRACK_ENABLED) { MenuItem trackItem = menu.add(3, TRACK_ID, 0, "Tracks"); trackItem.setIcon(getResources().getDrawable(android.R.drawable.ic_menu_mapmode)); }/* w w w. jav a 2s .c om*/ return true; }