List of usage examples for android.view MenuItem setVisible
public MenuItem setVisible(boolean visible);
From source file:com.jefftharris.passwdsafe.PasswdSafePolicyListFragment.java
@Override public void onPrepareOptionsMenu(Menu menu) { super.onPrepareOptionsMenu(menu); MenuItem item = menu.findItem(R.id.menu_add_policy); if (item != null) { item.setVisible(!itsIsFileReadonly); }//from w w w . jav a 2 s . c om }
From source file:com.synox.android.ui.preview.PreviewImageFragment.java
/** * {@inheritDoc}//from w ww .j a v a 2 s . c o m */ @Override public void onPrepareOptionsMenu(Menu menu) { super.onPrepareOptionsMenu(menu); if (mContainerActivity != null && mContainerActivity.getStorageManager() != null) { // Update the file setFile(mContainerActivity.getStorageManager().getFileById(getFile().getFileId())); FileMenuFilter mf = new FileMenuFilter(getFile(), mContainerActivity.getStorageManager().getAccount(), mContainerActivity, getActivity()); mf.filter(menu); } // additional restriction for this fragment // TODO allow renaming in PreviewImageFragment MenuItem item = menu.findItem(R.id.action_rename_file); if (item != null) { item.setVisible(false); item.setEnabled(false); } // additional restriction for this fragment // TODO allow refresh file in PreviewImageFragment item = menu.findItem(R.id.action_sync_file); if (item != null) { if (getFile().isDown()) { item.setVisible(false); item.setEnabled(false); } else { item.setVisible(true); item.setEnabled(true); } } // additional restriction for this fragment // TODO allow refresh file in PreviewImageFragment item = menu.findItem(R.id.action_download_file); if (item != null) { item.setVisible(false); item.setEnabled(false); } // additional restriction for this fragment // TODO allow refresh file in PreviewImageFragment item = menu.findItem(R.id.action_send_file); if (item != null && !getFile().isDown()) { item.setVisible(false); item.setEnabled(false); } // additional restriction for this fragment item = menu.findItem(R.id.action_move); if (item != null) { item.setVisible(false); item.setEnabled(false); } // additional restriction for this fragment item = menu.findItem(R.id.action_copy); if (item != null) { item.setVisible(false); item.setEnabled(false); } }
From source file:com.murati.oszk.audiobook.ui.FullScreenPlayerActivity.java
@Override public boolean onCreateOptionsMenu(Menu menu) { super.onCreateOptionsMenu(menu); // Disable all menu by default List<Integer> menuItems = new ArrayList<Integer>( Arrays.asList(R.id.search, R.id.option_favorite, R.id.option_download, R.id.option_delete)); for (Integer menuItemRef : menuItems) { MenuItem menuItem = menu.findItem(menuItemRef); menuItem.setVisible(false); }// w w w . j a v a 2 s. c o m return true; }
From source file:com.slx.funstream.ui.streams.StreamActivity.java
@Override public boolean onCreateOptionsMenu(Menu menu) { getMenuInflater().inflate(R.menu.menu_stream, menu); MenuItem logInItem = menu.findItem(R.id.menu_log_in); MenuItem userAccItem = menu.findItem(R.id.menu_user_account); // Hide login button if user is not logged in if (user == null || isEmpty(user.getToken())) { logInItem.setVisible(true); userAccItem.setVisible(false);/* ww w. j ava2s .c o m*/ } else { logInItem.setVisible(false); userAccItem.setVisible(true); } return true; }
From source file:br.liveo.ndrawer.ui.fragment.MainFragment.java
@Override public void onCreateOptionsMenu(Menu menu, MenuInflater inflater) { // TODO Auto-generated method stub super.onCreateOptionsMenu(menu, inflater); inflater.inflate(R.menu.menu, menu); //Select search item final MenuItem menuItem = menu.findItem(R.id.menu_search); menuItem.setVisible(true); SearchView searchView = (SearchView) menuItem.getActionView(); searchView.setQueryHint(this.getString(R.string.search)); ((EditText) searchView.findViewById(R.id.search_src_text)) .setHintTextColor(getResources().getColor(R.color.nliveo_white)); searchView.setOnQueryTextListener(onQuerySearchView); //menu.findItem(R.id.menu_add).setVisible(true); mSearchCheck = false;/*from ww w.j av a 2 s.c om*/ }
From source file:org.docrj.smartcard.reader.BatchSelectActivity.java
@Override public boolean onPrepareOptionsMenu(Menu menu) { boolean drawerOpen = mNavDrawer.isOpen(); MenuItem item = menu.findItem(R.id.menu_group_details); item.setVisible(!drawerOpen); item = menu.findItem(R.id.menu_add_group); item.setVisible(!drawerOpen);/*from w ww . j av a 2s . c om*/ item = menu.findItem(R.id.menu_share_msgs); item.setVisible(!drawerOpen); item = menu.findItem(R.id.menu_clear_msgs); item.setVisible(!drawerOpen); return true; }
From source file:com.glanznig.beepme.view.ViewSampleActivity.java
@Override public boolean onPrepareOptionsMenu(Menu menu) { MenuItem edit = menu.findItem(R.id.action_edit_sample); Sample s = new SampleTable(this.getApplicationContext()) .getSampleWithTags(pagerAdapter.getSampleId(pager.getCurrentItem())); //not editable if more than a day old if ((Calendar.getInstance().getTimeInMillis() - s.getTimestamp().getTime()) >= 24 * 60 * 60 * 1000) { edit.setVisible(false); } else {/* w ww .ja v a2s . com*/ edit.setVisible(true); } return super.onPrepareOptionsMenu(menu); }
From source file:org.catrobat.catroid.cast.CastManager.java
public synchronized void setCastButton(MenuItem castButton) { this.castButton = castButton; castButton.setVisible( mediaRouter.isRouteAvailable(mediaRouteSelector, MediaRouter.AVAILABILITY_FLAG_REQUIRE_MATCH)); setIsConnected(isConnected);/*from w w w.ja v a2 s . co m*/ }
From source file:com.fastaccess.ui.modules.repos.RepoPagerView.java
@Override public boolean onPrepareOptionsMenu(Menu menu) { Repo repoModel = getPresenter().getRepo(); if (repoModel != null && repoModel.isFork() && repoModel.getParent() != null) { MenuItem menuItem = menu.findItem(R.id.originalRepo); menuItem.setVisible(true); menuItem.setTitle(repoModel.getParent().getFullName()); }/* w ww .ja va 2 s .co m*/ // menu.findItem(R.id.deleteRepo).setVisible(getPresenter().isRepoOwner()); menu.findItem(R.id.deleteRepo).setVisible(false);//removing delete permission. return super.onPrepareOptionsMenu(menu); }
From source file:ca.zadrox.dota2esportticker.ui.MatchActivity.java
@Override public boolean onCreateOptionsMenu(Menu menu) { super.onCreateOptionsMenu(menu); getMenuInflater().inflate(R.menu.matches, menu); MenuItem notificationItem = menu.findItem(R.id.menu_debug_notify); if (notificationItem != null) { notificationItem.setVisible(BuildConfig.DEBUG); }/*from www.j ava 2 s . c om*/ MenuItem matchMenuItem = menu.findItem(R.id.menu_debug_view_live_match); if (matchMenuItem != null) { matchMenuItem.setVisible(BuildConfig.DEBUG); } return true; }