List of usage examples for android.view Menu findItem
public MenuItem findItem(int id);
From source file:com.microsoft.mimickeralarm.appcore.AlarmListFragment.java
@Override public void onCreateOptionsMenu(Menu menu, MenuInflater inflater) { inflater.inflate(R.menu.menu_alarm_list, menu); MenuItem add = menu.findItem(R.id.action_add_alarm); add.setVisible(mShowAddButtonInToolbar); super.onCreateOptionsMenu(menu, inflater); }
From source file:at.flack.activity.NewFbContactActivity.java
@Override public boolean onCreateOptionsMenu(Menu menu) { MenuInflater inflater = getMenuInflater(); inflater.inflate(R.menu.new_contact, menu); SearchManager searchManager = (SearchManager) getSystemService(Context.SEARCH_SERVICE); MenuItem searchMenuItem = menu.findItem(R.id.search); SearchView searchView = (SearchView) MenuItemCompat.getActionView(searchMenuItem); searchView.setIconifiedByDefault(false); searchView.setIconified(false);/*from www. j av a 2 s . c om*/ searchView.setSearchableInfo(searchManager.getSearchableInfo(getComponentName())); searchView.setSubmitButtonEnabled(true); searchView.setOnQueryTextListener(this); return true; }
From source file:com.javierc.albuquerquenow.SearchMap.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.search_map, menu); getActionBar().setHomeButtonEnabled(true); getActionBar().setDisplayShowTitleEnabled(false); getActionBar().setIcon(R.drawable.home); SearchView searchView = (SearchView) menu.findItem(R.id.menu_search).getActionView(); searchView.setOnQueryTextListener(n()); return true;//from w ww. ja v a 2 s .c o m }
From source file:net.mEmoZz.PopMovies.frags.DetailFragment.java
@Override public void onCreateOptionsMenu(Menu menu, MenuInflater inflater) { inflater.inflate(R.menu.detail_fragment, menu); MenuItem menuItem = menu.findItem(R.id.action_share); DetailShareProvider mShareActionProvider = (DetailShareProvider) MenuItemCompat.getActionProvider(menuItem); if (mShareActionProvider != null) { mShareActionProvider.setShareIntent(createShareForecastIntent()); }/*from w w w .j a v a2s. com*/ }
From source file:com.dnielfe.manager.AppManager.java
@Override public boolean onCreateOptionsMenu(Menu menu) { getMenuInflater().inflate(R.menu.appmanager, menu); mMenuItem = menu.findItem(R.id.actionselect); return true;/* w w w . j a va2 s. c o m*/ }
From source file:com.lovejoy777sarootool.rootool.fragments.BrowserFragment.java
@Override public void onCreateOptionsMenu(Menu menu, MenuInflater inflater) { inflater.inflate(R.menu.main, menu); if (BrowserActivity.isDrawerOpen()) { menu.findItem(R.id.paste).setVisible(false); menu.findItem(R.id.folderinfo).setVisible(false); menu.findItem(R.id.search).setVisible(false); }//from w w w .j a v a2 s . c o m MenuItem paste = menu.findItem(R.id.paste); paste.setVisible(!ClipBoard.isEmpty()); }
From source file:com.example.bluetoothlegatt.DeviceControlActivity.java
@Override public boolean onCreateOptionsMenu(Menu menu) { getMenuInflater().inflate(R.menu.gatt_services, menu); if (mConnected) { menu.findItem(R.id.menu_connect).setVisible(false); menu.findItem(R.id.menu_disconnect).setVisible(true); } else {// w w w .j av a2s . co m menu.findItem(R.id.menu_connect).setVisible(true); menu.findItem(R.id.menu_disconnect).setVisible(false); } return true; }
From source file:ch.citux.td.ui.TDActivity.java
@Override public boolean onCreateOptionsMenu(Menu menu) { MenuInflater inflater = getMenuInflater(); inflater.inflate(R.menu.main, menu); refreshItem = menu.findItem(R.id.menu_refresh); searchItem = menu.findItem(R.id.menu_search); // Associate searchable configuration with the SearchView SearchManager searchManager = (SearchManager) getSystemService(Context.SEARCH_SERVICE); SearchView searchView = (SearchView) MenuItemCompat.getActionView(searchItem); searchView.setSearchableInfo(searchManager.getSearchableInfo(getComponentName())); searchView.setOnQueryTextFocusChangeListener(this); return true;/* w w w .ja v a 2 s .c o m*/ }
From source file:co.carlosjimenez.android.currencyalerts.app.DetailActivityFragment.java
private void finishCreatingMenu(Menu menu) { // Retrieve the share menu item MenuItem menuItem = menu.findItem(R.id.action_share); menuItem.setIntent(createShareForecastIntent()); menuItem = menu.findItem(R.id.action_alert); MenuTint.colorMenuItem(menuItem, getResources().getColor(R.color.detail_toolbar_icon_color), null); }
From source file:net.mEmoZz.PopMovies.frags.MoviesFragment.java
@Override public void onCreateOptionsMenu(Menu menu, MenuInflater inflater) { inflater.inflate(R.menu.movies_fragment, menu); up = menu.findItem(R.id.action_up).setVisible(false); pop = menu.findItem(R.id.action_pop); high = menu.findItem(R.id.action_high); fav = menu.findItem(R.id.action_fav); SharedPreferences prefs = getActivity().getSharedPreferences(SORT, 0); SharedPreferences.Editor editor = prefs.edit(); if (pop.isChecked()) { editor.putString(SORT_SATE, "popChecked"); } else if (high.isChecked()) { editor.putString(SORT_SATE, "highChecked"); } else {/*from w w w . j a v a 2s .co m*/ editor.putString(SORT_SATE, "favChecked"); } editor.commit(); }