Example usage for android.view Menu setGroupEnabled

List of usage examples for android.view Menu setGroupEnabled

Introduction

In this page you can find the example usage for android.view Menu setGroupEnabled.

Prototype

public void setGroupEnabled(int group, boolean enabled);

Source Link

Document

Enable or disable all menu items that are in the given group.

Usage

From source file:com.offsec.nethunter.AppNavHomeActivity.java

public static void setDrawerOptions() {
    Menu menuNav = navigationView.getMenu();
    if (prefs.getBoolean(CHROOT_INSTALLED_TAG, false)) {
        menuNav.setGroupEnabled(R.id.chrootDependentGroup, true);
    } else {/*  w  ww.j  ava  2 s .  c  o  m*/
        menuNav.setGroupEnabled(R.id.chrootDependentGroup, false);
    }
}

From source file:li.barter.activities.AbstractDrawerActivity.java

private void setOptionsGroupHidden(final Menu menu, final boolean drawerOpen) {

    menu.setGroupEnabled(R.id.group_hide_on_drawer_open, !drawerOpen);
    menu.setGroupVisible(R.id.group_hide_on_drawer_open, !drawerOpen);
}

From source file:org.getlantern.firetweet.activity.support.ComposeActivity.java

private void setMenu() {
    if (mMenuBar == null)
        return;//from ww  w.j a  va 2s.c  o m
    final Menu menu = mMenuBar.getMenu();
    final boolean hasMedia = hasMedia(), hasInReplyTo = mInReplyToStatus != null;

    /*
     * No media & Not reply: [Take photo][Add image][Attach location][Drafts]
     * Has media & Not reply: [Take photo][Media menu][Attach location][Drafts]
     * Is reply: [Media menu][View status][Attach location][Drafts]
     */
    Utils.setMenuItemAvailability(menu, MENU_TAKE_PHOTO, !hasInReplyTo);
    Utils.setMenuItemAvailability(menu, R.id.take_photo_sub_item, hasInReplyTo);
    Utils.setMenuItemAvailability(menu, MENU_ADD_IMAGE, !hasMedia && !hasInReplyTo);
    Utils.setMenuItemAvailability(menu, MENU_VIEW, hasInReplyTo);
    Utils.setMenuItemAvailability(menu, R.id.media_menu, hasMedia || hasInReplyTo);
    Utils.setMenuItemAvailability(menu, MENU_TOGGLE_SENSITIVE, hasMedia);
    Utils.setMenuItemAvailability(menu, MENU_EDIT_MEDIA, hasMedia);

    menu.setGroupEnabled(MENU_GROUP_IMAGE_EXTENSION, hasMedia);
    menu.setGroupVisible(MENU_GROUP_IMAGE_EXTENSION, hasMedia);
    final MenuItem itemToggleSensitive = menu.findItem(MENU_TOGGLE_SENSITIVE);
    if (itemToggleSensitive != null) {
        itemToggleSensitive.setChecked(hasMedia && mIsPossiblySensitive);
    }
    ThemeUtils.resetCheatSheet(mMenuBar);
    //        mMenuBar.show();
}

From source file:org.mariotaku.twidere.activity.support.ComposeActivity.java

private void setMenu() {
    if (mMenuBar == null)
        return;/*from   w  w  w  . j  av  a  2  s.c om*/
    final Menu menu = mMenuBar.getMenu();
    final boolean hasMedia = hasMedia(), hasInReplyTo = mInReplyToStatus != null;

    /*
     * No media & Not reply: [Take photo][Add image][Attach location][Drafts]
     * Has media & Not reply: [Take photo][Media menu][Attach location][Drafts]
     * Is reply: [Media menu][View status][Attach location][Drafts]
     */
    MenuUtils.setMenuItemAvailability(menu, MENU_TAKE_PHOTO, !hasInReplyTo);
    MenuUtils.setMenuItemAvailability(menu, R.id.take_photo_sub_item, hasInReplyTo);
    MenuUtils.setMenuItemAvailability(menu, MENU_ADD_IMAGE, !hasMedia && !hasInReplyTo);
    MenuUtils.setMenuItemAvailability(menu, MENU_VIEW, hasInReplyTo);
    MenuUtils.setMenuItemAvailability(menu, R.id.media_menu, hasMedia || hasInReplyTo);
    MenuUtils.setMenuItemAvailability(menu, MENU_TOGGLE_SENSITIVE, hasMedia);
    MenuUtils.setMenuItemAvailability(menu, MENU_EDIT_MEDIA, hasMedia);
    MenuUtils.setMenuItemAvailability(menu, R.id.link_to_quoted_status, isQuote());

    menu.setGroupEnabled(MENU_GROUP_IMAGE_EXTENSION, hasMedia);
    menu.setGroupVisible(MENU_GROUP_IMAGE_EXTENSION, hasMedia);
    MenuUtils.setMenuItemChecked(menu, MENU_TOGGLE_SENSITIVE, hasMedia && mIsPossiblySensitive);
    MenuUtils.setMenuItemChecked(menu, R.id.link_to_quoted_status,
            mPreferences.getBoolean(KEY_LINK_TO_QUOTED_TWEET));
    ThemeUtils.resetCheatSheet(mMenuBar);
    //        mMenuBar.show();
}