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:Windows.UI.Xaml.Controls.CommandBar.java

public static void remove(android.app.Activity activity, android.view.Menu menu) {
    //if (!(activity instanceof ActionBarActivity)) {
    android.app.ActionBar mainActionBar = activity.getActionBar();
    if (mainActionBar != null) {
        mainActionBar.hide();/*  ww  w . j a v a 2s.co  m*/
        mainActionBar.setTitle(null);
        menu.clear();
        return;
    }
    //}
    //else {
    //    ActionBar actionBar = ((ActionBarActivity)activity).getSupportActionBar();
    //    if (actionBar != null) {
    //        actionBar.hide();
    //        actionBar.setTitle(null);
    //        menu.clear();
    //        return;
    //    }
    //}
}

From source file:io.apptik.multiview.BlankFragment.java

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

From source file:io.apptik.multiview.GalleryViewFragment.java

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

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

@SuppressWarnings("deprecation")
@Override/*from   w ww  .j  a va  2 s.co  m*/
public void onPrepareOptionsMenu(Menu menu) {
    menu.clear();
    MenuItem menuItemAddNewEntryToDataTable = menu.add(Menu.NONE, MEUN_ITEM_ADD_NEW_ENTRY, Menu.NONE,
            getString(R.string.add_new));
    menuItemAddNewEntryToDataTable.setIcon(getResources().getDrawable(R.drawable.ic_action_content_new));
    if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.HONEYCOMB) {
        menuItemAddNewEntryToDataTable.setShowAsAction(MenuItem.SHOW_AS_ACTION_IF_ROOM);
    }
    super.onPrepareOptionsMenu(menu);
}

From source file:io.apptik.multiview.LayoutsFragment.java

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

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

@SuppressWarnings("deprecation")
@Override// w w  w  .j  av  a 2 s .c o  m
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(getResources().getDrawable(R.drawable.ic_action_content_new));

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

From source file:net.openfiretechnologies.veloxcontrol.github.CommitsFragment.java

public void onPrepareOptionsMenu(Menu menu) {
    // remove old menu items
    menu.clear();
    // add projects as option
    // cant change branch if we are not viewing a project folder's commits
    if (GithubViewer.ARE_IN_PROJECT_PATH)
        menu.add(0, GithubViewer.MENU_ID_COMMITLOG, 0, getString(R.string.changelog_menu_commitlog_title));
    else/*from   ww  w.  ja  va  2s .c o  m*/
        menu.add(0, GithubViewer.MENU_ID_PACKAGES, 0, getString(R.string.changelog_menu_projects_title));
}

From source file:io.apptik.multiview.BasicFragment.java

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

}

From source file:com.example.android.movies.app.MainActivity.java

@Override
public boolean onPrepareOptionsMenu(Menu menu) {
    menu.clear();
    //getMenuInflater().inflate(R.menu.main, menu);
    MenuInflater inflater = getMenuInflater();
    inflater.inflate(R.menu.main, menu);
    MenuItem searchItem = menu.findItem(R.id.search);
    android.support.v7.widget.SearchView searchView = (android.support.v7.widget.SearchView) MenuItemCompat
            .getActionView(searchItem);/*from   w w  w  . ja  v a  2 s .  co m*/
    searchView.setQueryHint("Find movies...");
    int searchPlateId = searchView.getContext().getResources().getIdentifier("android:id/search_plate", null,
            null);
    View searchPlate = searchView.findViewById(searchPlateId);
    if (searchPlate != null) {
        searchPlate.setBackgroundColor(Color.DKGRAY);
        int searchTextId = searchPlate.getContext().getResources().getIdentifier("android:id/search_src_text",
                null, null);
        TextView searchText = (TextView) searchPlate.findViewById(searchTextId);
        if (searchText != null) {
            searchText.setTextColor(Color.WHITE);
            searchText.setHintTextColor(Color.WHITE);
        }
    }
    SearchView.OnQueryTextListener queryTextListener = new SearchView.OnQueryTextListener() {
        public boolean onQueryTextChange(String newText) {
            return true;
        }

        public boolean onQueryTextSubmit(String query) {

            SearchFragment fragmentS1 = new SearchFragment();
            Bundle bundle = new Bundle();

            bundle.putString("search", query);

            fragmentS1.setArguments(bundle);
            getSupportFragmentManager().beginTransaction().replace(R.id.container, fragmentS1).commit();

            return true;

        }
    };
    searchView.setOnQueryTextListener(queryTextListener);
    searchView.setIconifiedByDefault(false);

    return true;
}

From source file:net.openfiretechnologies.veloxcontrol.github.GithubViewer.java

/**
 * this is the only method called right before every display of the menu
 * here we choose what dynamic content to display for the menu
 *///from   www  .  ja  v  a  2  s. c o  m
public void onPrepareOptionsMenu(Menu menu) {
    // remove old menu items
    menu.clear();

    // cant change branch if we are not viewing a project folder's commits
    if (ARE_IN_PROJECT_PATH)
        menu.add(0, MENU_ID_COMMITLOG, 0, getString(R.string.changelog_menu_commitlog_title));
    else
        menu.add(0, MENU_ID_PACKAGES, 0, getString(R.string.changelog_menu_projects_title));
}