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:de.qspool.clementineremote.ui.fragments.DownloadsFragment.java

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

    super.onCreateOptionsMenu(menu, inflater);
}

From source file:com.gmail.at.faint545.fragments.HistoryFragment.java

@Override
public void onPrepareOptionsMenu(Menu menu) {
    menu.clear();
    /* Only show these two options if there are jobs to delete */
    if (mSelectedPositions.size() > 0 && mOldJobs.size() > 0) {
        menu.add(Menu.NONE, DELETE, Menu.NONE, "Delete selected");
    } else if (mOldJobs.size() > 0) {
        menu.add(Menu.NONE, DELETE, Menu.NONE, "Delete all");
    }//from   w w w  .j a v  a2  s  . com
    super.onPrepareOptionsMenu(menu);
}

From source file:eu.iescities.pilot.rovereto.roveretoexplorer.fragments.search.SearchFragment.java

@Override
public void onPrepareOptionsMenu(Menu menu) {
    menu.clear();
    Log.i("MENU", "load gripmenu!!!!");
    getActivity().getMenuInflater().inflate(R.menu.gripmenu, menu);

    SubMenu submenu = menu.getItem(0).getSubMenu();
    submenu.clear();/*from  w  w  w . ja  va 2s  .  com*/

    super.onPrepareOptionsMenu(menu);
}

From source file:com.mifos.mifosxdroid.online.CollectionSheetFragment.java

@Override
public void onPrepareOptionsMenu(Menu menu) {

    menu.clear();

    MenuItem mItemSearch = menu.add(Menu.NONE, MENU_ITEM_SEARCH, Menu.NONE, getString(R.string.search));
    //        mItemSearch.setIcon(new IconDrawable(getActivity(), MaterialIcons.md_search)
    //                .colorRes(Color.WHITE)
    //                .actionBarSize());
    if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.HONEYCOMB) {
        mItemSearch.setShowAsAction(MenuItem.SHOW_AS_ACTION_NEVER);
    }//from w  w  w.java2  s.co m

    MenuItem mItemRefresh = menu.add(Menu.NONE, MENU_ITEM_REFRESH, Menu.NONE, getString(R.string.refresh));
    mItemRefresh.setIcon(
            new IconDrawable(getActivity(), MaterialIcons.md_refresh).colorRes(Color.WHITE).actionBarSize());
    if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.HONEYCOMB) {
        mItemRefresh.setShowAsAction(MenuItem.SHOW_AS_ACTION_IF_ROOM);
    }

    MenuItem mItemSave = menu.add(Menu.NONE, MENU_ITEM_SAVE, Menu.NONE, getString(R.string.save));
    mItemSave.setIcon(
            new IconDrawable(getActivity(), MaterialIcons.md_save).colorRes(Color.WHITE).actionBarSize());
    if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.HONEYCOMB) {
        mItemSave.setShowAsAction(MenuItem.SHOW_AS_ACTION_IF_ROOM);
    }

    super.onPrepareOptionsMenu(menu);

}

From source file:it.unibs.sandroide.lib.beacon.ui.BeaconTagActivity.java

@Override
public boolean onPrepareOptionsMenu(Menu menu) {
    menu.clear();

    menu.add(0, MENU_ADD, Menu.NONE, "Load").setIcon(android.R.drawable.ic_menu_add);
    menu.add(0, MENU_LIST, Menu.NONE, "Save").setIcon(android.R.drawable.ic_menu_upload);
    return super.onPrepareOptionsMenu(menu);
}

From source file:org.croudtrip.fragments.join.JoinDispatchFragment.java

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

From source file:com.mifos.mifosxdroid.online.clientcharge.ClientChargeFragment.java

@Override
public void onPrepareOptionsMenu(Menu menu) {
    menu.clear();
    MenuItem menuItemAddNewDocument = menu.add(Menu.NONE, MENU_ITEM_ADD_NEW_CHARGES, Menu.NONE,
            getString(R.string.add_new));
    menuItemAddNewDocument//from w ww  .j a  v a 2  s . c  om
            .setIcon(ResourcesCompat.getDrawable(getResources(), R.drawable.ic_add_white_24dp, null));

    if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.HONEYCOMB)
        menuItemAddNewDocument.setShowAsAction(MenuItem.SHOW_AS_ACTION_IF_ROOM);
    super.onPrepareOptionsMenu(menu);
}

From source file:com.mifos.mifosxdroid.online.collectionsheet.CollectionSheetFragment.java

@Override
public void onPrepareOptionsMenu(Menu menu) {

    menu.clear();

    MenuItem mItemSearch = menu.add(Menu.NONE, MENU_ITEM_SEARCH, Menu.NONE, getString(R.string.search));
    //        mItemSearch.setIcon(new IconDrawable(getActivity(), MaterialIcons.md_search)
    //                .colorRes(Color.WHITE)
    //                .actionBarSize());
    if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.HONEYCOMB) {
        mItemSearch.setShowAsAction(MenuItem.SHOW_AS_ACTION_NEVER);
    }//ww  w . j  a  va 2 s.  c  o m

    MenuItem mItemRefresh = menu.add(Menu.NONE, MENU_ITEM_REFRESH, Menu.NONE, getString(R.string.refresh));
    mItemRefresh.setIcon(
            new IconDrawable(getActivity(), MaterialIcons.md_refresh).colorRes(R.color.white).actionBarSize());
    if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.HONEYCOMB) {
        mItemRefresh.setShowAsAction(MenuItem.SHOW_AS_ACTION_IF_ROOM);
    }

    MenuItem mItemSave = menu.add(Menu.NONE, MENU_ITEM_SAVE, Menu.NONE, getString(R.string.save));
    mItemSave.setIcon(
            new IconDrawable(getActivity(), MaterialIcons.md_save).colorRes(R.color.white).actionBarSize());
    if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.HONEYCOMB) {
        mItemSave.setShowAsAction(MenuItem.SHOW_AS_ACTION_IF_ROOM);
    }

    super.onPrepareOptionsMenu(menu);

}

From source file:com.lithidsw.wallbox.MainActivity.java

@Override
public boolean onCreateOptionsMenu(Menu menu) {
    menu.clear();
    if (mDrawerLayout == null || !mDrawerLayout.isDrawerOpen(mDrawerList)) {
        MenuInflater inflater = getMenuInflater();
        int item = mDrawerList.getCheckedItemPosition();
        switch (item) {
        case WALLSNAP:
            inflater.inflate(R.menu.wallsnap_menu, menu);
            break;
        case COLORWALL:
            inflater.inflate(R.menu.colorwall_menu, menu);
            break;
        case SATURATE:
            inflater.inflate(R.menu.saturate_menu, menu);
            Log.e("", "Loaded menu item sat");
            break;
        case RANDOMIZE:
            inflater.inflate(R.menu.randomizer_menu, menu);
            break;
        case WALLPAPER:
            inflater.inflate(R.menu.wallpaper_menu, menu);
            break;
        case THEMES:
            inflater.inflate(R.menu.theme_menu, menu);
            break;
        }/*from   w ww .j  a  v a2  s  . c o m*/
    }

    menuHelper.setAbout(menu);
    return super.onCreateOptionsMenu(menu);
}

From source file:com.cyanogenmod.eleven.ui.HeaderBar.java

public void showPopupMenu() {
    // create the popup menu
    if (mPopupMenu == null) {
        mPopupMenu = new PopupMenu(mFragment.getActivity(), mMenuButton);
        mPopupMenu.setOnMenuItemClickListener(new PopupMenu.OnMenuItemClickListener() {
            @Override/*from  ww w  .j  a  va  2  s.com*/
            public boolean onMenuItemClick(MenuItem item) {
                return onPopupMenuItemClick(item);
            }
        });
    }

    final Menu menu = mPopupMenu.getMenu();
    final MenuInflater inflater = mPopupMenu.getMenuInflater();

    menu.clear();

    // Shuffle all
    inflater.inflate(R.menu.shuffle_all, menu);
    if (MusicUtils.getQueueSize() > 0) {
        // save queue/clear queue
        inflater.inflate(R.menu.queue, menu);
    }
    // Settings
    inflater.inflate(R.menu.activity_base, menu);

    // show the popup
    mPopupMenu.show();
}