Example usage for android.view Menu setGroupVisible

List of usage examples for android.view Menu setGroupVisible

Introduction

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

Prototype

public void setGroupVisible(int group, boolean visible);

Source Link

Document

Show or hide all menu items that are in the given group.

Usage

From source file:org.videolan.vlc2.gui.audio.AudioBrowserFragment.java

private void setContextMenuItems(Menu menu, View v) {
    final int pos = mFlingViewGroup.getPosition();
    if (pos != MODE_SONG) {
        menu.setGroupVisible(R.id.songs_view_only, false);
        menu.setGroupVisible(R.id.phone_only, false);
    }//from   w  ww  . j  a v  a 2 s . co m
    if (pos == MODE_ARTIST || v.getId() == MODE_GENRE) {
        MenuItem play = menu.findItem(R.id.audio_list_browser_play);
        play.setVisible(true);
    }
    if (!AndroidDevices.isPhone())
        menu.setGroupVisible(R.id.phone_only, false);
}

From source file:org.spinsuite.bchat.view.V_BChat.java

@Override
public boolean onPrepareOptionsMenu(Menu menu) {
    if (isDrawerLoaded) {
        boolean drawerOpen = m_DLayout.isDrawerOpen(m_DList);
        if (drawerOpen)
            menu.setGroupVisible(R.id.group_tab_menu, false);
    }/*from w ww . ja  v a2s  . c  o  m*/
    return super.onPrepareOptionsMenu(menu);
}

From source file:org.akop.crosswords.fragment.SelectorFragment.java

@Override
public void onPrepareOptionsMenu(Menu menu) {
    super.onPrepareOptionsMenu(menu);

    menu.setGroupVisible(R.id.menu_group_emptyable,
            mFolderId == Storage.FOLDER_TRASH && mAdapter.getCount() > 0);
}

From source file:net.wespot.pim.view.InqCreateInquiryFragment.java

@Override
public void onCreateOptionsMenu(Menu menu, MenuInflater inflater) {
    inflater.inflate(R.menu.menu_inquiry, menu);

    menu.setGroupVisible(R.id.actions_general, false);
    menu.setGroupVisible(R.id.actions_wonder_moment, true);
    menu.setGroupVisible(R.id.actions_data_collection, false);
    menu.setGroupVisible(R.id.actions_friends, false);
    menu.setGroupVisible(R.id.actions_usersite, false);
    menu.setGroupVisible(R.id.actions_questions, false);
    super.onCreateOptionsMenu(menu, inflater);
}

From source file:com.tencent.wstt.gt.activity.GTAUTFragment.java

@Override
public void onCreateOptionsMenu(Menu menu, MenuInflater inflater) {
    menu.setGroupVisible(0, true); // ???
}

From source file:com.inovex.zabbixmobile.activities.BaseActivity.java

private void toggleServerSelectionMode() {
    Menu menu = mNavigationView.getMenu();
    if (mServerSelectMode) {
        // show normal menu
        menu.setGroupVisible(R.id.grp1, true);
        menu.setGroupVisible(R.id.grp2, true);
        menu.removeGroup(R.id.grp0_server);
        mServerSelectButton.setImageDrawable(getResources().getDrawable(R.drawable.spinner_triangle));

    } else {/*from w  ww .  jav  a 2  s  . c o  m*/
        // show server selection list
        menu.setGroupVisible(R.id.grp1, false);
        menu.setGroupVisible(R.id.grp2, false);
        for (int i = 0; i < mServersListAdapter.getCount(); i++) {
            ZabbixServer server = mServersListAdapter.getItem(i);
            menu.add(R.id.grp0_server, (int) server.getId(), Menu.NONE, server.getName())
                    .setIcon(R.drawable.ic_monitor_grey600_24dp);
        }
        mServerSelectButton.setImageDrawable(getResources().getDrawable(R.drawable.spinner_triangle_flipped));
    }
    mServerSelectMode = !mServerSelectMode;
}

From source file:com.android.purenexussettings.TinkerActivity.java

@Override
public boolean onPrepareOptionsMenu(Menu menu) {
    // if nav drawer is opened/opening, hide the action items
    // add in bits to enable/disable menu items that are fragment specific
    if (openingHalf) {
        menu.setGroupVisible(R.id.action_items, true);
        boolean isbuildprop = (mItemPosition == 1);
        boolean iseditprop = (mItemPosition == 2);
        boolean isapppicker = (mItemPosition == 3);
        boolean isfiswitch = (mItemPosition == 4);
        menu.findItem(R.id.action_backup).setVisible(isbuildprop);
        menu.findItem(R.id.action_restore).setVisible(isbuildprop);
        menu.findItem(R.id.action_search).setVisible(isbuildprop);
        menu.findItem(R.id.action_discard).setVisible(iseditprop);
        menu.findItem(R.id.action_delete).setVisible(iseditprop);
        menu.findItem(R.id.action_fabhide).setVisible(isfiswitch);
        menu.findItem(R.id.action_launchhide)
                .setVisible(!(isbuildprop || iseditprop || isapppicker || isfiswitch));
        menu.findItem(R.id.action_about).setVisible(!(isbuildprop || iseditprop || isapppicker || isfiswitch));
    } else {//  w w w  . j  ava2 s .com
        menu.setGroupVisible(R.id.action_items, false);
    }
    return super.onPrepareOptionsMenu(menu);
}

From source file:cn.studyjams.s2.sj0132.bowenyan.mygirlfriend.nononsenseapps.notepad.ui.list.TaskListFragment.java

@Override
public void onPrepareOptionsMenu(Menu menu) {
    if (getActivity() instanceof MenuStateController) {
        final boolean visible = ((MenuStateController) getActivity()).childItemsVisible();

        menu.setGroupVisible(R.id.list_menu_group, visible);
        if (!visible) {
            if (mMode != null) {
                mMode.finish();//  ww  w .  ja va 2s .c o m
            }
        }
    }
}

From source file:com.janela.mobile.ui.user.HomeActivity.java

@Override
public void onLoadFinished(Loader<List<User>> listLoader, List<User> orgs) {
    this.orgs = orgs;

    int sharedPreferencesOrgId = sharedPreferences.getInt(PREF_ORG_ID, -1);
    int targetOrgId = org == null ? sharedPreferencesOrgId : org.getId();

    Menu menu = navigationView.getMenu();
    menu.removeGroup(R.id.user_select);//from   ww w.ja va2 s  . c o  m
    for (int i = 0; i < orgs.size(); ++i) {
        final MenuItem item = menu.add(R.id.user_select, i, Menu.NONE, orgs.get(i).getLogin());
        avatars.bind(item, orgs.get(i));
        if (orgs.get(i).getId() == targetOrgId) {
            setOrg(orgs.get(i));
        }
    }

    // If the target org is invalid (e.g. first login), select the first one
    if (targetOrgId == -1 && orgs.size() > 0) {
        setOrg(orgs.get(0));
    }

    menu.setGroupVisible(R.id.user_select, false);
}

From source file:org.akop.crosswords.fragment.CrosswordFragment.java

@Override
public void onPrepareOptionsMenu(Menu menu) {
    super.onPrepareOptionsMenu(menu);

    boolean showRevealErrors = false;
    boolean showConcealErrors = false;

    if (mCrosswordView != null) {
        showConcealErrors = mCrosswordView.getErrorHighlightingEnabled();
        showRevealErrors = !showConcealErrors;
    }/*from  ww  w  .j  a va2  s . c o  m*/

    menu.setGroupVisible(R.id.menu_group_reveal_errors, showRevealErrors);
    menu.setGroupVisible(R.id.menu_group_conceal_errors, showConcealErrors);
}