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.airg.android.permission.sample.MainActivity.java
@Override public boolean onCreateOptionsMenu(final Menu menu) { super.onCreateOptionsMenu(menu); final MenuItem record = menu.add(0, R.id.action_danger, 0, R.string.dangerous_action) .setIcon(R.drawable.ic_action_lock); MenuItemCompat.setShowAsAction(record, MenuItemCompat.SHOW_AS_ACTION_ALWAYS); return true;// w w w.j av a2 s .c o m }
From source file:com.wheelly.fragments.LocationsListFragment.java
@SuppressWarnings("deprecation") @Override/*from ww w . j a va2 s .c om*/ public void onCreateOptionsMenu(Menu menu, MenuInflater inflater) { super.onCreateOptionsMenu(menu, inflater); MenuCompat.setShowAsAction( menu.add(0, MENU_ADD, 0, R.string.item_add).setIcon(android.R.drawable.ic_menu_add), MenuItem.SHOW_AS_ACTION_ALWAYS); }
From source file:de.stadtrallye.rallyesoft.fragments.ChatroomFragment.java
@Override public void onCreateOptionsMenu(Menu menu, MenuInflater inflater) { MenuItem refreshMenuItem = menu.add(Menu.NONE, R.id.refresh_menu, 30, R.string.refresh); refreshMenuItem.setIcon(R.drawable.ic_refresh_light); refreshMenuItem.setShowAsAction(MenuItem.SHOW_AS_ACTION_COLLAPSE_ACTION_VIEW); MenuItem pictureMenuItem = menu.add(Menu.NONE, R.id.picture_menu, 10, R.string.take_picture); pictureMenuItem.setIcon(R.drawable.ic_camera_light); pictureMenuItem.setShowAsAction(MenuItem.SHOW_AS_ACTION_IF_ROOM); }
From source file:org.alfresco.mobile.android.application.fragments.fileexplorer.FileExplorerAdapter.java
public void getMenu(Menu menu, File f) { MenuItem mi;/* www .j av a 2 s. co m*/ if (f.isFile()) { mi = menu.add(Menu.NONE, R.id.menu_action_share, Menu.FIRST, R.string.share); mi.setShowAsAction(MenuItem.SHOW_AS_ACTION_NEVER); mi = menu.add(Menu.NONE, R.id.menu_upload, Menu.FIRST + 30, R.string.upload); mi.setShowAsAction(MenuItem.SHOW_AS_ACTION_NEVER); } if (f.canWrite() && downloadPath != null && f.getPath().startsWith(downloadPath)) { mi = menu.add(Menu.NONE, R.id.menu_action_edit, Menu.FIRST + 50, R.string.action_rename); mi.setShowAsAction(MenuItem.SHOW_AS_ACTION_NEVER); mi = menu.add(Menu.NONE, R.id.menu_action_delete, Menu.FIRST + 100, R.string.delete); mi.setShowAsAction(MenuItem.SHOW_AS_ACTION_NEVER); } if (DataProtectionManager.getInstance(getContext()).isEncryptionEnable()) { if (DataProtectionManager.getInstance(getContext()).isEncrypted(f.getPath())) { mi = menu.add(Menu.NONE, R.id.menu_file_decrypt, Menu.FIRST + 70, R.string.decrypt_action); mi.setShowAsAction(MenuItem.SHOW_AS_ACTION_NEVER); } else { mi = menu.add(Menu.NONE, R.id.menu_file_encrypt, Menu.FIRST + 70, R.string.encrypt_action); mi.setShowAsAction(MenuItem.SHOW_AS_ACTION_NEVER); } } }
From source file:com.synchophy.ui.CoverFlowActivity.java
@Override public boolean onPrepareOptionsMenu(Menu menu) { menu.clear();//from w ww . j a v a2 s . co m menu.add(0, BrowseActivity.MAIN, 0, R.string.mainMenu).setIcon(android.R.drawable.ic_menu_revert); menu.add(0, BrowseActivity.PLAYLIST, 1, R.string.playlist).setIcon(R.drawable.ic_menu_pmix_playlist); menu.add(0, BrowseActivity.FILTER, 1, PlayerManager.isFiltering() ? R.string.stopFiltering : R.string.startFiltering) .setIcon(PlayerManager.isFiltering() ? R.drawable.ic_menu_stop : R.drawable.ic_menu_filter); return super.onPrepareOptionsMenu(menu); }
From source file:com.metinkale.prayerapp.compass.Main.java
@Override public boolean onCreateOptionsMenu(Menu menu) { super.onCreateOptionsMenu(menu); mRefresh = menu.add(Menu.NONE, Menu.NONE, 1, R.string.refresh); mSwitch = menu.add(Menu.NONE, Menu.NONE, 0, R.string.switchCompass); MenuItemCompat.setShowAsAction(mRefresh, MenuItemCompat.SHOW_AS_ACTION_NEVER); MenuItemCompat.setShowAsAction(mSwitch, MenuItemCompat.SHOW_AS_ACTION_IF_ROOM); mSwitch.setIcon(MaterialDrawableBuilder.with(this).setIcon(MaterialDrawableBuilder.IconValue.MAP) .setColor(Color.WHITE).setToActionbarSize().build()); return true;/*from w ww. j ava2 s . co m*/ }
From source file:com.flashcard.iedu.flashcard.samples.cardFlip.MyCardFlipActivity.java
@Override public boolean onCreateOptionsMenu(Menu menu) { super.onCreateOptionsMenu(menu); // Add either a "photo" or "finish" button to the action bar, depending on which page // is currently selected. MenuItem item = menu.add(Menu.NONE, R.id.action_flip, Menu.NONE, mShowingBack ? R.string.action_photo : R.string.action_info); // item.setIcon(mShowingBack // ? R.drawable.ic_action_photo // : R.drawable.ic_action_info); item.setShowAsAction(MenuItem.SHOW_AS_ACTION_IF_ROOM); return true;//from www . j a va2 s . c o m }
From source file:org.teleal.cling.android.browser.MainActivity.java
@Override public boolean onCreateOptionsMenu(Menu menu) { menu.add(0, 0, 0, R.string.search_lan).setIcon(android.R.drawable.ic_menu_search); return true;/* w w w . j a v a 2 s . c om*/ }
From source file:com.drunkenhamster.facerecognitionfps.SnapFaceActivity.java
@Override public boolean onCreateOptionsMenu(Menu menu) { super.onCreateOptionsMenu(menu); MenuItem menu_Preference = menu.add(0, R.id.menu_Preferences, 0, R.string.menu_Preferences); menu_Preference.setIcon(android.R.drawable.ic_menu_preferences); MenuItem menu_AppMode = menu.add(0, R.id.menu_AppMode, 0, R.string.menu_AppMode); menu_AppMode.setIcon(android.R.drawable.ic_menu_manage); return true;/* w w w .j a v a 2s .c o m*/ }
From source file:org.alfresco.mobile.android.application.fragments.config.ConfigMenuEditorFragment.java
@Override public void onPrepareOptionsMenu(Menu menu) { menu.clear();/* w w w. java 2 s. c o m*/ menu.add(Menu.NONE, R.id.config_menu_save, Menu.FIRST, "Save"); menu.add(Menu.NONE, R.id.config_menu_send, Menu.FIRST, "Send"); menu.add(Menu.NONE, R.id.config_menu_reset, Menu.FIRST, "Reset"); menu.add(Menu.NONE, R.id.config_menu_clear, Menu.FIRST, "Clear"); }