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.android.packageinstaller.permission.ui.PermissionAppsFragment.java
@Override public void onCreateOptionsMenu(Menu menu, MenuInflater inflater) { mShowSystemMenu = menu.add(Menu.NONE, MENU_SHOW_SYSTEM, Menu.NONE, R.string.menu_show_system); mHideSystemMenu = menu.add(Menu.NONE, MENU_HIDE_SYSTEM, Menu.NONE, R.string.menu_hide_system); updateMenu();//from w w w. j a v a2 s .c om }
From source file:com.notifry.android.SourceList.java
@Override public boolean onCreateOptionsMenu(Menu menu) { boolean result = super.onCreateOptionsMenu(menu); menu.add(0, ADD_SOURCE, 0, R.string.create_source).setIcon(android.R.drawable.ic_menu_add) .setShowAsAction(MenuItem.SHOW_AS_ACTION_IF_ROOM); menu.add(0, REFRESH_SERVER, 0, R.string.refresh_sources_server).setIcon(android.R.drawable.ic_menu_rotate) .setShowAsAction(MenuItem.SHOW_AS_ACTION_IF_ROOM); return result; }
From source file:com.mifos.mifosxdroid.online.savingaccountsummary.SavingsAccountSummaryFragment.java
@Override public void onPrepareOptionsMenu(Menu menu) { menu.clear();// w ww.ja v a 2 s.c o m menu.add(Menu.NONE, MENU_ITEM_DATA_TABLES, Menu.NONE, Constants.DATA_TABLE_SAVINGS_ACCOUNTS_NAME); menu.add(Menu.NONE, MENU_ITEM_DOCUMENTS, Menu.NONE, getResources().getString(R.string.documents)); super.onPrepareOptionsMenu(menu); }
From source file:jp.envision.android.cloudfingerpaint.CloudFingerPaint.java
@Override public boolean onCreateOptionsMenu(Menu menu) { super.onCreateOptionsMenu(menu); //menu.add(0, COLOR_MENU_ID, 0, "Color").setShortcut('3', 'c'); menu.add(0, PRINT_MENU_ID, 0, "Print").setShortcut('3', 's'); menu.add(0, CLEAR_MENU_ID, 0, "Clear").setShortcut('3', 'c'); /*/*from w ww . j a va 2s . co m*/ 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'); */ return true; }
From source file:csic.ceab.movelab.beepath.MainActivity.java
@Override public boolean onCreateOptionsMenu(Menu menu) { menu.add(0, MENU_EXIT, 1, "EXIT"); return true; }
From source file:org.alfresco.mobile.android.application.fragments.browser.ChildrenBrowserFragment.java
public static void getMenu(AlfrescoSession session, Menu menu, Folder parentFolder, boolean actionMode) { MenuItem mi;/*from ww w.j av a 2 s . c om*/ if (parentFolder == null) { return; } Permissions permission = null; try { permission = session.getServiceRegistry().getDocumentFolderService().getPermissions(parentFolder); } catch (Exception e) { return; } if (!actionMode) { mi = menu.add(Menu.NONE, MenuActionItem.MENU_SEARCH_FOLDER, Menu.FIRST + MenuActionItem.MENU_SEARCH_FOLDER, R.string.search); mi.setIcon(R.drawable.ic_search); mi.setShowAsAction(MenuItem.SHOW_AS_ACTION_IF_ROOM); } if (!actionMode && permission.canAddChildren()) { mi = menu.add(Menu.NONE, MenuActionItem.MENU_CREATE_FOLDER, Menu.FIRST + MenuActionItem.MENU_CREATE_FOLDER, R.string.folder_create); mi.setIcon(R.drawable.ic_add_folder); mi.setShowAsAction(MenuItem.SHOW_AS_ACTION_IF_ROOM); SubMenu createMenu = menu.addSubMenu(Menu.NONE, MenuActionItem.MENU_DEVICE_CAPTURE, Menu.FIRST + MenuActionItem.MENU_DEVICE_CAPTURE, R.string.add_menu); createMenu.setIcon(android.R.drawable.ic_menu_add); createMenu.getItem().setShowAsAction(MenuItem.SHOW_AS_ACTION_ALWAYS); createMenu.add(Menu.NONE, MenuActionItem.MENU_UPLOAD, Menu.FIRST + MenuActionItem.MENU_UPLOAD, R.string.upload_title); createMenu.add(Menu.NONE, MenuActionItem.MENU_CREATE_DOCUMENT, Menu.FIRST + MenuActionItem.MENU_CREATE_DOCUMENT, R.string.create_document); createMenu.add(Menu.NONE, MenuActionItem.MENU_DEVICE_CAPTURE_CAMERA_PHOTO, Menu.FIRST + MenuActionItem.MENU_DEVICE_CAPTURE_CAMERA_PHOTO, R.string.take_photo); if (AndroidVersion.isICSOrAbove()) { createMenu.add(Menu.NONE, MenuActionItem.MENU_DEVICE_CAPTURE_CAMERA_VIDEO, Menu.FIRST + MenuActionItem.MENU_DEVICE_CAPTURE_CAMERA_VIDEO, R.string.make_video); } createMenu.add(Menu.NONE, MenuActionItem.MENU_DEVICE_CAPTURE_MIC_AUDIO, Menu.FIRST + MenuActionItem.MENU_DEVICE_CAPTURE_MIC_AUDIO, R.string.record_audio); } if (actionMode) { mi = menu.add(Menu.NONE, MenuActionItem.MENU_DETAILS, Menu.FIRST + MenuActionItem.MENU_DETAILS, R.string.action_view_properties); mi.setIcon(R.drawable.ic_details); mi.setShowAsAction(MenuItem.SHOW_AS_ACTION_IF_ROOM); } if (actionMode && permission.canEdit()) { mi = menu.add(Menu.NONE, MenuActionItem.MENU_EDIT, Menu.FIRST + MenuActionItem.MENU_EDIT, R.string.edit); mi.setIcon(R.drawable.ic_edit); mi.setShowAsAction(MenuItem.SHOW_AS_ACTION_IF_ROOM); } if (actionMode && permission.canDelete()) { mi = menu.add(Menu.NONE, MenuActionItem.MENU_DELETE, Menu.FIRST + MenuActionItem.MENU_DELETE, R.string.delete); mi.setIcon(R.drawable.ic_delete); mi.setShowAsAction(MenuItem.SHOW_AS_ACTION_IF_ROOM); } if (!actionMode) { mi = menu.add(Menu.NONE, MenuActionItem.MENU_REFRESH, Menu.FIRST + MenuActionItem.MENU_REFRESH, R.string.refresh); mi.setIcon(R.drawable.ic_refresh); mi.setShowAsAction(MenuItem.SHOW_AS_ACTION_IF_ROOM); } }
From source file:net.reichholf.dreamdroid.activities.MovieListActivity.java
public boolean onCreateOptionsMenu(Menu menu) { super.onCreateOptionsMenu(menu); menu.add(0, MENU_RELOAD, 0, getText(R.string.reload)).setIcon(android.R.drawable.ic_menu_rotate); menu.add(0, MENU_LOCATIONS, 1, getText(R.string.locations)).setIcon(R.drawable.ic_menu_locations); menu.add(0, MENU_TAGS, 1, getText(R.string.tags)).setIcon(R.drawable.ic_menu_tags); return true;//from w w w . ja v a2 s . c o m }
From source file:net.pocketmine.server.HomeActivity.java
@Override public boolean onCreateOptionsMenu(Menu menu) { MenuItem log = menu.add(0, CONSOLE_CODE, 0, R.string.title_activity_log).setIcon(R.drawable.hardware_dock); MenuItemCompat.setShowAsAction(log, MenuItem.SHOW_AS_ACTION_IF_ROOM); SubMenu sub = menu.addSubMenu(getString(R.string.abs_settings)); /**//from w ww . java 2 s.c o m * Set Icon for Submenu */ sub.setIcon(R.drawable.action_settings); /** * Build navigation for submenu */ sub.add(0, VERSION_MANAGER_CODE, 0, getString(R.string.abs_version_manager)); sub.add(0, PROPERTIES_EDITOR_CODE, 0, getString(R.string.abs_properties_editor)); sub.add(0, PLUGINS_CODE, 0, getString(R.string.abs_plugins)); sub.add(0, FORCE_CLOSE_CODE, 0, getString(R.string.abs_force_close)); sub.add(0, ABOUT_US_CODE, 0, getString(R.string.abs_about)); sub.add(0, REINSTALL_PHP_CODE, 0, getString(R.string.php_reinstall)); MenuItem subgrp = sub.getItem(); MenuItemCompat.setShowAsAction(subgrp, MenuItem.SHOW_AS_ACTION_IF_ROOM | MenuItem.SHOW_AS_ACTION_WITH_TEXT); return true; }
From source file:com.mifos.mifosxdroid.online.loanaccountsummary.LoanAccountSummaryFragment.java
@Override public void onPrepareOptionsMenu(Menu menu) { menu.clear();//from www . j a v a 2 s . c om menu.add(Menu.NONE, MENU_ITEM_DATA_TABLES, Menu.NONE, Constants.DATA_TABLE_LOAN_NAME); menu.add(Menu.NONE, MENU_ITEM_LOAN_TRANSACTIONS, Menu.NONE, getResources().getString(R.string.transactions)); menu.add(Menu.NONE, MENU_ITEM_REPAYMENT_SCHEDULE, Menu.NONE, getResources().getString(R.string.loan_repayment_schedule)); menu.add(Menu.NONE, MENU_ITEM_DOCUMENTS, Menu.NONE, getResources().getString(R.string.documents)); menu.add(Menu.NONE, MENU_ITEM_CHARGES, Menu.NONE, getResources().getString(R.string.charges)); super.onPrepareOptionsMenu(menu); }
From source file:android.example.com.animationdemos.ScreenSlideActivity.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) ? R.string.action_finish : R.string.action_next); item.setShowAsAction(MenuItem.SHOW_AS_ACTION_IF_ROOM | MenuItem.SHOW_AS_ACTION_WITH_TEXT); return true;//from w w w. java 2 s. co m }