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.kii.demo.sync.ui.fragments.FileListFragment.java
@Override public void onCreateOptionsMenu(Menu menu, MenuInflater inflater) { menu.add(0, OPTIONS_MENU_SCAN_CHANGE, 0, R.string.scan_change); menu.add(0, OPTIONS_MENU_DOWNLOAD_ALL, 1, R.string.download_all); return;/*from w ww . j a va 2s .c om*/ }
From source file:net.henryco.opalette.application.MainActivity.java
@Override public boolean onCreateOptionsMenu(Menu menu) { topBarButton = menu.add(0, topBarButtonId, 0, ""); topBarButton.setShowAsAction(MenuItem.SHOW_AS_ACTION_IF_ROOM); topOptButton = menu.add(Menu.NONE, topOptButtonId, Menu.NONE, ""); topOptButton.setShowAsAction(MenuItem.SHOW_AS_ACTION_IF_ROOM); restoreTopBarButton();//from ww w .j a v a2 s. com return super.onCreateOptionsMenu(menu); }
From source file:cm.aptoide.pt.ManageRepo.java
public boolean onCreateOptionsMenu(Menu menu) { super.onCreateOptionsMenu(menu); menu.add(Menu.NONE, ADD_REPO, 1, R.string.menu_add_repo).setIcon(android.R.drawable.ic_menu_add); menu.add(Menu.NONE, EDIT_REPO, 2, R.string.menu_edit_repo).setIcon(android.R.drawable.ic_menu_edit); menu.add(Menu.NONE, REM_REPO, 3, R.string.menu_rem_repo) .setIcon(android.R.drawable.ic_menu_close_clear_cancel); return true;/*from w w w . ja v a 2s. c o m*/ }
From source file:com.gmail.at.faint545.fragments.QueueFragment.java
@Override public void onPrepareOptionsMenu(Menu menu) { menu.clear();/* w w w. java 2 s . co m*/ /* Only show these options if there are jobs to delete */ if (mSelectedPositions.size() > 0 && mJobs.size() > 0) { menu.add(Menu.NONE, DELETE, Menu.NONE, "Delete selected"); menu.add(Menu.NONE, PAUSE, Menu.NONE, "Pause selected"); menu.add(Menu.NONE, RESUME, Menu.NONE, "Resume selected"); } else if (mJobs.size() > 0) { menu.add(Menu.NONE, DELETE, Menu.NONE, "Delete all"); menu.add(Menu.NONE, PAUSE, Menu.NONE, "Pause all"); menu.add(Menu.NONE, RESUME, Menu.NONE, "Resume all"); } super.onPrepareOptionsMenu(menu); }
From source file:com.mifos.mifosxdroid.online.LoanAccountSummaryFragment.java
@Override public void onPrepareOptionsMenu(Menu menu) { menu.clear();/*w ww . j a v a 2 s . co m*/ menu.addSubMenu(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)); int SUBMENU_ITEM_ID = 0; // Create a Sub Menu that holds a link to all data tables SubMenu dataTableSubMenu = menu.getItem(1).getSubMenu(); if (dataTableSubMenu != null && loanDataTables != null && loanDataTables.size() > 0) { Iterator<DataTable> dataTableIterator = loanDataTables.iterator(); while (dataTableIterator.hasNext()) { dataTableSubMenu.add(Menu.NONE, SUBMENU_ITEM_ID, Menu.NONE, dataTableIterator.next().getRegisteredTableName()); SUBMENU_ITEM_ID++; } } super.onPrepareOptionsMenu(menu); }
From source file:com.alphabetbloc.accessmrs.ui.user.BaseUserActivity.java
@Override public boolean onPrepareOptionsMenu(Menu menu) { menu.removeItem(MENU_ADMIN_PREFERENCES); SharedPreferences prefs = PreferenceManager.getDefaultSharedPreferences(getBaseContext()); boolean showMenu = prefs.getBoolean(getString(R.string.key_show_settings_menu), false); if (showMenu) menu.add(0, MENU_ADMIN_PREFERENCES, MENU_ADMIN_PREFERENCES, getString(R.string.pref_admin_settings)) .setIcon(android.R.drawable.ic_lock_lock); return super.onPrepareOptionsMenu(menu); }
From source file:cm.aptoide.pt.RemoteInSearch.java
@Override public boolean onCreateOptionsMenu(Menu menu) { // TODO Auto-generated method stub super.onCreateOptionsMenu(menu); menu.add(Menu.NONE, MANAGE_REPO, 1, R.string.menu_manage).setIcon(android.R.drawable.ic_menu_agenda); menu.add(Menu.NONE, SEARCH_MENU, 2, R.string.menu_search).setIcon(android.R.drawable.ic_menu_search); menu.add(Menu.NONE, SETTINGS, 3, R.string.menu_settings).setIcon(android.R.drawable.ic_menu_preferences); menu.add(Menu.NONE, ABOUT, 4, R.string.menu_about).setIcon(android.R.drawable.ic_menu_help); return true;/* w w w . ja v a 2 s. com*/ }
From source file:com.BreakingBytes.SifterReader.SifterReader.java
/** Menu button options. */ @Override//from ww w .j a va 2 s. c om public boolean onCreateOptionsMenu(Menu menu) { boolean result = super.onCreateOptionsMenu(menu); menu.add(0, LOGIN_ID, 0, R.string.menu_login); menu.add(0, DELETE_ID, 0, R.string.menu_delete); return result; }
From source file:net.reichholf.dreamdroid.activities.ServiceListActivity.java
@Override public boolean onCreateOptionsMenu(Menu menu) { super.onCreateOptionsMenu(menu); menu.add(0, MENU_SET_AS_DEFAULT, 0, getText(R.string.set_default)) .setIcon(android.R.drawable.ic_menu_set_as); menu.add(0, MENU_RELOAD, 0, getText(R.string.reload)).setIcon(android.R.drawable.ic_menu_rotate); menu.add(0, MENU_OVERVIEW, 0, getText(R.string.bouquet_overview)).setIcon(R.drawable.ic_menu_list_overview); return true;//ww w . j a va 2 s. co m }
From source file:com.example.shiwangi.dataplan.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;/*w w w.j a v a 2 s .co m*/ }