use of net.osmand.plus.poi.NominatimPoiFilter in project Osmand by osmandapp.
the class SearchPoiFilterFragment method onListItemClick.
@Override
public void onListItemClick(ListView listView, View v, int position, long id) {
final Object item = getListAdapter().getItem(position);
ResourceManager rm = getApp().getResourceManager();
if (!rm.containsAmenityRepositoryToSearch(false)) {
Toast.makeText(getActivity(), R.string.data_to_search_poi_not_available, Toast.LENGTH_LONG);
return;
}
if (item instanceof PoiUIFilter) {
PoiUIFilter model = ((PoiUIFilter) item);
if (PoiUIFilter.BY_NAME_FILTER_ID.equals(model.getFilterId()) || model instanceof NominatimPoiFilter) {
model.setFilterByName(searchEditText.getText().toString());
} else {
model.setFilterByName(model.getSavedFilterByName());
}
showFilterActivity(model.getFilterId());
} else {
PoiUIFilter custom = getApp().getPoiFilters().getFilterById(PoiUIFilter.STD_PREFIX + ((AbstractPoiType) item).getKeyName());
if (custom != null) {
if (item instanceof PoiType && ((PoiType) item).isAdditional()) {
// it is already set
} else {
custom.setFilterByName(null);
}
custom.clearFilter();
custom.updateTypesToAccept(((AbstractPoiType) item));
showFilterActivity(custom.getFilterId());
}
}
}
Aggregations