Example usage for android.view Menu removeItem

List of usage examples for android.view Menu removeItem

Introduction

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

Prototype

public void removeItem(int id);

Source Link

Document

Remove the item with the given identifier.

Usage

From source file:com.dockerandroid.ui.fragment.ContainerFragment.java

@Override
public void showPopMenu(View v, Container container) {
    PopupMenu popup = new PopupMenu(getContext(), v);
    popup.getMenuInflater().inflate(R.menu.containter_operates, popup.getMenu());
    Menu menu = popup.getMenu();
    if (container.isUp()) {
        menu.removeItem(R.id.containter_remove);
        if (!container.isPaused()) {
            menu.removeItem(R.id.containter_unpause);
        } else {//from  w ww  . jav  a 2  s  . c  om
            menu.removeItem(R.id.containter_kill);
            menu.removeItem(R.id.containter_pause);
        }
    } else {
        menu.removeItem(R.id.containter_unpause);
        menu.removeItem(R.id.containter_pause);
        menu.removeItem(R.id.containter_kill);
    }
    popup.setOnMenuItemClickListener((item -> mPresenter.onPopupMenuClick(item.getItemId(), container)));
    popup.show();
}

From source file:com.prasanna.android.stacknetwork.UserProfileActivity.java

@Override
public boolean onCreateOptionsMenu(Menu menu) {
    boolean ret = super.onCreateOptionsMenu(menu);

    if (getIntent().getBooleanExtra(StringConstants.ME, false))
        menu.removeItem(R.id.menu_my_profile);

    return ret & true;
}

From source file:com.teamcanjica.settings.device.ContainerActivity.java

@Override
public boolean onPrepareOptionsMenu(Menu menu) {
    try {/*from  w w  w.  j  a  v  a2 s. co  m*/
        if (getFragmentManager().findFragmentByTag("SETTINGS_FRAGMENT").isVisible()) {
            menu.removeItem(R.id.action_settings);
        }
    } catch (NullPointerException e) {

    }
    return true;
}

From source file:org.strongswan.android.ui.activity.TrustedCertificatesActivity.java

@Override
public boolean onPrepareOptionsMenu(Menu menu) {
    if (Build.VERSION.SDK_INT < Build.VERSION_CODES.KITKAT) {
        menu.removeItem(R.id.menu_import_certificate);
    }/*from   w  ww. j a  v a2  s  . c  om*/
    return true;
}

From source file:com.alphabetbloc.accessmrs.ui.user.BaseUserActivity.java

@Override
public boolean onPrepareOptionsMenu(Menu menu) {
    menu.removeItem(MENU_ADMIN_PREFERENCES);
    SharedPreferences prefs = PreferenceManager.getDefaultSharedPreferences(getBaseContext());
    boolean showMenu = prefs.getBoolean(getString(R.string.key_show_settings_menu), false);
    if (showMenu)
        menu.add(0, MENU_ADMIN_PREFERENCES, MENU_ADMIN_PREFERENCES, getString(R.string.pref_admin_settings))
                .setIcon(android.R.drawable.ic_lock_lock);
    return super.onPrepareOptionsMenu(menu);
}

From source file:org.alfresco.mobile.android.application.fragments.actions.NodeIdActions.java

protected void hideActionIfNecessary(Menu menu, int menuItemId, int actionId) {
    if (!ConfigurableActionHelper.isVisible(getActivity(), getAccount(), actionId)) {
        menu.removeItem(menuItemId);
    }//from  w ww  . j av a 2  s. c  om
}

From source file:com.ntsync.android.sync.activities.AbstractFragmentActivity.java

@Override
public boolean onCreateOptionsMenu(Menu menu) {
    super.onCreateOptionsMenu(menu);
    MenuInflater inflater = getMenuInflater();
    inflater.inflate(R.menu.default_menu, menu);
    if (removeMenuId != -1) {
        menu.removeItem(removeMenuId);
    }//  www  .  j  av  a 2s  . c  om

    return true;
}

From source file:com.hacktx.android.fragments.GoogleMapFragment.java

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

    if (!mConfigManager.getValue(ConfigParam.REMOTE_MAP)) {
        menu.removeItem(R.id.remote_map);
    }//w  ww  .ja  v a  2  s . c om
}

From source file:org.akvo.flow.ui.fragment.SurveyListFragment.java

@Override
public void onCreateOptionsMenu(Menu menu, MenuInflater inflater) {
    // Add this fragment's options to the 'more' submenu
    menu.removeItem(R.id.more_submenu);
}

From source file:prince.app.sphotos.FBMainActivity.java

@Override
protected void hideMenuItems(Menu menu) {
    menu.removeItem(R.id.action_sync);

    if (fragments[LOGIN].isVisible() || fragments[LOGOUT].isVisible()) {
        menu.findItem(R.id.action_logout).setVisible(false);
    }/* www .j av a  2s  .  c o m*/

}