List of usage examples for android.view MenuInflater inflate
public void inflate(@MenuRes int menuRes, Menu menu)
From source file:cochrane343.journal.MainActivity.java
/** * Inflates the menu of this activity and adds action items to the action bar. *///from w w w.ja v a2 s . com @Override public boolean onCreateOptionsMenu(final Menu menu) { final MenuInflater inflater = getMenuInflater(); inflater.inflate(R.menu.activity_main_actions, menu); return super.onCreateOptionsMenu(menu); }
From source file:br.com.bioscada.apps.biotracks.fragments.MarkerDetailFragment.java
@Override public void onCreateOptionsMenu(Menu menu, MenuInflater inflater) { inflater.inflate(R.menu.marker_detail, menu); updateWaypoint(false);/* ww w. j av a 2 s.c o m*/ Track track = myTracksProviderUtils.getTrack(waypoint.getTrackId()); boolean isSharedWithMe = track != null ? track.isSharedWithMe() : true; menu.findItem(R.id.marker_detail_edit).setVisible(!isSharedWithMe); menu.findItem(R.id.marker_detail_delete).setVisible(!isSharedWithMe); String photoUrl = waypoint.getPhotoUrl(); boolean hasPhoto = photoUrl != null && !photoUrl.equals(""); menu.findItem(R.id.marker_detail_view_photo).setVisible(hasPhoto); TrackIconUtils.setMenuIconColor(menu); }
From source file:com.andrewshu.android.reddit.mail.InboxActivity.java
/** * Populates the menu.// ww w. j av a 2 s . com */ @Override public boolean onCreateOptionsMenu(Menu menu) { super.onCreateOptionsMenu(menu); MenuInflater inflater = getMenuInflater(); inflater.inflate(R.menu.inbox, menu); 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//from w w w . j a v a2 s . com 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:br.com.GUI.perfil.MeusAlunos.java
@Override public void onCreateOptionsMenu(Menu menu, MenuInflater inflater) { inflater.inflate(R.menu.adicionar_aluno_actions, menu); final SearchView searchView = new SearchView(getActivity().getActionBar().getThemedContext()); searchView.setQueryHint("Search"); menu.add(Menu.NONE, Menu.NONE, 1, "@string").setIcon(android.R.drawable.ic_menu_search) .setActionView(searchView)//from w w w.j a v a 2 s .co m .setShowAsAction(MenuItem.SHOW_AS_ACTION_ALWAYS | MenuItem.SHOW_AS_ACTION_COLLAPSE_ACTION_VIEW); searchView.setOnQueryTextListener(new OnQueryTextListener() { @Override public boolean onQueryTextChange(String newText) { if (newText.length() > 0) { // Search atualizarMeusAlunos(newText.toString()); } else { // Do something when there's no input atualizarMeusAlunos(newText.toString()); } return false; } @Override public boolean onQueryTextSubmit(String arg0) { // TODO Auto-generated method stub atualizarMeusAlunos(arg0.toString()); return false; } }); }
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 w w w . ja v a2 s. c o m*/ 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: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 . j a v a 2 s . c o m*/ }
From source file:br.com.GUI.aulas.Agenda.java
@Override public void onCreateOptionsMenu(Menu menu, MenuInflater inflater) { inflater.inflate(R.menu.agenda_actions, menu); final SearchView searchView = new SearchView(getActivity().getActionBar().getThemedContext()); searchView.setQueryHint("Search"); menu.add(Menu.NONE, Menu.NONE, 1, "@string").setIcon(android.R.drawable.ic_menu_search) .setActionView(searchView)// ww w. j av a 2s . c o m .setShowAsAction(MenuItem.SHOW_AS_ACTION_ALWAYS | MenuItem.SHOW_AS_ACTION_COLLAPSE_ACTION_VIEW); searchView.setOnQueryTextListener(new OnQueryTextListener() { @Override public boolean onQueryTextChange(String newText) { if (newText.length() > 0) { // Search atualizarAgenda(newText.toString()); } else { // Do something when there's no input atualizarAgenda(newText.toString()); } return false; } @Override public boolean onQueryTextSubmit(String arg0) { // TODO Auto-generated method stub atualizarAgenda(arg0.toString()); return false; } }); }
From source file:de.lebenshilfe_muenster.uk_gebaerden_muensterland.sign_trainer.AbstractSignTrainerFragment.java
@Override public void onCreateOptionsMenu(Menu menu, MenuInflater inflater) { Log.d(TAG, "onCreateOptionsMenu " + hashCode()); inflater.inflate(R.menu.options_sign_trainer, menu); }
From source file:it.scoppelletti.mobilepower.app.CommonMenuFragment.java
/** * Creazione del menù./*from w w w . j a va2s.c o m*/ * * @param menu Menù * @param inflater Parser del menù */ @Override public void onCreateOptionsMenu(Menu menu, MenuInflater inflater) { String pkgName; MenuItem menuItem; pkgName = AppUtils.getFullPackageName(getActivity(), true); if (StringUtils.isBlank(pkgName)) { inflater.inflate(R.menu.common, menu); } else { inflater.inflate(R.menu.demo, menu); menuItem = menu.findItem(R.id.cmd_buy); MenuItemCompat.setShowAsAction(menuItem, MenuItemCompat.SHOW_AS_ACTION_NEVER); } menuItem = menu.findItem(R.id.cmd_settings); MenuItemCompat.setShowAsAction(menuItem, MenuItemCompat.SHOW_AS_ACTION_NEVER); menuItem = menu.findItem(R.id.cmd_help); MenuItemCompat.setShowAsAction(menuItem, MenuItemCompat.SHOW_AS_ACTION_NEVER); menuItem = menu.findItem(R.id.cmd_about); MenuItemCompat.setShowAsAction(menuItem, MenuItemCompat.SHOW_AS_ACTION_NEVER); }