Example usage for android.view MenuInflater inflate

List of usage examples for android.view MenuInflater inflate

Introduction

In this page you can find the example usage for android.view MenuInflater inflate.

Prototype

public void inflate(@MenuRes int menuRes, Menu menu) 

Source Link

Document

Inflate a menu hierarchy from the specified XML resource.

Usage

From source file:baasi.hackathon.sja.TalkActivity.java

@Override
public boolean onCreateOptionsMenu(Menu menu) {
    super.onCreateOptionsMenu(menu);
    MenuInflater inflater = getMenuInflater();
    inflater.inflate(R.menu.menu_main, menu);
    return true;//from  w w w.j ava  2 s .  c  om
}

From source file:com.bringcommunications.etherpay.SendActivity.java

public boolean onCreateOptionsMenu(Menu menu) {
    MenuInflater inflater = getMenuInflater();
    inflater.inflate(R.menu.send_options, menu);
    menu.findItem(R.id.show_gas).setChecked(show_gas);
    menu.findItem(R.id.show_data).setChecked(show_data);
    return (true);
}

From source file:com.activiti.android.app.fragments.task.TaskDetailsFragment.java

@Override
public void onCreateOptionsMenu(Menu menu, MenuInflater inflater) {
    super.onCreateOptionsMenu(menu, inflater);
    if (taskRepresentation != null) {
        if (!DisplayUtils.hasCentralPane(getActivity())) {
            menu.clear();//w  w  w  .ja v a 2 s. c  o  m
            inflater.inflate(R.menu.task_details, menu);
        } else {
            getToolbar().getMenu().clear();
            getToolbar().inflateMenu(R.menu.task_details);
            // Set an OnMenuItemClickListener to handle menu item clicks
            getToolbar().setOnMenuItemClickListener(new Toolbar.OnMenuItemClickListener() {
                @Override
                public boolean onMenuItemClick(MenuItem item) {
                    return onOptionsItemSelected(item);
                }
            });

        }
        this.menu = menu;
    }
}

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

@Override
public void onCreateOptionsMenu(Menu menu, MenuInflater inflater) {
    super.onCreateOptionsMenu(menu, inflater);
    if (processInstanceRepresentation != null) {
        if (!DisplayUtils.hasCentralPane(getActivity())) {
            menu.clear();/*from   w ww . jav a2s .com*/
            inflater.inflate(R.menu.process_details, menu);
        } else {
            getToolbar().getMenu().clear();
            getToolbar().inflateMenu(R.menu.process_details);
            // Set an OnMenuItemClickListener to handle menu item clicks
            getToolbar().setOnMenuItemClickListener(new Toolbar.OnMenuItemClickListener() {
                @Override
                public boolean onMenuItemClick(MenuItem item) {
                    return onOptionsItemSelected(item);
                }
            });

        }
        this.menu = menu;
    }
}

From source file:biz.bokhorst.xprivacy.ActivityUsage.java

@Override
public boolean onCreateOptionsMenu(Menu menu) {
    MenuInflater inflater = getMenuInflater();
    if (inflater != null && PrivacyService.checkClient()) {
        inflater.inflate(R.menu.usage, menu);
        return true;
    } else/*  w w w . j  a  va 2s .  c o  m*/
        return false;
}

From source file:com.zotfeed2.CardContentFragment.java

@Override
public void onCreateOptionsMenu(Menu menu, MenuInflater inflater) {
    inflater.inflate(R.menu.menu_anteater_tv, menu);
    //        MenuItem item = menu.findItem(R.id.action_search);
    SearchManager searchManager = (SearchManager) getActivity().getSystemService(Context.SEARCH_SERVICE);
    MenuItem searchItem = menu.findItem(R.id.action_search);
    SearchView sv = (SearchView) MenuItemCompat.getActionView(searchItem);
    if (sv != null) {
        sv.setSearchableInfo(searchManager.getSearchableInfo(getActivity().getComponentName()));
        sv.setOnQueryTextListener(new SearchView.OnQueryTextListener() {
            @Override/*from  ww w. j  a  v  a 2s.c  o  m*/
            public boolean onQueryTextSubmit(String query) {
                System.out.print("QUERY:" + query);
                ArrayList<VideoItem> results = new ArrayList<VideoItem>();
                if (!videoBeans.isEmpty() || videoBeans != null) {
                    for (VideoItem videoItem : videoBeans) {
                        //System.out.println("Title: " + article.getTitle());
                        if (videoItem.getTitle().toLowerCase().contains(query.toLowerCase())) {
                            results.add(videoItem);
                        }
                    }
                    System.out.println("Size: " + results.size());
                    search = true;
                    recyclerView.setAdapter(new ContentAdapter(results));
                    recyclerView.setHasFixedSize(true);
                    recyclerView.setLayoutManager(new LinearLayoutManager(getActivity()));
                    return true;
                } else {
                    return false;
                }
            }

            @Override
            public boolean onQueryTextChange(String newText) {
                if (newText.isEmpty() || newText.equals(" ")) {
                    if (videoBeans != null) {
                        recyclerView.setAdapter(new ContentAdapter(videoBeans));
                        recyclerView.setHasFixedSize(true);
                        recyclerView.setLayoutManager(new LinearLayoutManager(getActivity()));
                    }
                }
                return false;
            }
        });
    }
    super.onCreateOptionsMenu(menu, inflater);

}

From source file:com.njlabs.amrita.aid.gpms.ui.GpmsActivity.java

@Override
public boolean onCreateOptionsMenu(Menu menu) {
    MenuInflater inflater = getMenuInflater();
    inflater.inflate(R.menu.aums, menu);
    return true;/*from  w w w  . j  a  va  2 s. c  om*/
}

From source file:com.teleca.jamendo.activity.HomeActivity.java

@Override
public boolean onCreateOptionsMenu(Menu menu) {
    MenuInflater inflater = getMenuInflater();
    inflater.inflate(R.menu.home, menu);
    return super.onCreateOptionsMenu(menu);
}

From source file:com.facebook.samples.musicdashboard.MusicGalleryFragment.java

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

From source file:com.pentacog.mctracker.MCServerTrackerActivity.java

/**
 * @see android.app.Activity#onCreateOptionsMenu(Menu menu)
 *///w ww  .j a  v  a  2  s  .c om
@Override
public boolean onCreateOptionsMenu(Menu menu) {
    MenuInflater inflater = getMenuInflater();
    inflater.inflate(R.menu.server_list_menu, menu);
    return true;
}