use of android.widget.SearchView in project osm-contributor by jawg.
the class TypeListActivity method onCreateOptionsMenu.
@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
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;
}
use of android.widget.SearchView in project AnExplorer by 1hakr.
the class StandaloneActivity method onCreateOptionsMenu.
@Override
public boolean onCreateOptionsMenu(Menu menu) {
super.onCreateOptionsMenu(menu);
getMenuInflater().inflate(R.menu.activity, menu);
for (int i = 0; i < menu.size(); i++) {
final MenuItem item = menu.getItem(i);
switch(item.getItemId()) {
default:
item.setShowAsAction(MenuItem.SHOW_AS_ACTION_ALWAYS);
}
}
final MenuItem searchMenu = menu.findItem(R.id.menu_search);
mSearchView = (SearchView) searchMenu.getActionView();
mSearchView.setOnQueryTextListener(new OnQueryTextListener() {
@Override
public boolean onQueryTextSubmit(String query) {
mSearchExpanded = true;
mState.currentSearch = query;
mSearchView.clearFocus();
onCurrentDirectoryChanged(ANIM_NONE);
return true;
}
@Override
public boolean onQueryTextChange(String newText) {
return false;
}
});
searchMenu.setOnActionExpandListener(new OnActionExpandListener() {
@Override
public boolean onMenuItemActionExpand(MenuItem item) {
mSearchExpanded = true;
updateActionBar();
return true;
}
@Override
public boolean onMenuItemActionCollapse(MenuItem item) {
mSearchExpanded = false;
if (mIgnoreNextCollapse) {
mIgnoreNextCollapse = false;
return true;
}
mState.currentSearch = null;
onCurrentDirectoryChanged(ANIM_NONE);
return true;
}
});
mSearchView.setOnCloseListener(new SearchView.OnCloseListener() {
@Override
public boolean onClose() {
mSearchExpanded = false;
if (mIgnoreNextClose) {
mIgnoreNextClose = false;
return false;
}
mState.currentSearch = null;
onCurrentDirectoryChanged(ANIM_NONE);
return false;
}
});
return true;
}
use of android.widget.SearchView in project SeniorProject by 5731075221-PM.
the class HospitalNearbyFragment method onCreateView.
@Override
public View onCreateView(LayoutInflater inflater, @Nullable ViewGroup container, @Nullable Bundle savedInstanceState) {
View view = inflater.inflate(R.layout.fragment_hospital_nearby, container, false);
appBarLayout.setExpanded(true, true);
// searchView = (SearchView) view.findViewById(R.id.searchNearbyHospital);
// searchView.setIconifiedByDefault(false);
// searchView.setIconified(false);
// searchView.clearFocus();
// searchView.setQueryHint("ค้นหา");
// searchView.setOnQueryTextListener(this);
title = getActivity().findViewById(R.id.textTool);
title.setText("ค้นหาโรงพยาบาลใกล้เคียง");
recyclerView = (RecyclerView) view.findViewById(R.id.nearbyHospitalRecyclerView);
recyclerView.setLayoutManager(new LinearLayoutManager(getActivity()));
adapter = new RecyclerViewAdapter(hosList);
recyclerView.setAdapter(adapter);
recyclerView.addItemDecoration(new DividerItemDecoration(getActivity(), DividerItemDecoration.VERTICAL));
adapter.setOnLoadMoreListener(new LoadMore() {
@Override
public void onLoadMore() {
if (hosList.size() <= hospitalList.size()) {
isLoading = true;
hosList.add(null);
adapter.notifyItemInserted(hosList.size() - 1);
new Handler().postDelayed(new Runnable() {
@Override
public void run() {
hosList.remove(hosList.size() - 1);
adapter.notifyItemRemoved(hosList.size());
// Generating more data
int index = hosList.size();
int end = index + 10;
for (int i = index; i < end; i++) {
hosList.add(hospitalList.get(i));
}
if (isGPS && isNetwork)
sortHospital();
adapter.notifyDataSetChanged();
isLoading = false;
// adapter.setLoaded();
}
}, 5000);
} else {
Toast.makeText(getActivity(), "Loading data completed", Toast.LENGTH_SHORT).show();
}
}
});
return view;
}
use of android.widget.SearchView in project SeniorProject by 5731075221-PM.
the class SearchSymptomFragment method onCreateView.
@Nullable
@Override
public View onCreateView(LayoutInflater inflater, @Nullable ViewGroup container, Bundle savedInstanceState) {
View view = inflater.inflate(R.layout.fragment_search_symptom, container, false);
appBarLayout.setExpanded(true, true);
empty = (TextView) view.findViewById(R.id.textEmpty);
if (diseaseName.isEmpty())
empty.setVisibility(View.VISIBLE);
else
empty.setVisibility(View.INVISIBLE);
searchView = (SearchView) view.findViewById(R.id.searchSymptom);
searchView.setIconifiedByDefault(false);
searchView.setIconified(false);
searchView.clearFocus();
searchView.setQueryHint("ค้นหา");
searchView.setOnQueryTextListener(this);
recyclerView = (RecyclerView) view.findViewById(R.id.searchSymptomList);
recyclerView.setAdapter(adapter);
recyclerView.addItemDecoration(new DividerItemDecoration(getActivity(), DividerItemDecoration.VERTICAL));
conslayout = (ConstraintLayout) view.findViewById(R.id.searchSymptomLayout);
empty.setOnTouchListener(new View.OnTouchListener() {
@Override
public boolean onTouch(View view, MotionEvent motionEvent) {
InputMethodManager imm = (InputMethodManager) getActivity().getSystemService(INPUT_METHOD_SERVICE);
imm.hideSoftInputFromWindow(getActivity().getCurrentFocus().getWindowToken(), 0);
return true;
}
});
return view;
}
use of android.widget.SearchView in project SeniorProject by 5731075221-PM.
the class ShowHospitalByOrder method onCreateView.
@Nullable
@Override
public View onCreateView(LayoutInflater inflater, @Nullable ViewGroup container, @Nullable Bundle savedInstanceState) {
View view = inflater.inflate(R.layout.fragment_show_by_order, container, false);
// searchView = (SearchView) view.findViewById(R.id.searchHospitalByOrder);
// searchView.setIconifiedByDefault(false);
// searchView.setIconified(false);
// searchView.clearFocus();
// searchView.setQueryHint("ค้นหา");
// searchView.setOnQueryTextListener(this);
recyclerView = (IndexFastScrollRecyclerView) view.findViewById(R.id.searchHospitalList);
recyclerView.setAdapter(adapter);
recyclerView.addItemDecoration(new DividerItemDecoration(getActivity(), DividerItemDecoration.VERTICAL));
recyclerView.setIndexBarColor("#f9f9f9");
recyclerView.setIndexBarTextColor("#4d4d4d");
recyclerView.setIndexBarHighLateTextVisibility(true);
recyclerView.setIndexbarHighLateTextColor("#4cd29f");
return view;
}
Aggregations