List of usage examples for android.view Menu removeItem
public void removeItem(int id);
From source file:com.pindroid.fragment.ViewBookmarkFragment.java
@Override public void onPrepareOptionsMenu(Menu menu) { if (bookmark != null) { if (!isMyself()) { menu.removeItem(R.id.menu_addbookmark); menu.removeItem(R.id.menu_view_editbookmark); menu.removeItem(R.id.menu_view_deletebookmark); } else {/* ww w . ja v a 2 s . c om*/ menu.removeItem(R.id.menu_view_addbookmark); } } else { menu.removeItem(R.id.menu_view); menu.removeItem(R.id.menu_view_sendbookmark); menu.removeItem(R.id.menu_view_editbookmark); menu.removeItem(R.id.menu_view_deletebookmark); } }
From source file:com.janela.mobile.ui.gist.GistFragment.java
@Override public void onPrepareOptionsMenu(Menu menu) { super.onPrepareOptionsMenu(menu); boolean owner = isOwner(); if (!owner) { menu.removeItem(R.id.m_delete); MenuItem starItem = menu.findItem(R.id.m_star); starItem.setEnabled(loadFinished && !owner); if (starred) starItem.setTitle(R.string.unstar); else// w w w .java 2 s . com starItem.setTitle(R.string.star); } else menu.removeItem(R.id.m_star); }
From source file:com.github.pockethub.android.ui.gist.GistFragment.java
@Override public void onPrepareOptionsMenu(Menu menu) { boolean owner = isOwner(); if (!owner) { menu.removeItem(R.id.m_delete); MenuItem starItem = menu.findItem(R.id.m_star); starItem.setEnabled(loadFinished && !owner); if (starred) { starItem.setTitle(R.string.unstar); } else {// w w w . j ava 2s. c om starItem.setTitle(R.string.star); } } else { menu.removeItem(R.id.m_star); } }
From source file:com.github.pockethub.ui.gist.GistFragment.java
@Override public void onPrepareOptionsMenu(Menu menu) { boolean owner = isOwner(); if (!owner) { menu.removeItem(R.id.m_delete); MenuItem starItem = menu.findItem(R.id.m_star); starItem.setEnabled(loadFinished && !owner); if (starred) starItem.setTitle(R.string.unstar); else/*from w ww. j a v a 2 s . co m*/ starItem.setTitle(R.string.star); } else menu.removeItem(R.id.m_star); }
From source file:com.ninetwozero.battlelog.ProfileActivity.java
@Override public boolean onPrepareOptionsMenu(Menu menu) { // Our own profile, no need to show the "extra" buttons if (profileData.getId() == SessionKeeper.getProfileData().getId()) { menu.removeItem(R.id.option_friendadd); menu.removeItem(R.id.option_frienddel); menu.removeItem(R.id.option_compare); menu.removeItem(R.id.option_unlocks); } else {//from ww w . j ava2 s . c o m // Which tab is operating? if (viewPager.getCurrentItem() == 0) { return super.onPrepareOptionsMenu(fragmentOverview.prepareOptionsMenu(menu)); } else if (viewPager.getCurrentItem() == 1) { return super.onPrepareOptionsMenu(fragmentStats.prepareOptionsMenu(menu)); } else if (viewPager.getCurrentItem() == 2) { ((MenuItem) menu.findItem(R.id.option_friendadd)).setVisible(false); ((MenuItem) menu.findItem(R.id.option_frienddel)).setVisible(false); ((MenuItem) menu.findItem(R.id.option_compare)).setVisible(false); ((MenuItem) menu.findItem(R.id.option_unlocks)).setVisible(false); } else { menu.removeItem(R.id.option_friendadd); menu.removeItem(R.id.option_frienddel); menu.removeItem(R.id.option_compare); menu.removeItem(R.id.option_unlocks); } } return super.onPrepareOptionsMenu(menu); }
From source file:com.deliciousdroid.fragment.ViewBookmarkFragment.java
@Override public void onPrepareOptionsMenu(Menu menu) { if (bookmark != null) { if (!isMyself()) { menu.removeItem(R.id.menu_view_editbookmark); menu.removeItem(R.id.menu_view_deletebookmark); } else {/* w w w .jav a2 s. c o m*/ menu.removeItem(R.id.menu_addbookmark); } } else { menu.removeItem(R.id.menu_view); menu.removeItem(R.id.menu_view_sendbookmark); menu.removeItem(R.id.menu_view_editbookmark); menu.removeItem(R.id.menu_view_deletebookmark); } }
From source file:eg.edu.alexu.alexandriauniversity.activity.ViewItemActivity.java
@Override public boolean onPrepareOptionsMenu(Menu menu) { super.onPrepareOptionsMenu(menu); getMenuInflater().inflate(R.menu.view_item_menu, menu); MenuUtils.setShowAsActionAll(menu);/* ww w . ja v a 2s. c om*/ if (newerItemId < 0) { menu.removeItem(R.id.newer_item); } if (olderItemId < 0) { menu.removeItem(R.id.older_item); } // 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) menuItem.getActionProvider(); // If onLoadFinished happens before this, we can go ahead and set the share intent now. if (mAlexU != null) { if (mShareActionProvider != null) { mShareActionProvider.setShareIntent(createShareIntent()); } } return true; }
From source file:org.cirrus.mobi.pegel.PegelFragmentsActivity.java
@Override public boolean onCreateOptionsMenu(Menu menu) { MenuInflater inflater = getMenuInflater(); inflater.inflate(R.menu.detailmenu, menu); Fragment f = getFragmentManager().findFragmentById(R.id.details); //check if the pegel-details are shown, only then show the refresh action if ((!(f instanceof DetailDataFragment)) || f.isRemoving()) menu.removeItem(R.id.m_refresh); return true;/* w w w .j a v a2s . c om*/ }
From source file:com.pseudosudostudios.jdd.activities.GameActivity.java
@Override public boolean onCreateOptionsMenu(Menu menu) { getMenuInflater().inflate(R.menu.menu_game_activity, menu); if (!isUserDebuggable()) menu.removeItem(R.id.action_win); return true;//from ww w.java 2s . c o m }
From source file:com.gh4a.activities.DiffViewerActivity.java
@Override public boolean onCreateOptionsMenu(Menu menu) { MenuInflater inflater = getMenuInflater(); inflater.inflate(R.menu.download_menu, menu); menu.removeItem(R.id.download); String viewAtTitle = getString(R.string.object_view_file_at, mSha.substring(0, 7)); MenuItem item = menu.add(0, MENU_ITEM_VIEW, Menu.NONE, viewAtTitle); MenuItemCompat.setShowAsAction(item, MenuItemCompat.SHOW_AS_ACTION_NEVER); return super.onCreateOptionsMenu(menu); }