List of usage examples for android.view Menu clear
public void clear();
From source file:com.dwdesign.tweetings.fragment.SearchTweetsFragment.java
@Override public void onCreateOptionsMenu(Menu menu, MenuInflater inflater) { menu.clear(); inflater.inflate(R.menu.menu_searchtweets, menu); super.onCreateOptionsMenu(menu, inflater); }
From source file:com.emuneee.nctrafficcams.ui.fragments.CameraDetailFragment.java
@Override public void onCreateOptionsMenu(Menu menu, MenuInflater inflater) { menu.clear(); inflater.inflate(R.menu.camera_detail_fragment, menu); mFavoriteMenuItem = menu.findItem(R.id.favorite); mUnfavoriteMenuItem = menu.findItem(R.id.unfavorite); Bundle args = getArguments();/*from w w w . j a v a 2s .c o m*/ mCamera = args.getParcelable(Constants.BUNDLE_CAMERA); // set the appropriate favorite icon if (mCamera.isFavorite()) { mFavoriteMenuItem.setVisible(false); mUnfavoriteMenuItem.setVisible(true); } else { mFavoriteMenuItem.setVisible(true); mUnfavoriteMenuItem.setVisible(false); } }
From source file:edu.ucsb.cs.cs185.inspirante.collectiondetails.CollectionDetailsActivity.java
@Override public boolean onPrepareOptionsMenu(final Menu menu) { menu.clear(); if (canAddImage) { getMenuInflater().inflate(R.menu.menu_collection_details, menu); } else {//from www . j a v a 2 s .co m getMenuInflater().inflate(R.menu.menu_collection_details_noadd, menu); } return super.onCreateOptionsMenu(menu); }
From source file:ru.yandex.subtitles.ui.fragment.AbstractFragment.java
private void createToolbarOptionsMenu(@NonNull final Toolbar toolbar) { final Menu menu = toolbar.getMenu(); menu.clear(); onCreateOptionsMenu(menu, getMenuInflater()); onPrepareOptionsMenu(menu);/*from w ww . j a v a2 s . c om*/ }
From source file:com.mifos.mifosxdroid.online.loancharge.LoanChargeFragment.java
@SuppressWarnings("deprecation") @Override/*from www . j av a2 s .c o m*/ public void onPrepareOptionsMenu(Menu menu) { menu.clear(); MenuItem menuItemAddNewLoanCharge = menu.add(Menu.NONE, MENU_ITEM_ADD_NEW_LOAN_CHARGES, Menu.NONE, getString(R.string.add_new)); menuItemAddNewLoanCharge.setIcon(getResources().getDrawable(R.drawable.ic_add_white_24dp)); if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.HONEYCOMB) menuItemAddNewLoanCharge.setShowAsAction(MenuItem.SHOW_AS_ACTION_IF_ROOM); super.onPrepareOptionsMenu(menu); }
From source file:edu.stanford.mobisocial.dungbeetle.ImageViewerActivity.java
public boolean onPreparePanel(int featureId, View view, Menu menu) { menu.clear(); menu.add(0, SAVE, 0, "Download to SD Card"); menu.add(0, SET_PROFILE, 0, "Set as Profile"); //menu.add(1, ANON, 1, "Add anon profile"); return true;//from w w w . j a va2 s. co m }
From source file:ufms.br.com.ufmsapp.fragment.DetalhesEventoFragment.java
@Override public void onPrepareOptionsMenu(Menu menu) { super.onPrepareOptionsMenu(menu); menu.clear(); getActivity().getMenuInflater().inflate(R.menu.detalhe_evento_menu, menu); MenuItem item = menu.findItem(R.id.action_mark_favorite); EventoFavorite eventoFavorite = MyApplication.getWritableDatabase() .eventoFavoriteById(evento.getIdEventoServidor()); if (eventoFavorite != null) { if (eventoFavorite.getEventoFavoriteStatus() == 0) { item.setIcon(R.mipmap.ic_favorite_border_white_24dp); } else if (eventoFavorite.getEventoFavoriteStatus() == 1) { item.setIcon(R.mipmap.ic_favorite_white_24dp); }/*from ww w .ja va 2 s .c o m*/ } }
From source file:com.veniosg.dir.android.fragment.SideNavFragment.java
private void setListChoiceListener() { getListView().setMultiChoiceModeListener(new AbsListView.MultiChoiceModeListener() { @Override// w ww . j av a 2 s . c o m public boolean onPrepareActionMode(android.view.ActionMode mode, Menu menu) { menu.clear(); mode.getMenuInflater().inflate(R.menu.cab_bookmarks, menu); if (getListView().getCheckedItemCount() != 1) { menu.removeItem(R.id.menu_open_parent); } return true; } @Override public void onDestroyActionMode(android.view.ActionMode mode) { setStatusBarColour(getActivity(), false); } @Override public boolean onCreateActionMode(android.view.ActionMode mode, Menu menu) { setStatusBarColour(getActivity(), true); return true; } @Override public boolean onActionItemClicked(android.view.ActionMode mode, MenuItem item) { switch (item.getItemId()) { case R.id.menu_delete: long[] ids = getListView().getCheckedItemIds(); for (long id : ids) { getListView().getContext().getContentResolver().delete(BookmarkProvider.CONTENT_URI, BookmarkProvider._ID + "=?", new String[] { "" + id }); } mode.finish(); return true; case R.id.menu_open_parent: int pos = 0; SparseBooleanArray checked = getListView().getCheckedItemPositions(); for (int i = 0; i < getListView().getCount(); i++) { if (checked.get(i)) { pos = i; } } String path = ((Cursor) getListAdapter().getItem(pos)).getString(2); ((BookmarkContract) getActivity()).onBookmarkSelected(new File(path).getParent()); mode.finish(); return true; } return false; } @Override public void onItemCheckedStateChanged(android.view.ActionMode mode, int position, long id, boolean checked) { if (getListView().getCheckedItemCount() != 0) { mode.setTitle(getListView().getCheckedItemCount() + " " + getString(R.string.selected)); // Force actions' refresh mode.invalidate(); } } }); getListView().setChoiceMode(ListView.CHOICE_MODE_MULTIPLE_MODAL); }
From source file:com.cypress.cysmart.CommonFragments.ProfileControlFragment.java
@Override public void onCreateOptionsMenu(Menu menu, MenuInflater inflater) { menu.clear(); inflater.inflate(R.menu.global, menu); MenuItem graph = menu.findItem(R.id.graph); MenuItem log = menu.findItem(R.id.log); MenuItem search = menu.findItem(R.id.search); MenuItem clearcache = menu.findItem(R.id.clearcache); search.setVisible(false);// w ww.j a v a 2 s. co m graph.setVisible(false); log.setVisible(true); clearcache.setVisible(true); super.onCreateOptionsMenu(menu, inflater); }
From source file:com.fusionx.lightirc.ui.ChannelFragment.java
@OnClick(R.id.auto_complete_button) public void onAutoCompleteClick(final ImageButton autoComplete) { if (isPopupShown) { mPopupMenu.dismiss();//w w w. java 2 s .c o m } else { // TODO - this needs to be synchronized properly final Collection<WorldUser> users = getChannel().getUsers(); final List<WorldUser> sortedList = new ArrayList<>(users.size()); final String message = mMessageBox.getText().toString(); final String finalWord = Iterables.getLast(IRCUtils.splitRawLine(message, false)); for (final WorldUser user : users) { if (StringUtils.startsWithIgnoreCase(user.getNick(), finalWord)) { sortedList.add(user); } } if (sortedList.size() == 1) { changeLastWord(Iterables.getLast(sortedList).getNick()); } else if (sortedList.size() > 1) { if (mPopupMenu == null) { mPopupMenu = new PopupMenu(getActivity(), autoComplete); mPopupMenu.setOnDismissListener(this); mPopupMenu.setOnMenuItemClickListener(this); } final Menu innerMenu = mPopupMenu.getMenu(); innerMenu.clear(); Collections.sort(sortedList, new IRCUserComparator(getChannel())); for (final WorldUser user : sortedList) { innerMenu.add(user.getNick()); } mPopupMenu.show(); } } }