use of android.support.v7.widget.SearchView in project android_packages_apps_GmsCore by microg.
the class PlacePickerActivity method onCreateOptionsMenu.
@Override
public boolean onCreateOptionsMenu(Menu menu) {
super.onCreateOptionsMenu(menu);
MenuInflater inflater = getMenuInflater();
inflater.inflate(R.menu.pick_place, menu);
SearchView searchView = (SearchView) MenuItemCompat.getActionView(menu.findItem(R.id.menu_action_search));
// TODO: search
return true;
}
use of android.support.v7.widget.SearchView in project MaxLock by Maxr1998.
the class AppListFragment method onCreateOptionsMenu.
@Override
public void onCreateOptionsMenu(final Menu menu, MenuInflater inflater) {
inflater.inflate(R.menu.applist_menu, menu);
super.onCreateOptionsMenu(menu, inflater);
menu.setGroupVisible(R.id.menu_group_default, false);
final SearchView searchView = (SearchView) menu.findItem(R.id.toolbar_search).getActionView();
searchView.setOnSearchClickListener(v -> menu.setGroupVisible(R.id.menu_group_hide_on_search, false));
searchView.setOnQueryTextListener(new SearchView.OnQueryTextListener() {
@Override
public boolean onQueryTextSubmit(String s) {
Util.hideKeyboardFromWindow(getActivity(), searchView);
return true;
}
@Override
public boolean onQueryTextChange(String s) {
mAdapter.getFilter().filter(s);
return true;
}
});
searchView.setOnCloseListener(() -> {
menu.setGroupVisible(R.id.menu_group_hide_on_search, true);
return false;
});
filterIcon(menu.findItem(R.id.toolbar_filter_activated));
menu.findItem(R.id.toolbar_load_all).setTitle(LOAD_ALL ? R.string.menu_only_openable : R.string.menu_all_apps);
}
use of android.support.v7.widget.SearchView in project fuckView by w568w.
the class MainActivity method onCreateOptionsMenu.
@Override
public boolean onCreateOptionsMenu(Menu menu) {
getMenuInflater().inflate(R.menu.main, menu);
final MenuItem item = menu.findItem(R.id.action_search);
SearchView mSearchView = (SearchView) MenuItemCompat.getActionView(item);
mSearchView.setIconifiedByDefault(true);
mSearchView.setOnQueryTextListener(new SearchView.OnQueryTextListener() {
@Override
public boolean onQueryTextSubmit(String query) {
return false;
}
@Override
public boolean onQueryTextChange(String newText) {
if (shouldShowFAQ) {
((Searchable) currentFragment).setSearchText(newText);
}
return true;
}
});
return super.onCreateOptionsMenu(menu);
}
use of android.support.v7.widget.SearchView in project ForPDA by RadiationX.
the class AnnounceFragment method addSearchOnPageItem.
private void addSearchOnPageItem(Menu menu) {
toolbar.inflateMenu(R.menu.theme_search_menu);
MenuItem searchOnPageMenuItem = menu.findItem(R.id.action_search);
searchOnPageMenuItem.setShowAsActionFlags(MenuItem.SHOW_AS_ACTION_ALWAYS);
SearchView searchView = (SearchView) searchOnPageMenuItem.getActionView();
searchView.setTag(searchViewTag);
searchView.setOnSearchClickListener(v -> {
if (searchView.getTag().equals(searchViewTag)) {
ImageView searchClose = (ImageView) searchView.findViewById(android.support.v7.appcompat.R.id.search_close_btn);
if (searchClose != null)
((ViewGroup) searchClose.getParent()).removeView(searchClose);
ViewGroup.LayoutParams navButtonsParams = new ViewGroup.LayoutParams(App.px48, App.px48);
TypedValue outValue = new TypedValue();
getContext().getTheme().resolveAttribute(android.R.attr.actionBarItemBackground, outValue, true);
AppCompatImageButton btnNext = new AppCompatImageButton(searchView.getContext());
btnNext.setImageDrawable(App.getVecDrawable(getContext(), R.drawable.ic_toolbar_search_next));
btnNext.setBackgroundResource(outValue.resourceId);
AppCompatImageButton btnPrev = new AppCompatImageButton(searchView.getContext());
btnPrev.setImageDrawable(App.getVecDrawable(getContext(), R.drawable.ic_toolbar_search_prev));
btnPrev.setBackgroundResource(outValue.resourceId);
((LinearLayout) searchView.getChildAt(0)).addView(btnPrev, navButtonsParams);
((LinearLayout) searchView.getChildAt(0)).addView(btnNext, navButtonsParams);
btnNext.setOnClickListener(v1 -> findNext(true));
btnPrev.setOnClickListener(v1 -> findNext(false));
searchViewTag++;
}
});
SearchManager searchManager = (SearchManager) getMainActivity().getSystemService(Context.SEARCH_SERVICE);
if (null != searchManager) {
searchView.setSearchableInfo(searchManager.getSearchableInfo(getMainActivity().getComponentName()));
}
searchView.setIconifiedByDefault(true);
searchView.setOnQueryTextListener(new SearchView.OnQueryTextListener() {
@Override
public boolean onQueryTextSubmit(String query) {
return false;
}
@Override
public boolean onQueryTextChange(String newText) {
findText(newText);
return false;
}
});
}
use of android.support.v7.widget.SearchView in project ForPDA by RadiationX.
the class ForumRulesFragment method addSearchOnPageItem.
private void addSearchOnPageItem(Menu menu) {
toolbar.inflateMenu(R.menu.theme_search_menu);
MenuItem searchOnPageMenuItem = menu.findItem(R.id.action_search);
searchOnPageMenuItem.setShowAsActionFlags(MenuItem.SHOW_AS_ACTION_ALWAYS);
/*MenuItemCompat.setOnActionExpandListener(searchOnPageMenuItem, new MenuItemCompat.OnActionExpandListener() {
@Override
public boolean onMenuItemActionCollapse(MenuItem item) {
toggleMessagePanelItem.setShowAsActionFlags(MenuItem.SHOW_AS_ACTION_ALWAYS);
return true;
}
@Override
public boolean onMenuItemActionExpand(MenuItem item) {
toggleMessagePanelItem.setShowAsActionFlags(MenuItem.SHOW_AS_ACTION_NEVER);
return true;
}
});*/
SearchView searchView = (SearchView) searchOnPageMenuItem.getActionView();
searchView.setTag(searchViewTag);
searchView.setOnSearchClickListener(v -> {
if (searchView.getTag().equals(searchViewTag)) {
ImageView searchClose = (ImageView) searchView.findViewById(android.support.v7.appcompat.R.id.search_close_btn);
if (searchClose != null)
((ViewGroup) searchClose.getParent()).removeView(searchClose);
ViewGroup.LayoutParams navButtonsParams = new ViewGroup.LayoutParams(App.px48, App.px48);
TypedValue outValue = new TypedValue();
getContext().getTheme().resolveAttribute(android.R.attr.actionBarItemBackground, outValue, true);
AppCompatImageButton btnNext = new AppCompatImageButton(searchView.getContext());
btnNext.setImageDrawable(App.getVecDrawable(getContext(), R.drawable.ic_toolbar_search_next));
btnNext.setBackgroundResource(outValue.resourceId);
AppCompatImageButton btnPrev = new AppCompatImageButton(searchView.getContext());
btnPrev.setImageDrawable(App.getVecDrawable(getContext(), R.drawable.ic_toolbar_search_prev));
btnPrev.setBackgroundResource(outValue.resourceId);
((LinearLayout) searchView.getChildAt(0)).addView(btnPrev, navButtonsParams);
((LinearLayout) searchView.getChildAt(0)).addView(btnNext, navButtonsParams);
btnNext.setOnClickListener(v1 -> findNext(true));
btnPrev.setOnClickListener(v1 -> findNext(false));
searchViewTag++;
}
});
SearchManager searchManager = (SearchManager) getMainActivity().getSystemService(Context.SEARCH_SERVICE);
if (null != searchManager) {
searchView.setSearchableInfo(searchManager.getSearchableInfo(getMainActivity().getComponentName()));
}
searchView.setIconifiedByDefault(true);
searchView.setOnQueryTextListener(new SearchView.OnQueryTextListener() {
@Override
public boolean onQueryTextSubmit(String query) {
return false;
}
@Override
public boolean onQueryTextChange(String newText) {
findText(newText);
return false;
}
});
}
Aggregations