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.jboss.aerogear.crypto.android.demo.CryptoActivity.java

@Override
public boolean onPrepareOptionsMenu(Menu menu) {
    menu.setGroupVisible(R.id.group_add, Display.LIST.equals(currentFragment));
    return super.onPrepareOptionsMenu(menu);
}

From source file:com.hackerati.android.starter_app.ViewPagerActivity.java

@Override
public boolean onPrepareOptionsMenu(final Menu menu) {
    // Do not show the "sign in" menu item if we're already signed in
    final boolean signInGroupVisible = !signInManager.isSignedIn();
    menu.setGroupVisible(R.id.sign_in_group, signInGroupVisible);
    return super.onPrepareOptionsMenu(menu);
}

From source file:org.videolan.vlc.gui.audio.AudioAlbumFragment.java

private void setContextMenuItems(Menu menu, View v, int position) {
    menu.setGroupVisible(R.id.songs_view_only, false);
    menu.findItem(R.id.audio_list_browser_delete).setVisible(false);
    if (!AndroidDevices.isPhone())
        menu.setGroupVisible(R.id.phone_only, true);
}

From source file:com.kytse.aria2remote.MainActivity.java

private void loginStateDidChanged() {

    SharedPreferences settings = getSharedPreferences(getString(R.string.login_credentials), 0);
    String url = settings.getString(getString(R.string.KEY_URL), null);
    String secret = settings.getString(getString(R.string.KEY_SECRET), null);

    Menu navMenu = mNavigationView.getMenu();
    navMenu.setGroupVisible(R.id.group_list, url != null);
    navMenu.findItem(R.id.nav_login).setVisible(url == null);
    navMenu.findItem(R.id.nav_logout).setVisible(url != null);

    if (url == null) {
        onNavigationItemSelected(mNavigationView.getMenu().findItem(R.id.nav_login));
    } else {/*from w  ww .  ja v  a  2 s  .  c o  m*/
        View headerView = mNavigationView.getHeaderView(0);
        TextView textViewUrl = (TextView) headerView.findViewById(R.id.textView_url);
        textViewUrl.setText(url);

        Bundle sharedBundle = new Bundle();
        sharedBundle.putString(getString(R.string.KEY_URL), url);
        sharedBundle.putString(getString(R.string.KEY_SECRET), secret);

        Bundle activateBundle = new Bundle(sharedBundle);
        activateBundle.putInt(getString(R.string.KEY_LIST_TYPE_INDEX), Aria2.ListType.ACTIVE.ordinal());
        mActiveFragment.setArguments(activateBundle);

        Bundle waitingBundle = new Bundle(sharedBundle);
        waitingBundle.putInt(getString(R.string.KEY_LIST_TYPE_INDEX), Aria2.ListType.WAITING.ordinal());
        mWaitingFragment.setArguments(waitingBundle);

        Bundle stoppedBundle = new Bundle(sharedBundle);
        stoppedBundle.putInt(getString(R.string.KEY_LIST_TYPE_INDEX), Aria2.ListType.STOPPED.ordinal());
        mStoppedFragment.setArguments(stoppedBundle);

        onNavigationItemSelected(mNavigationView.getMenu().findItem(R.id.nav_active));
    }
}

From source file:net.wespot.pim.view.InqQuestionFragment.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, false);
    menu.setGroupVisible(R.id.actions_data_collection, false);
    menu.setGroupVisible(R.id.actions_questions, true);
    menu.setGroupVisible(R.id.actions_friends, false);
    menu.setGroupVisible(R.id.actions_usersite, false);

    super.onCreateOptionsMenu(menu, inflater);
}

From source file:com.marcosedo.lagramola.HelpFragment.java

@Override
public void onCreateOptionsMenu(Menu menu, MenuInflater inflater) {
    super.onCreateOptionsMenu(menu, inflater);
    if (menu != null) {//Escondemos el aadir evento
        menu.setGroupVisible(R.id.tab_listaeventos_admin_group, false);
        menu.setGroupVisible(R.id.base_group, false);
    }//from   ww  w.j av  a2s  .  c o  m
}

From source file:com.btmura.android.reddit.app.BrowserActivity.java

@Override
public boolean onPrepareOptionsMenu(Menu menu) {
    super.onPrepareOptionsMenu(menu);
    menu.setGroupVisible(R.id.menu_group_last, requestedSubreddit == null && !hasThing());
    return true;/*from ww w  .  j ava  2  s .  c o m*/
}

From source file:com.btmura.android.reddit.app.UserProfileActivity.java

@Override
public boolean onPrepareOptionsMenu(Menu menu) {
    super.onPrepareOptionsMenu(menu);
    boolean showThingless = isSinglePane || !hasThing();
    menu.setGroupVisible(R.id.thingless, showThingless);
    return true;//from   www . j  a  va 2  s. c o m
}

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:net.wespot.pim.view.InqDataCollectionFragment.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, false);
    menu.setGroupVisible(R.id.actions_data_collection, true);
    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);
}