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:com.airk.interpolatordiagram.app.MainActivity.java

@Override
public boolean onCreateOptionsMenu(Menu menu) {
    menu.clear();
    if (mDrawerLayout != null && mDrawerLayout.isDrawerOpen(mList)) {
        return true;
    }// www  .j a va  2  s  .  c o  m
    getMenuInflater().inflate(R.menu.main, menu);
    if (mSelectedInterpolator != -1) {
        menu.findItem(R.id.action_play).setVisible(true);
        View v = MenuItemCompat.getActionView(menu.findItem(R.id.action_play));
        v.setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(final View v) {
                final ObjectAnimator animator = ObjectAnimator.ofFloat(v, "rotationX", 0, 360);
                animator.setDuration(800).setRepeatCount(ObjectAnimator.INFINITE);
                animator.setInterpolator(new LinearInterpolator());
                animator.addListener(new AnimatorListenerAdapter() {
                    @Override
                    public void onAnimationStart(Animator animation) {
                        super.onAnimationStart(animation);
                        v.setClickable(false);
                    }

                    @Override
                    public void onAnimationEnd(Animator animation) {
                        super.onAnimationEnd(animation);
                        v.setClickable(true);
                    }

                    @Override
                    public void onAnimationCancel(Animator animation) {
                        super.onAnimationCancel(animation);
                        ObjectAnimator a = ObjectAnimator.ofFloat(v, "rotationX", 0);
                        a.setDuration(1).start();
                        v.setClickable(true);
                    }
                });
                animator.start();
                Fragment fragment = FragmentFactory.getInstance().getInterpolator(mSelectedInterpolator);
                ((BaseFragment) fragment).getDiagramView().playBalls(new DiagramView.AnimationListener() {
                    @Override
                    public void onAnimateFinished() {
                        animator.cancel();
                    }
                });
            }
        });
    }
    return super.onCreateOptionsMenu(menu);
}

From source file:com.odoo.addons.products.Products.java

@Override
public void onCreateOptionsMenu(Menu menu, MenuInflater inflater) {
    super.onCreateOptionsMenu(menu, inflater);
    menu.clear();
    inflater.inflate(R.menu.menu_products, menu);
    setHasSearchView(this, menu, R.id.menu_product_search);
}

From source file:com.pseudosudostudios.jdd.activities.WinActivity.java

@Override
public boolean onPrepareOptionsMenu(Menu menu) {
    menu.clear();
    getMenuInflater().inflate(R.menu.menu_win_activity, menu);
    if (!isSignedIn()) {
        menu.removeItem(R.id.action_achievements);
        menu.removeItem(R.id.action_leaderboards);
    }//from   w  w  w  .  j  a  v  a  2  s  . c om
    return true;
}

From source file:com.cypress.cysmart.BLEServiceFragments.BatteryInformationService.java

@Override
public void onCreateOptionsMenu(Menu menu, MenuInflater inflater) {
    menu.clear();
    inflater.inflate(R.menu.global, menu);
    MenuItem graph = menu.findItem(R.id.graph);
    MenuItem log = menu.findItem(R.id.log);
    MenuItem search = menu.findItem(R.id.search);
    search.setVisible(false);/*from  w  ww  .ja v  a2 s  .c om*/
    graph.setVisible(false);
    log.setVisible(true);
    super.onCreateOptionsMenu(menu, inflater);
}

From source file:com.microsoft.onedrive.apiexplorer.DeltaFragment.java

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

From source file:com.emuneee.nctrafficcams.ui.fragments.CameraGalleryFragment.java

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

From source file:com.odoo.addons.customers.Customers.java

@Override
public void onCreateOptionsMenu(Menu menu, MenuInflater inflater) {
    super.onCreateOptionsMenu(menu, inflater);
    menu.clear();
    inflater.inflate(R.menu.menu_partners, menu);
    setHasSearchView(this, menu, R.id.menu_partner_search);
}

From source file:org.xbmc.android.remote.presentation.activity.MovieLibraryActivity.java

@Override
public boolean onPrepareOptionsMenu(Menu menu) {
    menu.clear();
    menu.add(0, MENU_NOW_PLAYING, 0, "Now playing").setIcon(R.drawable.menu_nowplaying);
    switch (mTabHost.getCurrentTab()) {
    case 0:/*from   ww  w .ja  va  2 s  .c  om*/
        mMovieController.onCreateOptionsMenu(menu);
        break;
    case 1:
        mActorController.onCreateOptionsMenu(menu);
        break;
    case 2:
        mGenresController.onCreateOptionsMenu(menu);
        break;
    case 3:
        mFileController.onCreateOptionsMenu(menu);
        break;
    case 4:
        mMoviePosterWrapController.onCreateOptionsMenu(menu);
        break;
    }
    menu.add(0, MENU_UPDATE_LIBRARY, 0, "Update Library").setIcon(R.drawable.menu_refresh);
    menu.add(0, MENU_REMOTE, 0, "Remote control").setIcon(R.drawable.menu_remote);
    return super.onPrepareOptionsMenu(menu);
}

From source file:com.mifos.mifosxdroid.online.documentlist.DocumentListFragment.java

@Override
public void onPrepareOptionsMenu(Menu menu) {
    menu.clear();
    MenuItem menuItemAddNewDocument = menu.add(Menu.NONE, MENU_ITEM_ADD_NEW_DOCUMENT, Menu.NONE,
            getString(R.string.add_new));
    menuItemAddNewDocument.setIcon(ContextCompat.getDrawable(getActivity(), R.drawable.ic_add_white_24dp));

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

From source file:com.hichinaschool.flashcards.anki.StudyOptionsActivity.java

@Override
public boolean onMenuOpened(int featureId, Menu menu) {
    if (mInvalidateMenu) {
        menu.clear();
        onCreateOptionsMenu(menu);/*w w w  .  j  av  a2  s .co  m*/
        mInvalidateMenu = false;
    }

    return super.onMenuOpened(featureId, menu);
}