List of usage examples for android.view MenuItem getActionView
public View getActionView();
From source file:com.nma.util.sdcardtrac.SearchableActivity.java
@Override public boolean onCreateOptionsMenu(Menu menu) { getMenuInflater().inflate(R.menu.search_menu, menu); MenuItem searchViewItem = menu.findItem(R.id.search_again); SearchView searchView = (SearchView) searchViewItem.getActionView(); if (searchView != null) searchView.setIconifiedByDefault(false); return true;// www. j ava2 s .c om }
From source file:org.intermine.app.fragment.TemplatesFragment.java
@Override public void onCreateOptionsMenu(Menu menu, MenuInflater inflater) { super.onCreateOptionsMenu(menu, inflater); inflater.inflate(R.menu.templates_menu, menu); MenuItem menuItem = menu.findItem(R.id.search_action); MenuItemCompat.setOnActionExpandListener(menuItem, this); mSearchView = (SearchView) menuItem.getActionView(); mSearchView.setOnQueryTextListener(this); mSearchView.setQueryHint(getString(R.string.template_search_hint)); }
From source file:quarkstar.android.javainterviewquestions.MainActivity.java
@Override public boolean onCreateOptionsMenu(Menu menu) { MenuInflater inflater = getMenuInflater(); inflater.inflate(R.menu.main, menu); MenuItem searchItem = menu.findItem(R.id.action_search); mSearchView = (SearchView) searchItem.getActionView(); setupSearchView(searchItem);/*from w ww. j a v a 2s. c o m*/ return true; }
From source file:com.krayzk9s.imgurholo.ui.AccountFragment.java
@Override public void onCreateOptionsMenu(Menu menu, MenuInflater inflater) { ImgurHoloActivity activity = (ImgurHoloActivity) getActivity(); if (activity.getApiCall().settings.getString("theme", MainActivity.HOLO_LIGHT) .equals(MainActivity.HOLO_LIGHT)) inflater.inflate(R.menu.main, menu); else//from w w w . j a v a2 s . com inflater.inflate(R.menu.main_dark, menu); menu.findItem(R.id.action_search).setVisible(true); menu.findItem(R.id.action_refresh).setVisible(true); MenuItem searchItem = menu.findItem(R.id.action_search); mSearchView = (SearchView) searchItem.getActionView(); mSearchView.setQueryHint("Lookup Users"); SearchView.OnQueryTextListener queryTextListener = new SearchView.OnQueryTextListener() { @Override public boolean onQueryTextChange(String newText) { // Do nothing return true; } @Override public boolean onQueryTextSubmit(String query) { Log.d("searching", mSearchView.getQuery() + ""); Intent intent = new Intent(); intent.putExtra("username", mSearchView.getQuery().toString()); intent.setAction(ImgurHoloActivity.ACCOUNT_INTENT); intent.addCategory(Intent.CATEGORY_DEFAULT); startActivity(intent); return true; } }; mSearchView.setOnQueryTextListener(queryTextListener); }
From source file:com.google.android.apps.mytracks.util.Api11Adapter.java
@Override public void configureSearchWidget(Activity activity, final MenuItem menuItem) { SearchManager searchManager = (SearchManager) activity.getSystemService(Context.SEARCH_SERVICE); SearchView searchView = (SearchView) menuItem.getActionView(); searchView.setSearchableInfo(searchManager.getSearchableInfo(activity.getComponentName())); searchView.setQueryRefinementEnabled(true); }
From source file:com.jhk.whysoformal.activity.musiclist.fragment.MusicListFragment.java
@Override public void onCreateOptionsMenu(Menu menu, MenuInflater inflater) { super.onCreateOptionsMenu(menu, inflater); inflater.inflate(R.menu.menu_fragment_list_music, menu); MenuItem searchItem = menu.findItem(R.id.list_music_fragment_menu_item_search); SearchView searchView = (SearchView) searchItem.getActionView(); SearchManager searchManager = (SearchManager) getActivity().getSystemService(Context.SEARCH_SERVICE); //SearchableInfo searchInfo = searchManager.getSearchableInfo(getActivity().getComponentName()); //searchView.setSearchableInfo(searchInfo); searchView.setOnQueryTextListener(this); }
From source file:com.numenta.taurus.instance.InstanceListActivity.java
@Override public boolean onCreateOptionsMenu(Menu menu) { boolean res = super.onCreateOptionsMenu(menu); // Get the SearchView and set the searchable configuration MenuItem searchItem = menu.findItem(R.id.menu_search); searchItem.setVisible(true);/*from www.j a va 2s. c o m*/ final SearchView searchView = (SearchView) searchItem.getActionView(); if (searchView != null) { configureSearchView(searchView); } MenuItemCompat.setOnActionExpandListener(searchItem, new MenuItemCompat.OnActionExpandListener() { @Override public boolean onMenuItemActionCollapse(MenuItem item) { ((AnomalyListAdapter) _listFragment.getListAdapter()).sort(); if (_favorites.getCheckedRadioButtonId() == R.id.filter_none) { _listFragment.clearFilter(); } else { _listFragment.filterFavorites(); } _listFragment.showHeaders(true); return true; } public boolean onMenuItemActionExpand(MenuItem item) { ((AnomalyListAdapter) _listFragment.getListAdapter()) .sort(DataUtils.<InstanceAnomalyChartData>getSortByNameComparator()); _listFragment.clearFilter(); _listFragment.showHeaders(false); return true; } }); return res; }
From source file:com.openarc.nirmal.mytrack.ContactActivity.java
private void setupSearchMenu(MenuItem searchItem) { showWaiting(ContactActivity.this); contactView.searchView = (SearchView) searchItem.getActionView(); osmContactTask = new OSMContactTask(ContactActivity.this, contactView); osmContactTask.execute();/*from w w w. j a va2s.c om*/ contactView.searchView.setOnQueryTextListener(this); }
From source file:com.google.transporttracker.TrackerActivity.java
@Override public boolean onCreateOptionsMenu(Menu menu) { // Inflate the menu; this adds items to the action bar if it is present. getMenuInflater().inflate(R.menu.main_activity, menu); // Get the action view used in your toggleservice item final MenuItem toggle = menu.findItem(R.id.menu_switch); mSwitch = (SwitchCompat) toggle.getActionView().findViewById(R.id.switchInActionBar); mSwitch.setEnabled(//from w ww . j av a 2 s . c o m mTransportIdEditText.length() > 0 && mEmailEditText.length() > 0 && mPasswordEditText.length() > 0); mSwitch.setChecked(mStartButton.getVisibility() != View.VISIBLE); mSwitch.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View v) { if (((SwitchCompat) v).isChecked()) { checkInputFields(); } else { confirmStop(); } } }); return super.onCreateOptionsMenu(menu); }
From source file:io.jawg.osmcontributor.ui.activities.TypeListActivity.java
@Override public boolean onCreateOptionsMenu(Menu menu) { getMenuInflater().inflate(R.menu.menu_manage_poi, menu); final MenuItem searchItem = menu.findItem(R.id.action_search); searchView = (SearchView) searchItem.getActionView(); searchView.setOnQueryTextListener(new SearchView.OnQueryTextListener() { @Override/*from w ww . ja v a 2 s . c om*/ public boolean onQueryTextSubmit(String query) { onQueryTextChange(query); return false; } @Override public boolean onQueryTextChange(String newText) { typesAdapter.getFilter().filter(newText); filterConstraint = newText; return true; } }); if (!showingTypes) { searchView.setVisibility(View.GONE); } if (showingTypes && !StringUtils.isEmpty(filterConstraint)) { searchView.setIconified(false); searchView.setQuery(filterConstraint, true); } return true; }