List of usage examples for android.view Menu setGroupVisible
public void setGroupVisible(int group, boolean visible);
From source file:github.daneren2005.dsub.activity.SubsonicActivity.java
@Override public boolean onCreateOptionsMenu(Menu menu) { MenuInflater menuInflater = getMenuInflater(); SubsonicFragment currentFragment = getCurrentFragment(); if (drawerOpen) { menuInflater.inflate(R.menu.drawer_menu, menu); } else if (currentFragment != null) { try {/* www.java 2 s. co m*/ SubsonicFragment fragment = getCurrentFragment(); fragment.setContext(this); fragment.onCreateOptionsMenu(menu, menuInflater); if (isTouchscreen()) { menu.setGroupVisible(R.id.not_touchscreen, false); } } catch (Exception e) { Log.w(TAG, "Error on creating options menu", e); } } return true; }
From source file:org.wheelmap.android.fragment.POIDetailFragment.java
@Override public void onCreateOptionsMenu(Menu menu, MenuInflater inflater) { //don't add options in tablet-mode if (!getArguments().containsKey(Extra.SHOW_MAP)) { return;/*from w w w . j ava 2s . c om*/ } Log.d(TAG, "onCreateOptionsMenu"); inflater.inflate(R.menu.ab_detail_fragment, menu); createShareActionProvider(menu); currentMenu = menu; menu.setGroupVisible(R.id.menugroup_detailview, mShowMenu); }
From source file:github.popeen.dsub.activity.SubsonicActivity.java
@Override public boolean onCreateOptionsMenu(Menu menu) { MenuInflater menuInflater = getMenuInflater(); SubsonicFragment currentFragment = getCurrentFragment(); if (currentFragment != null) { try {//from www . j ava 2s. c o m SubsonicFragment fragment = getCurrentFragment(); fragment.setContext(this); fragment.onCreateOptionsMenu(menu, menuInflater); if (isTouchscreen()) { menu.setGroupVisible(R.id.not_touchscreen, false); } } catch (Exception e) { Log.w(TAG, "Error on creating options menu", e); } } return true; }
From source file:net.tjado.passwdsafe.PasswdSafeOpenFileFragment.java
@Override public void onCreateOptionsMenu(Menu menu, MenuInflater inflater) { itsMenu = menu;//from w w w . j ava2 s. c o m if ((itsListener != null) && itsListener.isNavDrawerClosed()) { inflater.inflate(R.menu.fragment_passwdsafe_open_file, menu); switch (itsYubiState) { case ENABLED: setYubikeyState(true, itsYubiSlot); PasswdSafeUtil.dbginfo(TAG, "YUBIKEY ENABLED"); break; case DISABLED: { setYubikeyState(false, 0); PasswdSafeUtil.dbginfo(TAG, "YUBIKEY DISABLED"); break; } case UNAVAILABLE: { setYubikeyState(false, -1); menu.setGroupVisible(R.id.menu_group_slots, false); PasswdSafeUtil.dbginfo(TAG, "YUBIKEY UNAVAILABLE"); break; } } } super.onCreateOptionsMenu(menu, inflater); }
From source file:com.hzx.luoyechat.activity.ChatActivity.java
@Override public boolean onCreateOptionsMenu(Menu menu) { getMenuInflater().inflate(R.menu.chat_menu, menu); if (chatType == CHATTYPE_GROUP) { menu.setGroupVisible(R.id.group2, false); } else {//from w w w .j a v a2 s. co m menu.setGroupVisible(R.id.group1, false); } return true; }
From source file:com.audiokernel.euphonyrmt.fragments.NowPlayingFragment.java
/** * Run during fragment initialization, this sets up the cover art popup menu and the coverArt * ImageView.// ww w . j a v a2s .c om * * @param view The view to setup the coverArt ImageView in. * @return The resulting ImageView. */ private ImageView getCoverArt(final View view) { final ImageView coverArt = (ImageView) view.findViewById(R.id.albumCover); final PopupMenu coverMenu = new PopupMenu(mActivity, coverArt); final Menu menu = coverMenu.getMenu(); coverArt.setOnClickListener(new OnClickListener() { @Override public void onClick(final View v) { scrollToNowPlaying(); } }); menu.add(Menu.NONE, POPUP_COVER_BLACKLIST, Menu.NONE, R.string.otherCover); menu.add(Menu.NONE, POPUP_COVER_SELECTIVE_CLEAN, Menu.NONE, R.string.resetCover); coverMenu.setOnMenuItemClickListener(this); coverArt.setOnLongClickListener(new View.OnLongClickListener() { @Override public boolean onLongClick(final View v) { final boolean isConsumed; if (mCurrentSong != null) { menu.setGroupVisible(Menu.NONE, new AlbumInfo(mCurrentSong).isValid()); coverMenu.show(); isConsumed = true; } else { isConsumed = false; } return isConsumed; } }); return coverArt; }
From source file:com.sabaibrowser.UI.java
public void updateMenuState(Tab tab, Menu menu) { MenuItem bm = menu.findItem(R.id.bookmarks_menu_id); if (bm != null) { bm.setVisible(!showingNavScreen()); }//ww w . ja v a 2 s. c om MenuItem abm = menu.findItem(R.id.add_bookmark_menu_id); if (abm != null) { abm.setVisible((tab != null) && !tab.isSnapshot() && !showingNavScreen()); } MenuItem info = menu.findItem(R.id.page_info_menu_id); if (info != null) { info.setVisible(false); } MenuItem newTab = menu.findItem(R.id.new_tab_menu_id); if (newTab != null) { newTab.setVisible(false); } MenuItem newIncognitoTab = menu.findItem(R.id.new_incognito_tab_menu_id); if (newIncognitoTab != null) { newIncognitoTab.setVisible(false); } MenuItem closeOthers = menu.findItem(R.id.close_other_tabs_id); if (closeOthers != null) { boolean isLastTab = true; if (tab != null) { isLastTab = (mTabControl.getTabCount() <= 1); } closeOthers.setEnabled(!isLastTab); } if (showingNavScreen()) { menu.setGroupVisible(R.id.LIVE_MENU, false); menu.setGroupVisible(R.id.SNAPSHOT_MENU, false); menu.setGroupVisible(R.id.NAV_MENU, false); menu.setGroupVisible(R.id.COMBO_MENU, true); } }
From source file:org.peterbaldwin.vlcremote.app.PlaybackActivity.java
@Override public boolean onPrepareOptionsMenu(Menu menu) { super.onPrepareOptionsMenu(menu); boolean isBrowseVisible = isCurrentTab(TAB_BROWSE); boolean isPlaylistVisible = mTabHost == null || isCurrentTab(TAB_PLAYLIST); boolean defaultVisibility = mTabHost == null || isCurrentTab(TAB_MEDIA) || isCurrentTab(TAB_NAVIGATION); boolean isAllButtonsVisible = isBottomActionbarVisible || (mButtonsVisibleListener != null && mButtonsVisibleListener.isAllButtonsVisible()); boolean isButtonGroupVisible = isCurrentTab(TAB_MEDIA) && !isAllButtonsVisible; boolean isShowsVisible = isCurrentTab(TAB_TV_SHOWS); menu.findItem(R.id.menu_preferences).setVisible(defaultVisibility); menu.findItem(R.id.menu_help).setVisible(defaultVisibility); menu.findItem(R.id.menu_clear_playlist).setVisible(isPlaylistVisible); menu.findItem(R.id.menu_refresh).setVisible(isPlaylistVisible); menu.findItem(R.id.menu_home).setVisible(isBrowseVisible); menu.findItem(R.id.menu_parent).setVisible(isBrowseVisible); menu.findItem(R.id.menu_set_home).setVisible(isBrowseVisible); menu.findItem(R.id.menu_text_size).setVisible(isBrowseVisible); menu.findItem(R.id.menu_refresh_shows).setVisible(isShowsVisible); menu.findItem(R.id.menu_go_up).setVisible(isShowsVisible); if (isButtonGroupVisible) { Buttons.setupMenu(menu, Preferences.get(this)); }//from w w w. j ava 2s .c o m menu.setGroupVisible(R.id.group_vlc_actions, isCurrentTab(TAB_MEDIA) && !isAllButtonsVisible); return true; }
From source file:com.android.app.MediaPlaybackActivity.java
@Override public boolean onPrepareOptionsMenu(Menu menu) { if (mService == null) return false; MenuItem item = menu.findItem(PARTY_SHUFFLE); if (item != null) { int shuffle = MusicUtils.getCurrentShuffleMode(); if (shuffle == MediaPlaybackService.SHUFFLE_AUTO) { item.setIcon(R.drawable.ic_menu_party_shuffle); item.setTitle(R.string.party_shuffle_off); } else {//from w w w.ja va 2 s.c o m item.setIcon(R.drawable.ic_menu_party_shuffle); item.setTitle(R.string.party_shuffle); } } item = menu.findItem(ADD_TO_PLAYLIST); if (item != null) { SubMenu sub = item.getSubMenu(); MusicUtils.makePlaylistMenu(this, sub); } KeyguardManager km = (KeyguardManager) getSystemService(Context.KEYGUARD_SERVICE); menu.setGroupVisible(1, !km.inKeyguardRestrictedInputMode()); return true; }
From source file:org.openintents.notepad.NoteEditor.java
@Override public boolean onPrepareOptionsMenu(Menu menu) { // Show "revert" menu item only if content has changed and we have a cursor (see revertNote()) // contentChanged used for revert and save menu boolean contentChanged = !mOriginalContent.equals(mText.getText().toString()); boolean isNoteUnencrypted = isNoteUnencrypted(); // Show comands on the URI only if the note is not encrypted menu.setGroupVisible(Menu.CATEGORY_ALTERNATIVE, isNoteUnencrypted); if (mState == STATE_EDIT_NOTE_FROM_SDCARD) { // Menus for editing from SD card menu.setGroupVisible(0, false);/*w w w.j a va 2s.co m*/ menu.setGroupVisible(1, false); menu.setGroupVisible(2, true); menu.findItem(MENU_SAVE).setEnabled(contentChanged); } else if (mState == STATE_EDIT_EXTERNAL_NOTE) { // Menus for external notes, e.g. from OI Shopping List. // In this case, don't show encryption/decryption. menu.setGroupVisible(0, contentChanged || mUndoRevert != null); menu.setGroupVisible(1, true); menu.setGroupVisible(2, false); menu.findItem(MENU_ENCRYPT).setVisible(false); menu.findItem(MENU_UNENCRYPT).setVisible(false); } else { // Menus for internal notes menu.setGroupVisible(0, contentChanged || mUndoRevert != null); menu.setGroupVisible(1, true); menu.setGroupVisible(2, false); menu.findItem(MENU_ENCRYPT).setVisible(isNoteUnencrypted); menu.findItem(MENU_UNENCRYPT).setVisible(!isNoteUnencrypted); } return super.onPrepareOptionsMenu(menu); }