use of android.app.SearchManager in project chefly_android by chef-ly.
the class RecipeListActivity method onCreateOptionsMenu.
@Override
public boolean onCreateOptionsMenu(final Menu menu) {
// Inflate the menu; this adds items to the action bar if it is present.
getMenuInflater().inflate(R.menu.main, menu);
SearchManager searchManager = (SearchManager) getSystemService(Context.SEARCH_SERVICE);
searchView = (SearchView) menu.findItem(R.id.action_search).getActionView();
searchView.setSearchableInfo(searchManager.getSearchableInfo(getComponentName()));
searchView.setSubmitButtonEnabled(false);
ImageView closeButton = (ImageView) searchView.findViewById(R.id.search_close_btn);
closeButton.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
Log.d(TAG, "SearchView -> OnClose --> " + queryString);
menu.findItem(searchView.getId()).collapseActionView();
queryString = "";
server.updateSearch("");
server.setList(serverRecipes, true);
}
});
searchView.setOnQueryTextListener(new SearchView.OnQueryTextListener() {
@Override
public boolean onQueryTextSubmit(String query) {
queryString = query;
server.updateSearch(query);
return false;
}
@Override
public boolean onQueryTextChange(String newText) {
return false;
}
});
return super.onCreateOptionsMenu(menu);
}
use of android.app.SearchManager in project Talon-for-Twitter by klinker24.
the class SearchedTrendsActivity method onCreateOptionsMenu.
@Override
public boolean onCreateOptionsMenu(Menu menu) {
MenuInflater inflater = getMenuInflater();
inflater.inflate(R.menu.search_activity, menu);
// Get the SearchView and set the searchable configuration
SearchManager searchManager = (SearchManager) getSystemService(Context.SEARCH_SERVICE);
searchView = (SearchView) menu.findItem(R.id.menu_search).getActionView();
// Assumes current activity is the searchable activity
searchView.setSearchableInfo(searchManager.getSearchableInfo(getComponentName()));
// Do not iconify the widget; expand it by default
searchView.setIconifiedByDefault(true);
int searchImgId = getResources().getIdentifier("android:id/search_button", null, null);
ImageView view = (ImageView) searchView.findViewById(searchImgId);
view.setImageResource(settings.theme == AppSettings.THEME_LIGHT ? R.drawable.ic_action_search_light : R.drawable.ic_action_search_dark);
return true;
}
use of android.app.SearchManager in project glimmr by brk3.
the class BaseFragment method onCreateOptionsMenu.
@Override
public void onCreateOptionsMenu(Menu menu, MenuInflater inflater) {
menu.clear();
inflater.inflate(R.menu.fragment_main_menu, menu);
SearchManager searchManager = (SearchManager) mActivity.getSystemService(Context.SEARCH_SERVICE);
SearchView searchView = (SearchView) menu.findItem(R.id.menu_search).getActionView();
searchView.setSearchableInfo(searchManager.getSearchableInfo(mActivity.getComponentName()));
if (mOAuth == null || mOAuth.getUser() == null) {
menu.findItem(R.id.menu_login).setVisible(true);
menu.findItem(R.id.menu_logout).setVisible(false);
} else {
menu.findItem(R.id.menu_login).setVisible(false);
menu.findItem(R.id.menu_logout).setVisible(true);
}
}
use of android.app.SearchManager in project AndroidPractice by lguipeng.
the class SearchActivity method onCreateOptionsMenu.
@Override
public boolean onCreateOptionsMenu(Menu menu) {
getMenuInflater().inflate(R.menu.menu_search, menu);
SearchManager searchManager = (SearchManager) getSystemService(Context.SEARCH_SERVICE);
MenuItem searchItem = menu.findItem(R.id.action_search);
searchItem.expandActionView();
SearchView searchView = (SearchView) MenuItemCompat.getActionView(searchItem);
ComponentName componentName = getComponentName();
searchView.setSearchableInfo(searchManager.getSearchableInfo(componentName));
searchView.setOnQueryTextListener(new SearchView.OnQueryTextListener() {
@Override
public boolean onQueryTextSubmit(String s) {
return false;
}
@Override
public boolean onQueryTextChange(String s) {
return false;
}
});
return true;
}
use of android.app.SearchManager in project FlexibleAdapter by davideas.
the class MainActivity method initSearchView.
/* ===========
* SEARCH VIEW
* =========== */
@Override
public void initSearchView(final Menu menu) {
// Associate searchable configuration with the SearchView
Log.d(TAG, "onCreateOptionsMenu setup SearchView!");
SearchManager searchManager = (SearchManager) getSystemService(Context.SEARCH_SERVICE);
MenuItem searchItem = menu.findItem(R.id.action_search);
if (searchItem != null) {
MenuItemCompat.setOnActionExpandListener(searchItem, new MenuItemCompat.OnActionExpandListener() {
@Override
public boolean onMenuItemActionExpand(MenuItem item) {
MenuItem listTypeItem = menu.findItem(R.id.action_list_type);
if (listTypeItem != null)
listTypeItem.setVisible(false);
//hideFab();
return true;
}
@Override
public boolean onMenuItemActionCollapse(MenuItem item) {
MenuItem listTypeItem = menu.findItem(R.id.action_list_type);
if (listTypeItem != null)
listTypeItem.setVisible(true);
//showFab();
return true;
}
});
mSearchView = (SearchView) MenuItemCompat.getActionView(searchItem);
mSearchView.setInputType(InputType.TYPE_TEXT_VARIATION_FILTER);
mSearchView.setImeOptions(EditorInfo.IME_ACTION_DONE | EditorInfo.IME_FLAG_NO_FULLSCREEN);
mSearchView.setQueryHint(getString(R.string.action_search));
mSearchView.setSearchableInfo(searchManager.getSearchableInfo(getComponentName()));
mSearchView.setOnQueryTextListener(this);
}
}
Aggregations