Example usage for android.view Menu clear

List of usage examples for android.view Menu clear

Introduction

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

Prototype

public void clear();

Source Link

Document

Remove all existing items from the menu, leaving it empty as if it had just been created.

Usage

From source file:it.jaschke.alexandria.fragment.DetailFragment.java

private void inflateFragmentMenuItem() {
    Menu menu = mToolbarView.getMenu();
    if (null != menu)
        menu.clear();
    mToolbarView.inflateMenu(R.menu.fragment_detail);
    mFragmentMenuItem = menu.findItem(R.id.action_share);
    mFragmentMenuItem.setVisible(false);
}

From source file:org.thoughtcrime.SMP.ConversationListActivity.java

@Override
public boolean onPrepareOptionsMenu(Menu menu) {
    MenuInflater inflater = this.getMenuInflater();
    menu.clear();

    inflater.inflate(R.menu.text_secure_normal, menu);

    menu.findItem(R.id.menu_clear_passphrase).setVisible(!TextSecurePreferences.isPasswordDisabled(this));

    inflater.inflate(R.menu.conversation_list, menu);
    MenuItem menuItem = menu.findItem(R.id.menu_search);
    initializeSearch(menuItem);/*from  www . ja  va 2 s. co m*/

    super.onPrepareOptionsMenu(menu);
    return true;
}

From source file:org.alfresco.mobile.android.application.extension.samsung.pen.SNoteEditorActionMode.java

private void getMenu(Menu menu) {
    MenuItem mi;/*from   www.  ja  v  a  2 s  .  c  o m*/
    menu.clear();

    mi = menu.add(Menu.NONE, SNoteMenuActionItem.CONTEXT_MENU_DELETE_ID,
            Menu.FIRST + SNoteMenuActionItem.MENU_EDITOR_SETTINGS, R.string.editor_tools_settings);
    mi.setIcon(R.drawable.ic_delete);
    mi.setShowAsAction(MenuItem.SHOW_AS_ACTION_IF_ROOM);

    // GROUP MENU
    if (selectedSpenObjects.size() > 1) {
        SubMenu groupSubMenu = menu.addSubMenu(Menu.NONE, SNoteMenuActionItem.MENU_EDITOR_TOOLS, Menu.FIRST,
                R.string.editor_group_menu);
        groupSubMenu.setIcon(R.drawable.ic_group);
        groupSubMenu.getItem().setShowAsAction(MenuItem.SHOW_AS_ACTION_ALWAYS);

        mi = groupSubMenu.add(Menu.NONE, SNoteMenuActionItem.CONTEXT_MENU_GROUP_ID,
                Menu.FIRST + SNoteMenuActionItem.CONTEXT_MENU_GROUP_ID, R.string.editor_group);

        mi = groupSubMenu.add(Menu.NONE, SNoteMenuActionItem.CONTEXT_MENU_UNGROUP_ID,
                Menu.FIRST + SNoteMenuActionItem.CONTEXT_MENU_UNGROUP_ID, R.string.editor_ungroup);

        mi.setEnabled(false);
        for (SpenObjectBase obj : selectedSpenObjects) {
            if (obj.getType() == SpenObjectBase.TYPE_CONTAINER) {
                mi.setEnabled(true);
                break;
            }
        }
    }

    // UP MENU
    SubMenu upMenu = menu.addSubMenu(Menu.NONE, SNoteMenuActionItem.MENU_EDITOR_TOOLS, Menu.FIRST,
            R.string.editor_front_menu);
    upMenu.setIcon(R.drawable.ic_move_up);
    upMenu.getItem().setShowAsAction(MenuItem.SHOW_AS_ACTION_ALWAYS);

    mi = upMenu.add(Menu.NONE, SNoteMenuActionItem.CONTEXT_MENU_MOVE_TO_FORWARD_ID,
            Menu.FIRST + SNoteMenuActionItem.CONTEXT_MENU_MOVE_TO_FORWARD_ID, R.string.editor_forward);

    mi = upMenu.add(Menu.NONE, SNoteMenuActionItem.CONTEXT_MENU_MOVE_TO_TOP_ID,
            Menu.FIRST + SNoteMenuActionItem.CONTEXT_MENU_MOVE_TO_TOP_ID, R.string.editor_front);

    // DOWN MENU
    SubMenu downMenu = menu.addSubMenu(Menu.NONE, SNoteMenuActionItem.MENU_EDITOR_TOOLS, Menu.FIRST,
            R.string.editor_back_menu);
    downMenu.setIcon(R.drawable.ic_move_down);
    downMenu.getItem().setShowAsAction(MenuItem.SHOW_AS_ACTION_ALWAYS);

    mi = downMenu.add(Menu.NONE, SNoteMenuActionItem.CONTEXT_MENU_MOVE_TO_BACKWARD_ID,
            Menu.FIRST + SNoteMenuActionItem.CONTEXT_MENU_MOVE_TO_BACKWARD_ID, R.string.editor_backward);

    mi = downMenu.add(Menu.NONE, SNoteMenuActionItem.CONTEXT_MENU_MOVE_TO_BOTTOM_ID,
            Menu.FIRST + SNoteMenuActionItem.CONTEXT_MENU_MOVE_TO_BOTTOM_ID, R.string.editor_back);
}

From source file:org.smssecure.smssecure.ConversationListActivity.java

@Override
public boolean onPrepareOptionsMenu(Menu menu) {
    MenuInflater inflater = this.getMenuInflater();
    menu.clear();

    inflater.inflate(R.menu.text_secure_normal, menu);

    menu.findItem(R.id.menu_clear_passphrase).setVisible(!SilencePreferences.isPasswordDisabled(this));

    inflater.inflate(R.menu.conversation_list, menu);
    MenuItem menuItem = menu.findItem(R.id.menu_search);
    initializeSearch(menuItem);/*  w w  w.  j  av a 2 s.  c o  m*/

    super.onPrepareOptionsMenu(menu);
    return true;
}

From source file:com.fastbootmobile.encore.app.fragments.DspProvidersFragment.java

@Override
public void onCreateOptionsMenu(Menu menu, MenuInflater inflater) {
    super.onCreateOptionsMenu(menu, inflater);
    menu.clear();
    inflater.inflate(R.menu.dsp_settings, menu);
}

From source file:com.supremainc.biostar2.user.UserInquriyFragment.java

@Override
public void onPrepareOptionsMenu(Menu menu) {
    menu.clear();
    MenuInflater inflater = mContext.getMenuInflater();
    if (mPermissionDataProvider.getPermission(PERMISSION_MODULE.USER, true)) {
        inflater.inflate(R.menu.edit, menu);
    } else {//from   ww  w .j  av  a 2s.c o  m
        inflater.inflate(R.menu.menu, menu);
    }
    super.onPrepareOptionsMenu(menu);
}

From source file:com.activiti.android.app.fragments.process.ProcessesFragment.java

@Override
public void onCreateOptionsMenu(Menu menu, MenuInflater inflater) {
    super.onCreateOptionsMenu(menu, inflater);
    menu.clear();
    inflater.inflate(R.menu.processes, menu);
}

From source file:systems.obscure.client.ContactsListActivity.java

@Override
public boolean onPrepareOptionsMenu(Menu menu) {
    MenuInflater inflater = this.getMenuInflater();
    menu.clear();

    //    inflater.inflate(R.menu.text_secure_normal, menu);

    //    menu.findItem(R.id.menu_clear_passphrase).setVisible(!TextSecurePreferences.isPasswordDisabled(this));

    if (this.masterSecret != null) {
        inflater.inflate(R.menu.conversation_list, menu);
        MenuItem menuItem = menu.findItem(R.id.menu_search);
        initializeSearch(menuItem);/* w ww  .j  a v  a2s  .  c o m*/
    } else {
        inflater.inflate(R.menu.conversation_list_empty, menu);
    }

    super.onPrepareOptionsMenu(menu);
    return true;
}

From source file:com.jwork.dhammapada.SearchFragment.java

@TargetApi(Build.VERSION_CODES.HONEYCOMB)
@Override
public void onCreateOptionsMenu(Menu menu, MenuInflater inflater) {
    menu.clear();
}

From source file:com.activiti.android.app.fragments.HelpDialogFragment.java

@Override
public void onCreateOptionsMenu(Menu menu, MenuInflater inflater) {
    super.onCreateOptionsMenu(menu, inflater);
    menu.clear();

    refreshIcon = menu.add(Menu.NONE, R.id.menu_refresh, Menu.FIRST, R.string.refresh);
    refreshIcon.setIcon(R.drawable.ic_refresh_white);
    refreshIcon.setShowAsAction(MenuItem.SHOW_AS_ACTION_IF_ROOM);
}