List of usage examples for android.view Menu findItem
public MenuItem findItem(int id);
From source file:com.paramedic.mobshaman.fragments.AccionesDetalleServicioFragment.java
@Override public void onPrepareOptionsMenu(Menu menu) { super.onPrepareOptionsMenu(menu); MenuItem itemMapa = menu.findItem(R.id.action_ubicacion_servicio); itemMapa.setVisible(false);// w ww.j a v a2 s .c o m }
From source file:at.bitfire.davdroid.syncadapter.EnterCredentialsFragment.java
@Override public void onPrepareOptionsMenu(Menu menu) { boolean ok = editUserName.getText().length() > 0 && editPassword.getText().length() > 0; // check host name try {/*from w ww .jav a 2s. c om*/ URL url = new URL(URIUtils.sanitize(protocol + editBaseURL.getText().toString())); if (url.getHost() == null || url.getHost().isEmpty()) ok = false; } catch (MalformedURLException e) { ok = false; } MenuItem item = menu.findItem(R.id.next); item.setEnabled(ok); }
From source file:com.alainesp.fan.sanderson.BookActivity.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.show_book_menu, menu); nextBookItem = menu.findItem(R.id.book_menu_next); prevBookItem = menu.findItem(R.id.book_menu_prev); prevBookItem.setVisible(Catalog.readingBook.getIndexInSerie() > 0); nextBookItem.setVisible((Catalog.readingBook.getIndexInSerie() + 1) < serie.getBookCount()); return true;/*ww w . j a v a 2s . c om*/ }
From source file:com.mikecorrigan.trainscorekeeper.MainActivity.java
@Override public boolean onPrepareOptionsMenu(Menu menu) { Log.vc(VERBOSE, TAG, "onPrepareOptionsMenu: menu=" + menu); super.onPrepareOptionsMenu(menu); MenuItem item = menu.findItem(R.id.new_game); item.setEnabled(true);/*ww w . j a va2 s. c om*/ item = menu.findItem(R.id.undo); item.setEnabled(undoEnabled()); item = menu.findItem(R.id.redo); item.setEnabled(redoEnabled()); return true; }
From source file:ar.org.fsadosky.iptablesmanager.fragment.ApplicationsListFragment.java
@Override public void onCreateOptionsMenu(Menu menu, MenuInflater inflater) { super.onCreateOptionsMenu(menu, inflater); // Inflate the menu; this adds items to the action bar if it is present. inflater.inflate(R.menu.menu_main, menu); // Retrieve the SearchView and plug it into SearchManager searchView = (SearchView) MenuItemCompat.getActionView(menu.findItem(R.id.action_search)); searchView.setOnQueryTextListener(this); }
From source file:com.karmick.android.citizenalert.alarm.AlarmAddActivity.java
@Override public boolean onCreateOptionsMenu(Menu menu) { boolean result = super.onCreateOptionsMenu(menu); menu.findItem(R.id.menu_item_save).setVisible(false); menu.findItem(R.id.menu_item_delete).setVisible(true); return result; }
From source file:net.amdroid.metrosp.MetroSP.java
@Override public boolean onCreateOptionsMenu(Menu menu) { super.onCreateOptionsMenu(menu); menu.add(0, MENU_PREFS, 0, getResources().getText(R.string.preferences)); MenuItem item = menu.findItem(MENU_PREFS); item.setIcon(R.drawable.ic_menu_preferences); return true;/* ww w . java 2s.c om*/ }
From source file:com.github.chenxiaolong.dualbootpatcher.appsharing.AppListFragment.java
@Override public void onCreateOptionsMenu(Menu menu, MenuInflater inflater) { inflater.inflate(R.menu.actionbar_app_list, menu); final MenuItem item = menu.findItem(R.id.action_search); final SearchView searchView = (SearchView) item.getActionView(); searchView.setOnQueryTextListener(this); if (mSearchQuery != null) { searchView.setIconified(false);/*from w ww . j a v a2s.c o m*/ //item.expandActionView(); searchView.setQuery(mSearchQuery, false); searchView.clearFocus(); } }
From source file:com.example.google.touroflondon.MainActivity.java
/** * Create the option menu. Compiled from the common menu description * (common.xml). In addition, when in the phone layout, the phone.xml menu * description is also appended./* w ww . j a v a 2 s.co m*/ * * @param menu * @return */ @Override public boolean onCreateOptionsMenu(Menu menu) { MenuInflater inflater = getMenuInflater(); inflater.inflate(R.menu.common, menu); // Load special action items for the phone layout. if (!mIsTablet) { inflater.inflate(R.menu.phone, menu); if (mPoiListFragment != null && mPoiListFragment.isVisible()) { mPoiMenuItem = menu.findItem(R.id.menu_poi); mPoiMenuItem.setVisible(false); // hide by default } } return super.onCreateOptionsMenu(menu); }
From source file:alaindc.memenguage.View.MainActivity.java
@Override public boolean onCreateOptionsMenu(Menu menu) { getMenuInflater().inflate(R.menu.main, menu); // Retrieve the SearchView and plug it into SearchManager final SearchView searchView = (SearchView) MenuItemCompat.getActionView(menu.findItem(R.id.action_search)); SearchManager searchManager = (SearchManager) getSystemService(SEARCH_SERVICE); searchView.setSearchableInfo(searchManager.getSearchableInfo(getComponentName())); searchView.setOnQueryTextListener(new SearchView.OnQueryTextListener() { @Override/* www . j av a 2 s. c om*/ public boolean onQueryTextSubmit(String query) { Log.d("MainActivity Search", query.toString()); return false; } @Override public boolean onQueryTextChange(String newText) { Log.d("MainActivity Search", newText.toString()); adapter.getFilter().filter(newText); adapter.notifyDataSetChanged(); return false; } }); return true; }