List of usage examples for android.view MenuInflater inflate
public void inflate(@MenuRes int menuRes, Menu menu)
From source file:de.elanev.studip.android.app.backend.net.oauth.SignInFragment.java
@Override public void onCreateOptionsMenu(Menu menu, MenuInflater inflater) { inflater.inflate(R.menu.menu_sign_in, menu); if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.HONEYCOMB) { MenuItem searchItem = menu.findItem(R.id.search_studip); SearchView searchView = (SearchView) MenuItemCompat.getActionView(searchItem); SearchView.OnQueryTextListener queryTextListener = new SearchView.OnQueryTextListener() { @Override/* w w w . ja v a 2s. c o m*/ public boolean onQueryTextSubmit(String s) { return false; } @Override public boolean onQueryTextChange(String s) { if (TextUtils.isEmpty(s)) { mListView.clearTextFilter(); } else { mListView.setFilterText(s); } return true; } }; searchView.setOnQueryTextListener(queryTextListener); } super.onCreateOptionsMenu(menu, inflater); }
From source file:com.gelakinetic.mtgfam.fragments.TradeFragment.java
@Override public void onCreateOptionsMenu(Menu menu, MenuInflater inflater) { super.onCreateOptionsMenu(menu, inflater); inflater.inflate(R.menu.trader_menu, menu); }
From source file:com.android.contacts.activities.ContactDetailActivity.java
@Override public boolean onCreateOptionsMenu(Menu menu) { super.onCreateOptionsMenu(menu); MenuInflater inflater = getMenuInflater(); inflater.inflate(R.menu.star, menu); return true;//from w w w. jav a2 s.c o m }
From source file:com.heightechllc.breakify.MainActivity.java
@Override public boolean onCreateOptionsMenu(Menu menu) { MenuInflater inflater = getMenuInflater(); inflater.inflate(R.menu.main_activity_actions, menu); return true;//from w ww .j a v a 2 s.c om }
From source file:com.borqs.browser.combo.BookmarksPageCallbacks.java
@Override public void onCreateContextMenu(ContextMenu menu, View v, ContextMenuInfo menuInfo) { BookmarkContextMenuInfo info = (BookmarkContextMenuInfo) menuInfo; BrowserBookmarksAdapter adapter = getChildAdapter(info.groupPosition); Cursor cursor = adapter.getItem(info.childPosition); if (!canEdit(cursor)) { return;/*from ww w . j a va2 s. c om*/ } boolean isFolder = cursor.getInt(BookmarksLoader.COLUMN_INDEX_IS_FOLDER) != 0; final Activity activity = this; MenuInflater inflater = activity.getMenuInflater(); inflater.inflate(R.menu.bookmarkscontext, menu); if (isFolder) { menu.setGroupVisible(R.id.FOLDER_CONTEXT_MENU, true); } else { menu.setGroupVisible(R.id.BOOKMARK_CONTEXT_MENU, true); if (mDisableNewWindow) { menu.findItem(R.id.new_window_context_menu_id).setVisible(false); } } BookmarkItem header = new BookmarkItem(activity); header.setEnableScrolling(true); populateBookmarkItem(cursor, header, isFolder); menu.setHeaderView(header); int count = menu.size(); for (int i = 0; i < count; i++) { menu.getItem(i).setOnMenuItemClickListener(mContextItemClickListener); } }
From source file:chaitanya.im.searchforreddit.LauncherActivity.java
@Override public boolean onCreateOptionsMenu(Menu menu) { Log.d(TAG, "onCreateOptionsMenu"); MenuInflater inflater = getMenuInflater(); inflater.inflate(R.menu.main_menu, menu); MenuItem actionDark = menu.findItem(R.id.action_dark); if (donate == 1) { menu.findItem(R.id.action_donate).setVisible(false); }/* w w w . jav a 2 s. co m*/ if (theme != 0) { actionDark.setChecked(true); isChecked = true; searchEditText.getText().clear(); menu.findItem(R.id.action_refresh).setIcon(R.drawable.ic_refresh_white); } return true; }
From source file:com.timemachine.controller.ControllerActivity.java
@Override public boolean onCreateOptionsMenu(Menu menu) { // Inflate the menu items for use in the action bar MenuInflater inflater = getMenuInflater(); inflater.inflate(R.menu.main_activity_actions, menu); // Associate searchable configuration with the SearchView // Get the SearchView and set the searchable configuration SearchManager searchManager = (SearchManager) getSystemService(Context.SEARCH_SERVICE); SearchView searchView = (SearchView) menu.findItem(R.id.search).getActionView(); searchView.setSearchableInfo(searchManager.getSearchableInfo(getComponentName())); // Change the text color in the search view int id = searchView.getContext().getResources().getIdentifier("android:id/search_src_text", null, null); searchTextView = (TextView) searchView.findViewById(id); searchTextView.setHintTextColor(Color.parseColor("#80ffffff")); searchTextView.setTextColor(Color.parseColor("#ffffff")); return super.onCreateOptionsMenu(menu); }
From source file:cn.studyjams.s2.sj0132.bowenyan.mygirlfriend.nononsenseapps.notepad.ui.editor.TaskDetailFragment.java
@Override public void onCreateOptionsMenu(Menu menu, MenuInflater inflater) { inflater.inflate(R.menu.fragment_tasks_detail, menu); // Locate MenuItem with ShareActionProvider MenuItem item = menu.findItem(R.id.menu_share); if (item != null) { // Fetch and store ShareActionProvider mShareActionProvider = MenuItemCompat.getActionProvider(item); setShareIntent(""); }/*from w w w . j a v a 2s .c o m*/ }
From source file:net.reichholf.dreamdroid.fragment.ServiceListFragment.java
@Override public void createOptionsMenu(Menu menu, MenuInflater inflater) { checkMenuReload(menu, inflater); inflater.inflate(R.menu.servicelist, menu); }