List of usage examples for android.view MenuItem setVisible
public MenuItem setVisible(boolean visible);
From source file:com.adkdevelopment.e_contact.ui.MainActivity.java
/** * Updated buttons in the Navigation Drawer according to a state *//*from w w w . j av a2 s. c o m*/ private void updateDrawer() { // select first item in navigation drawer on startup Menu drawerMenu = mNavigationView.getMenu(); drawerMenu.getItem(0).setChecked(true); // set correct visibility of we are logged in or logged out MenuItem facebookProfile = drawerMenu.findItem(R.id.profile_button); MenuItem login = drawerMenu.findItem(R.id.login_button); if (facebookProfile != null) { if (AccessToken.getCurrentAccessToken() != null) { login.setVisible(false); facebookProfile.setVisible(true); } else { login.setVisible(true); facebookProfile.setVisible(false); } } }
From source file:com.owncloud.android.files.FileMenuFilter.java
private void hideAll(Menu menu) { MenuItem item; for (int i = 0; i < menu.size(); i++) { item = menu.getItem(i);// w w w.j a va2s . c om item.setVisible(false); item.setEnabled(false); } }
From source file:com.android.dialer.calllog.CallLogActivity.java
@Override public boolean onPrepareOptionsMenu(Menu menu) { final MenuItem itemDeleteAll = menu.findItem(R.id.delete_all); // If onPrepareOptionsMenu is called before fragments loaded. Don't do anything. if (mAllCallsFragment != null && itemDeleteAll != null) { final CallLogAdapter adapter = mAllCallsFragment.getAdapter(); itemDeleteAll.setVisible(adapter != null && !adapter.isEmpty()); }//from w w w . ja va 2 s.com return true; }
From source file:com.btmura.android.reddit.app.CommentListController.java
private void prepareEditActionItem(Menu menu, ListView lv, int pos) { MenuItem item = menu.findItem(R.id.menu_edit); item.setVisible(isCheckedCount(lv, 1) && hasAccount() && hasThingId(pos) && isEditable(pos)); }
From source file:com.btmura.android.reddit.app.CommentListController.java
private void prepareReplyActionItem(Menu menu, ListView lv, int pos) { MenuItem item = menu.findItem(R.id.menu_reply); item.setVisible(isCheckedCount(lv, 1) && hasAccount() && hasThingId(pos) && isNotDeleted(pos)); }
From source file:com.btmura.android.reddit.app.CommentListController.java
private void prepareDeleteActionItem(Menu menu, ListView lv) { MenuItem item = menu.findItem(R.id.menu_delete); item.setVisible(hasAccount() && isAllDeletable(lv)); }
From source file:com.btmura.android.reddit.app.CommentListController.java
private void prepareCopyUrlActionItem(Menu menu, ListView lv, int pos) { MenuItem item = menu.findItem(R.id.menu_copy_url); item.setVisible(isCheckedCount(lv, 1) && hasThingId(pos)); }
From source file:com.btmura.android.reddit.app.CommentListController.java
private void prepareAuthorActionItem(Menu menu, ListView lv, int pos) { String author = getAuthor(pos); MenuItem item = menu.findItem(R.id.menu_author); item.setVisible(MenuHelper.isUserItemVisible(author) && isCheckedCount(lv, 1)); if (item.isVisible()) { item.setTitle(MenuHelper.getUserTitle(context, author)); }//from ww w . java 2 s . co m }
From source file:com.money.manager.ex.reports.CategoriesReportFragment.java
@Override public void onCreateOptionsMenu(Menu menu, MenuInflater inflater) { super.onCreateOptionsMenu(menu, inflater); // pie chart/* w ww .j a v a 2s .c om*/ MenuItem itemChart = menu.findItem(R.id.menu_chart); if (itemChart != null) { itemChart.setVisible(!(((CategoriesReportActivity) getActivity()).mIsDualPanel)); UIHelper uiHelper = new UIHelper(getActivity()); itemChart.setIcon(uiHelper.resolveAttribute(R.attr.ic_action_pie_chart)); } }
From source file:com.example.android.petsdb.EditorActivity.java
@Override public boolean onPrepareOptionsMenu(Menu menu) { super.onPrepareOptionsMenu(menu); // If this is a new pet, hide the "Delete" menu item. if (mCurrentPetUri == null) { MenuItem menuItem = menu.findItem(R.id.action_delete); menuItem.setVisible(false); }// w w w. j av a2 s .c om return true; }