List of usage examples for android.view Menu setGroupVisible
public void setGroupVisible(int group, boolean visible);
From source file:uk.org.downiesoft.slideshow.GridViewFragment.java
/** * {@inheritDoc}/*from w ww . ja v a 2 s. com*/ */ @Override public void onPrepareOptionsMenu(Menu menu) { super.onPrepareOptionsMenu(menu); if (!mShowingFavourites) { menu.setGroupVisible(R.id.menu_group_not_favourites, true); menu.setGroupVisible(R.id.menu_group_favourites, false); } else { menu.setGroupVisible(R.id.menu_group_not_favourites, false); menu.setGroupVisible(R.id.menu_group_favourites, true); } }
From source file:org.spinsuite.view.V_Process.java
@Override public boolean onPrepareOptionsMenu(Menu menu) { if (isDrawerLoaded) { boolean drawerOpen = m_DLayout.isDrawerOpen(m_DList); if (drawerOpen) menu.setGroupVisible(R.id.group_process, false); else {/* www . jav a2 s .c om*/ if (isLoaded) { // Show Search Menu if ((logAdapter != null && !m_pInfo.isReport()) || (reportAdapter != null && m_pInfo.isReport())) iSearch.setVisible(true); if (m_pInfo.isReport()) { iPrintFormat.setVisible(true); } } // Visible Process iProcess.setVisible(true); } } return super.onPrepareOptionsMenu(menu); }
From source file:com.google.code.twisty.Twisty.java
@Override public boolean onPrepareOptionsMenu(Menu menu) { menu.setGroupVisible(MENUGROUP_SELECT, !terpIsRunning()); menu.setGroupVisible(MENUGROUP_RUNNING, terpIsRunning()); return super.onPrepareOptionsMenu(menu); }
From source file:com.androzic.waypoint.WaypointList.java
@Override public void onPrepareOptionsMenu(final Menu menu) { Androzic application = Androzic.getApplication(); MenuItem sortItem = menu.findItem(mSortMode == 0 ? R.id.action_sort_alpha : R.id.action_sort_size); sortItem.setChecked(true);//w w w. ja v a2s.co m Editor editor = PreferenceManager.getDefaultSharedPreferences(application).edit(); editor.putInt(getString(R.string.wpt_sort), mSortMode); editor.commit(); List<WaypointSet> sets = application.getWaypointSets(); if (sets.size() > 1) { menu.setGroupVisible(R.id.group_sets, true); menu.removeGroup(R.id.group_sets); for (int i = 1; i < sets.size(); i++) menu.add(R.id.group_sets, i, Menu.NONE, sets.get(i).name).setChecked(true); menu.setGroupCheckable(R.id.group_sets, true, false); } }
From source file:com.ruesga.rview.MainActivity.java
private void performUpdateNavigationDrawer(boolean show) { final boolean auth = mAccount != null && mAccount.hasAuthenticatedAccessMode(); final boolean supportNotifications = mAccount != null && mAccount.hasNotificationsSupport() && Preferences.isAccountNotificationsEnabled(this, mAccount); final Menu menu = mBinding.drawerNavigationView.getMenu(); menu.setGroupVisible(R.id.category_all, !show); menu.setGroupVisible(R.id.category_my_menu, !show && auth); menu.setGroupVisible(R.id.category_my_filters, !show && mCustomFilters != null && !mCustomFilters.isEmpty()); menu.setGroupVisible(R.id.category_my_account, show); menu.setGroupVisible(R.id.category_other_accounts, show); menu.setGroupVisible(R.id.category_info, show); menu.findItem(R.id.menu_account_stats).setVisible(show && auth); menu.findItem(R.id.menu_account_notifications).setVisible(show && supportNotifications); if (auth && mAccount.getServerVersion() != null) { GerritApi api = ModelHelper.getGerritApi(this, mAccount); boolean hasSupportAccountStatus = api.supportsFeature(Features.ACCOUNT_STATUS, mAccount.getServerVersion()); menu.findItem(R.id.menu_account_status).setVisible(show && hasSupportAccountStatus); updateAccountStatus();/*from w w w . java 2s . com*/ } else { menu.findItem(R.id.menu_account_status).setVisible(false); } mModel.isAccountExpanded = show; mHeaderDrawerBinding.setModel(mModel); }
From source file:org.onebusaway.android.ui.HomeActivity.java
private void setupOptionsMenu(Menu menu) { menu.setGroupVisible(R.id.main_options_menu_group, true); menu.setGroupVisible(R.id.arrival_list_menu_group, mShowArrivalsMenu); menu.setGroupVisible(R.id.starred_stop_menu_group, mShowStarredStopsMenu); }
From source file:com.github.dfa.diaspora_android.activity.MainActivity.java
protected void updateNavigationViewEntryVisibilities() { Menu navMenu = navView.getMenu(); // Initially show all items visible when logged in navMenu.setGroupVisible(navMenu.findItem(R.id.nav_exit).getGroupId(), true); // Hide by app settings navMenu.findItem(R.id.nav_exit).setVisible(appSettings.isVisibleInNavExit()); navMenu.findItem(R.id.nav_activities).setVisible(appSettings.isVisibleInNavActivities()); navMenu.findItem(R.id.nav_aspects).setVisible(appSettings.isVisibleInNavAspects()); navMenu.findItem(R.id.nav_contacts).setVisible(appSettings.isVisibleInNavContacts()); navMenu.findItem(R.id.nav_commented).setVisible(appSettings.isVisibleInNavCommented()); navMenu.findItem(R.id.nav_followed_tags).setVisible(appSettings.isVisibleInNavFollowed_tags()); navMenu.findItem(R.id.nav_about).setVisible(appSettings.isVisibleInNavHelp_license()); navMenu.findItem(R.id.nav_liked).setVisible(appSettings.isVisibleInNavLiked()); navMenu.findItem(R.id.nav_mentions).setVisible(appSettings.isVisibleInNavMentions()); navMenu.findItem(R.id.nav_profile).setVisible(appSettings.isVisibleInNavProfile()); navMenu.findItem(R.id.nav_public).setVisible(appSettings.isVisibleInNavPublic_activities()); navMenu.findItem(R.id.nav_stream).setVisible(true); navMenu.findItem(R.id.nav_reports).setVisible(appSettings.isVisibleInNavReports()); // Hide whole group (for logged in use) if no pod was selected if (!appSettings.hasPod()) { navMenu.setGroupVisible(navMenu.findItem(R.id.nav_exit).getGroupId(), false); }//from w w w. ja v a 2 s . co m }
From source file:com.nononsenseapps.notepad.ActivityMain.java
@Override public boolean onPrepareOptionsMenu(Menu menu) { menu.setGroupVisible(R.id.activity_menu_group, isDrawerClosed); menu.setGroupVisible(R.id.activity_reverse_menu_group, !isDrawerClosed); final MenuItem donateItem = menu.findItem(R.id.menu_donate); if (donateItem != null) { donateItem.setVisible(!mDonatedInApp); }//w w w . jav a2 s .co m return super.onPrepareOptionsMenu(menu); }
From source file:com.gmail.charleszq.picorner.ui.ImageDetailFragment.java
@Override public void onPrepareOptionsMenu(Menu menu) { MenuItem likeItem = menu.findItem(R.id.menu_item_like); MenuItem ownerPhotoItem = menu.findItem(R.id.menu_item_see_owner_photos); MenuItem commentItem = menu.findItem(R.id.menu_item_comment); MenuItem mapItem = menu.findItem(R.id.menu_item_view_on_map); MenuItem exifItem = menu.findItem(R.id.menu_item_view_exif); MenuItem detailItem = menu.findItem(R.id.menu_item_detail); PicornerApplication app = (PicornerApplication) getActivity().getApplication(); boolean ismyphoto = app.isMyOwnPhoto(mPhoto); ownerPhotoItem.setVisible(!ismyphoto); switch (mPhoto.getMediaSource()) { case FLICKR:/*from ww w. j av a2 s .c om*/ menu.setGroupVisible(R.id.group_my_flickr_photo, ismyphoto); likeItem.setVisible(!ismyphoto); break; case PX500: menu.setGroupVisible(R.id.group_my_flickr_photo, false); likeItem.setVisible(!ismyphoto); break; case INSTAGRAM: commentItem.setVisible(false); exifItem.setVisible(false); menu.setGroupVisible(R.id.group_my_flickr_photo, false); break; case RSS: menu.setGroupVisible(R.id.group_my_flickr_photo, false); likeItem.setVisible(false); exifItem.setVisible(false); commentItem.setVisible(false); ownerPhotoItem.setVisible(false); detailItem.setVisible(false); break; } mapItem.setVisible(mPhoto.getLocation() != null); if (mUserLikeThePhoto) { likeItem.setIcon(R.drawable.star_big_on); } else { likeItem.setIcon(R.drawable.ic_menu_star); } // 500px menu group MenuItem voteItem = menu.findItem(R.id.menu_item_vote); if (mPhoto.getMediaSource() != MediaSourceType.PX500) { voteItem.setVisible(false); } else { voteItem.setVisible(SPUtil.getPx500OauthToken(getActivity()) != null && !app.isMyOwnPhoto(mPhoto) && !mPhoto.isUserVoted()); } }
From source file:com.jefftharris.passwdsafe.PasswdSafeOpenFileFragment.java
@Override public void onCreateOptionsMenu(Menu menu, MenuInflater inflater) { if ((itsListener != null) && itsListener.isNavDrawerClosed()) { inflater.inflate(R.menu.fragment_passwdsafe_open_file, menu); switch (itsYubiState) { case ENABLED: case DISABLED: { break; }/* w w w.j ava 2 s. c om*/ case UNAVAILABLE: { menu.setGroupVisible(R.id.menu_group_slots, false); break; } } MenuItem item; switch (itsYubiSlot) { case 2: default: { item = menu.findItem(R.id.menu_slot_2); itsYubiSlot = 2; break; } case 1: { item = menu.findItem(R.id.menu_slot_1); break; } } item.setChecked(true); } super.onCreateOptionsMenu(menu, inflater); }