List of usage examples for android.view MenuInflater inflate
public void inflate(@MenuRes int menuRes, Menu menu)
From source file:com.synchophy.ui.CoverFlowActivity.java
@Override public void onCreateContextMenu(ContextMenu menu, View v, ContextMenuInfo menuInfo) { MenuInflater inflater = getMenuInflater(); inflater.inflate(R.menu.add_menu, menu); }
From source file:com.microsoft.mimickeralarm.appcore.AlarmListFragment.java
@Override public void onCreateOptionsMenu(Menu menu, MenuInflater inflater) { inflater.inflate(R.menu.menu_alarm_list, menu); MenuItem add = menu.findItem(R.id.action_add_alarm); add.setVisible(mShowAddButtonInToolbar); super.onCreateOptionsMenu(menu, inflater); }
From source file:net.mEmoZz.PopMovies.frags.DetailFragment.java
@Override public void onCreateOptionsMenu(Menu menu, MenuInflater inflater) { inflater.inflate(R.menu.detail_fragment, menu); MenuItem menuItem = menu.findItem(R.id.action_share); DetailShareProvider mShareActionProvider = (DetailShareProvider) MenuItemCompat.getActionProvider(menuItem); if (mShareActionProvider != null) { mShareActionProvider.setShareIntent(createShareForecastIntent()); }/*w w w . j a v a 2 s.c om*/ }
From source file:ch.kanti_baden.pu_marc_14b.traffictimewaste.SORT_TYPE.java
@Override public boolean onCreateOptionsMenu(Menu menu) { MenuInflater inflater = getMenuInflater(); inflater.inflate(R.menu.menu_post_list, menu); // Disable create post button if user isn't logged in if (DatabaseLink.instance.isLoggedIn()) { MenuItem menuItem = menu.findItem(R.id.action_login); menuItem.setEnabled(false);/*from w w w . j ava 2s . c o m*/ } else { MenuItem menuItem = menu.findItem(R.id.action_create); menuItem.setEnabled(false); Drawable icon = menuItem.getIcon(); icon.mutate().setColorFilter(Color.GRAY, PorterDuff.Mode.SRC_IN); menuItem.setIcon(icon); } // Get the SearchView and set the searchable configuration SearchManager searchManager = (SearchManager) getSystemService(Context.SEARCH_SERVICE); final SearchView searchView = (SearchView) menu.findItem(R.id.action_search).getActionView(); searchView.setOnSearchClickListener(new View.OnClickListener() { @Override public void onClick(View v) { searchView.setTranslationX(500f); searchView.setAlpha(0f); searchView.animate().translationX(0); searchView.animate().alpha(1f); } }); // Assumes current activity is the searchable activity searchView.setSearchableInfo(searchManager.getSearchableInfo(getComponentName())); return true; }
From source file:nl.terr.tabweave.TabWeave.java
@Override public boolean onCreateOptionsMenu(Menu menu) { MenuInflater inflater = getMenuInflater(); inflater.inflate(R.menu.main_menu, menu); return true;/*w w w. java 2 s. c o m*/ }
From source file:com.andrada.sitracker.ui.fragment.AuthorsFragment.java
@Override public boolean onCreateActionMode(@NotNull ActionMode mode, Menu menu) { MenuInflater inflater = mode.getMenuInflater(); inflater.inflate(R.menu.context_authors, menu); mSelectedAuthors.clear();// w w w. j a va 2 s. c om return true; }
From source file:ca.six.unittestapp.todo.tasks.TasksFragment.java
@Override public void onCreateOptionsMenu(Menu menu, MenuInflater inflater) { inflater.inflate(R.menu.tasks_fragment_menu, menu); }
From source file:co.edu.uniajc.vtf.content.ListSitesFragment.java
@Override public void onCreateOptionsMenu(Menu menu, MenuInflater inflater) { inflater.inflate(R.menu.menu_fragment_sites_list, menu); }
From source file:com.akhbulatov.wordkeeper.ui.fragment.CategoryListFragment.java
@Override public void onCreateOptionsMenu(Menu menu, MenuInflater inflater) { inflater.inflate(R.menu.fragment_category, menu); MenuItem searchItem = menu.findItem(R.id.menu_search_category); SearchView searchView = (SearchView) searchItem.getActionView(); SearchManager searchManager = (SearchManager) getActivity().getSystemService(Context.SEARCH_SERVICE); searchView.setSearchableInfo(/* w ww .j a v a 2s . c o m*/ searchManager.getSearchableInfo(new ComponentName(getActivity(), MainActivity.class))); searchView.setImeOptions(EditorInfo.IME_ACTION_SEARCH); searchView.setOnQueryTextListener(new SearchView.OnQueryTextListener() { @Override public boolean onQueryTextChange(String newText) { final Cursor cursor = mCategoryDbAdapter.getAll(); final int column = cursor.getColumnIndex(CategoryEntry.COLUMN_NAME); if (newText.length() > 0) { mCategoryAdapter.swapCursor(new FilterCursorWrapper(cursor, newText, column)); if (mCategoryAdapter.getItemCount() == 0) { String escapedNewText = TextUtils.htmlEncode(newText); String formattedNoResults = String.format(getString(R.string.no_results_category), escapedNewText); CharSequence styledNoResults = Html.fromHtml(formattedNoResults); mTextNoResultsCategory.setText(styledNoResults); mTextNoResultsCategory.setVisibility(View.VISIBLE); } else { mTextNoResultsCategory.setVisibility(View.GONE); } } else { mCategoryAdapter.swapCursor(cursor); mTextNoResultsCategory.setVisibility(View.GONE); } return true; } @Override public boolean onQueryTextSubmit(String query) { return false; } }); }
From source file:ch.citux.td.ui.TDActivity.java
@Override public boolean onCreateOptionsMenu(Menu menu) { MenuInflater inflater = getMenuInflater(); inflater.inflate(R.menu.main, menu); refreshItem = menu.findItem(R.id.menu_refresh); searchItem = menu.findItem(R.id.menu_search); // Associate searchable configuration with the SearchView SearchManager searchManager = (SearchManager) getSystemService(Context.SEARCH_SERVICE); SearchView searchView = (SearchView) MenuItemCompat.getActionView(searchItem); searchView.setSearchableInfo(searchManager.getSearchableInfo(getComponentName())); searchView.setOnQueryTextFocusChangeListener(this); return true;/*from w w w . ja v a 2 s .c o m*/ }