List of usage examples for android.view Menu findItem
public MenuItem findItem(int id);
From source file:com.alley.android.ppi.app.DetailFragment.java
@Override public void onCreateOptionsMenu(Menu menu, MenuInflater inflater) { inflater.inflate(R.menu.detailfragment, menu); MenuItem menuItem = menu.findItem(R.id.action_share); mShareActionProvider = (ShareActionProvider) MenuItemCompat.getActionProvider(menuItem); if (mPropertyDescription != null) { mShareActionProvider.setShareIntent(createSharePropertyIntent()); }//w ww . java 2 s . c om }
From source file:com.irccloud.android.activity.PastebinEditorActivity.java
@Override public boolean onCreateOptionsMenu(Menu menu) { getMenuInflater().inflate(R.menu.activity_pastebineditor, menu); if (pasteID != null) { menu.findItem(R.id.action_save).setVisible(true); menu.findItem(R.id.action_send).setVisible(false); } else {//w ww.j a va 2s.c o m menu.findItem(R.id.action_save).setVisible(false); menu.findItem(R.id.action_send).setVisible(true); } return super.onCreateOptionsMenu(menu); }
From source file:de.lebenshilfe_muenster.uk_gebaerden_muensterland.sign_browser.SignBrowserFragment.java
@Override public void onCreateOptionsMenu(Menu menu, MenuInflater inflater) { Log.d(TAG, "onCreateOptionsMenu " + hashCode()); super.onCreateOptionsMenu(menu, inflater); inflater.inflate(R.menu.options_sign_browser, menu); final MenuItem item = menu.findItem(R.id.action_toggle_starred); if (this.showStarredOnly) { item.setIcon(R.drawable.ic_sign_browser_grade_checked); } else {//from ww w. ja va 2 s .c om item.setIcon(R.drawable.ic_sign_browser_grade_no_stroke); } final SearchManager searchManager = (SearchManager) getActivity().getSystemService(Context.SEARCH_SERVICE); final MenuItem searchItem = menu.findItem(R.id.action_search); final SearchView searchView = (SearchView) MenuItemCompat.getActionView(searchItem); searchView.setSearchableInfo(searchManager.getSearchableInfo(getActivity().getComponentName())); }
From source file:br.com.dgimenes.sunshine.DetailFragment.java
@Override public void onCreateOptionsMenu(Menu menu, MenuInflater inflater) { // Inflate the menu; this adds items to the action bar if it is present. inflater.inflate(R.menu.detailfragment, menu); // Retrieve the share menu item MenuItem menuItem = menu.findItem(R.id.action_share); // Get the provider and hold onto it to set/change the share intent. mShareActionProvider = (ShareActionProvider) MenuItemCompat.getActionProvider(menuItem); // If onLoadFinished happens before this, we can go ahead and set the share intent now. if (mForecast != null) { mShareActionProvider.setShareIntent(createShareForecastIntent()); }/* www .ja v a 2 s. c o m*/ }
From source file:app.com.oz_heng.android.sunshine.DetailFragment.java
@Override public void onCreateOptionsMenu(Menu menu, MenuInflater inflater) { // Inflate the menu; this adds items to the action bar if it is present. inflater.inflate(R.menu.detail_fragment, menu); // Retrieve the share menu item MenuItem menuItem = menu.findItem(R.id.action_share); // Get the provider and hold onto it to set/change the share intent. mShareActionProvider = (ShareActionProvider) MenuItemCompat.getActionProvider(menuItem); // If onLoadFinished happens before this, we can go ahead and set the share intent now. if (mForecast != null) { mShareActionProvider.setShareIntent(createShareForecastIntent()); }// ww w .j a v a2s . com }
From source file:ca.ualberta.cmput301w14t08.geochan.fragments.CustomLocationFragment.java
/** * Inflates the menu and adds any action bar items that are present. */// w ww .j av a 2 s . co m @Override public void onCreateOptionsMenu(Menu menu, MenuInflater inflater) { MenuItem item = menu.findItem(R.id.action_settings); item.setVisible(true); super.onCreateOptionsMenu(menu, inflater); }
From source file:com.locution.hereyak.LoginActivity.java
@Override public boolean onCreateOptionsMenu(Menu menu) { super.onCreateOptionsMenu(menu); getMenuInflater().inflate(R.menu.login, menu); MenuItem item = menu.findItem(R.id.action_forgot_password); if (item != null) { item.setOnMenuItemClickListener(new MenuItem.OnMenuItemClickListener() { public boolean onMenuItemClick(MenuItem item) { lostPassword();/*from w ww .j a v a 2 s . co m*/ return true; } }); } return true; }
From source file:dtu.ds.warnme.app.activity.MainActivity.java
@Override public boolean onCreateOptionsMenu(Menu menu) { getMenuInflater().inflate(R.menu.main, menu); menuItemDesc = menu.findItem(R.id.action_desc); menuItemLogin = menu.findItem(R.id.action_login); menuItemRegister = menu.findItem(R.id.action_register); menuItemLogout = menu.findItem(R.id.action_logout); updateUserInterface();/*from ww w . j a v a 2s . c o m*/ return true; }
From source file:com.openerp.addons.note.AddFollowerFragment.java
@Override public void onCreateOptionsMenu(Menu menu, MenuInflater inflater) { inflater.inflate(R.menu.menu_fragment_note, menu); SearchView searchView = (SearchView) menu.findItem(R.id.menu_note_search).getActionView(); searchView.setOnQueryTextListener(getQueryListener(listAdapters)); searchView.setOnCloseListener(new OnCloseListener() { @Override/* ww w.j a v a 2s . c o m*/ public boolean onClose() { getPartnersFromLocal(); return false; } }); // disabling the COMPOSE NOTE,WRITE,CANCEL options MenuItem item_compose = menu.findItem(R.id.menu_note_compose); item_compose.setVisible(false); MenuItem item_write = menu.findItem(R.id.menu_note_write); item_write.setVisible(false); MenuItem item_cancel = menu.findItem(R.id.menu_note_cancel); item_cancel.setVisible(false); }
From source file:ansteph.com.beecabfordrivers.view.CabResponder.JobsBoard.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.menu_jobs_board, menu); MenuItem loggedUser = menu.findItem(R.id.action_loggedUser); if (mGlobalRetainer.get_grDriver().getName() != null) { loggedUser.setTitle(mGlobalRetainer.get_grDriver().getName()); }//from w w w. j a va 2 s. c om return true; }