List of usage examples for android.widget SearchView setQueryRefinementEnabled
public void setQueryRefinementEnabled(boolean enable)
From source file:com.conferenceengineer.android.iosched.ui.phone.SessionsActivity.java
@TargetApi(Build.VERSION_CODES.HONEYCOMB) @Override//from w w w. ja va 2 s.c om public boolean onCreateOptionsMenu(Menu menu) { super.onCreateOptionsMenu(menu); getMenuInflater().inflate(R.menu.search, menu); MenuItem searchItem = menu.findItem(R.id.menu_search); if (searchItem != null && UIUtils.hasHoneycomb()) { SearchView searchView = (SearchView) searchItem.getActionView(); if (searchView != null) { SearchManager searchManager = (SearchManager) getSystemService(SEARCH_SERVICE); searchView.setSearchableInfo(searchManager.getSearchableInfo(getComponentName())); searchView.setQueryRefinementEnabled(true); } } return true; }
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:org.transdroid.core.gui.search.SearchActivity.java
@Override public boolean onCreateOptionsMenu(Menu menu) { super.onCreateOptionsMenu(menu); // Manually insert the actions into the main torrent and secondary actions toolbars searchToolbar.inflateMenu(R.menu.activity_search); // Add an expandable SearchView to the action bar MenuItem item = menu.findItem(R.id.action_search); final SearchView searchView = new SearchView(getSupportActionBar().getThemedContext()); searchView.setSearchableInfo(searchManager.getSearchableInfo(getComponentName())); searchView.setQueryRefinementEnabled(true); searchView.setIconified(false);/*from ww w. ja v a2 s.c o m*/ searchView.setIconifiedByDefault(false); MenuItemCompat.setActionView(item, searchView); searchMenu = item; return true; }
From source file:com.conferenceengineer.android.iosched.ui.SearchActivity.java
@Override @TargetApi(Build.VERSION_CODES.HONEYCOMB) public boolean onCreateOptionsMenu(Menu menu) { super.onCreateOptionsMenu(menu); getMenuInflater().inflate(R.menu.search, menu); final MenuItem searchItem = menu.findItem(R.id.menu_search); if (searchItem != null && UIUtils.hasHoneycomb()) { SearchView searchView = (SearchView) searchItem.getActionView(); if (searchView != null) { SearchManager searchManager = (SearchManager) getSystemService(SEARCH_SERVICE); searchView.setSearchableInfo(searchManager.getSearchableInfo(getComponentName())); searchView.setQueryRefinementEnabled(true); searchView.setOnQueryTextListener(new SearchView.OnQueryTextListener() { @Override//from w w w . ja va2 s.c o m public boolean onQueryTextSubmit(String s) { ReflectionUtils.tryInvoke(searchItem, "collapseActionView"); return false; } @Override public boolean onQueryTextChange(String s) { return false; } }); searchView.setOnSuggestionListener(new SearchView.OnSuggestionListener() { @Override public boolean onSuggestionSelect(int i) { return false; } @Override public boolean onSuggestionClick(int i) { ReflectionUtils.tryInvoke(searchItem, "collapseActionView"); return false; } }); } } return true; }
From source file:com.example.snowball.MainActivity.java
@Override public boolean onCreateOptionsMenu(Menu menu) { MenuInflater inflater = getMenuInflater(); inflater.inflate(R.menu.main, menu); MenuItem searchItem = menu.findItem(R.id.action_websearch); SearchView searchView = (SearchView) searchItem.getActionView(); searchView.setQueryHint("///"); searchView.setQueryRefinementEnabled(false); // SearchView return super.onCreateOptionsMenu(menu); }
From source file:com.gdgdevfest.android.apps.devfestbcn.ui.HomeActivity.java
@TargetApi(Build.VERSION_CODES.HONEYCOMB) @Override/* w w w . jav a2s.c o m*/ public boolean onCreateOptionsMenu(Menu menu) { super.onCreateOptionsMenu(menu); mOptionsMenu = menu; getMenuInflater().inflate(R.menu.home, menu); MenuItem searchItem = menu.findItem(R.id.menu_search); if (searchItem != null && UIUtils.hasHoneycomb()) { SearchView searchView = (SearchView) searchItem.getActionView(); if (searchView != null) { SearchManager searchManager = (SearchManager) getSystemService(SEARCH_SERVICE); searchView.setSearchableInfo(searchManager.getSearchableInfo(getComponentName())); searchView.setQueryRefinementEnabled(true); } } return true; }
From source file:com.conferenceengineer.android.iosched.ui.tablet.SessionsSandboxMultiPaneActivity.java
@Override public boolean onCreateOptionsMenu(Menu menu) { super.onCreateOptionsMenu(menu); getMenuInflater().inflate(R.menu.search, menu); MenuItem searchItem = menu.findItem(R.id.menu_search); if (searchItem != null && UIUtils.hasHoneycomb()) { SearchView searchView = (SearchView) searchItem.getActionView(); if (searchView != null) { SearchManager searchManager = (SearchManager) getSystemService(SEARCH_SERVICE); searchView.setSearchableInfo(searchManager.getSearchableInfo(getComponentName())); searchView.setQueryRefinementEnabled(true); }/*w w w. j a v a2s .c o m*/ } return true; }
From source file:ua.org.gdg.devfest.iosched.ui.HomeActivity.java
@TargetApi(Build.VERSION_CODES.HONEYCOMB) @Override//from w w w . ja v a 2 s . c o m public boolean onCreateOptionsMenu(Menu menu) { super.onCreateOptionsMenu(menu); mOptionsMenu = menu; getMenuInflater().inflate(R.menu.home, menu); MenuItem searchItem = menu.findItem(R.id.menu_search); if (searchItem != null && UIUtils.hasHoneycomb()) { SearchView searchView = (SearchView) searchItem.getActionView(); if (searchView != null) { SearchManager searchManager = (SearchManager) getSystemService(SEARCH_SERVICE); searchView.setSearchableInfo(searchManager.getSearchableInfo(getComponentName())); searchView.setQueryRefinementEnabled(true); } } return true; }
From source file:com.conferenceengineer.android.iosched.ui.HomeActivity.java
@TargetApi(Build.VERSION_CODES.HONEYCOMB) @Override//from ww w . ja v a2 s . c om public boolean onCreateOptionsMenu(Menu menu) { super.onCreateOptionsMenu(menu); mOptionsMenu = menu; getMenuInflater().inflate(R.menu.home, menu); MenuItem searchItem = menu.findItem(R.id.menu_search); if (searchItem != null && UIUtils.hasHoneycomb()) { SearchView searchView = (SearchView) searchItem.getActionView(); if (searchView != null) { SearchManager searchManager = (SearchManager) getSystemService(SEARCH_SERVICE); searchView.setSearchableInfo(searchManager.getSearchableInfo(getComponentName())); searchView.setQueryRefinementEnabled(true); } } if (!getResources().getBoolean(R.bool.has_conference_feedback_enabled)) { menu.removeItem(R.id.menu_feedback); } return true; }
From source file:in.rab.ordboken.Ordboken.java
public SearchView initSearchView(Activity activity, Menu menu, String query, Boolean focus) { SearchManager searchManager = (SearchManager) activity.getSystemService(Context.SEARCH_SERVICE); SearchView searchView = (SearchView) activity.findViewById(R.id.mySearchView); searchView.setSearchableInfo(//from ww w .j av a 2 s.c om searchManager.getSearchableInfo(new ComponentName(activity, MainActivity.class))); // Hack to get the magnifying glass icon inside the EditText searchView.setIconifiedByDefault(true); searchView.setIconified(false); // Hack to get rid of the collapse button searchView.onActionViewExpanded(); if (!focus) { searchView.clearFocus(); } // searchView.setSubmitButtonEnabled(true); searchView.setQueryRefinementEnabled(true); if (query != null) { searchView.setQuery(query, false); } return searchView; }