Search in sources :

Example 1 with NominatimPoiFilter

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());
        }
    }
}
Also used : NominatimPoiFilter(net.osmand.plus.poi.NominatimPoiFilter) AbstractPoiType(net.osmand.osm.AbstractPoiType) PoiType(net.osmand.osm.PoiType) ResourceManager(net.osmand.plus.resources.ResourceManager) AbstractPoiType(net.osmand.osm.AbstractPoiType) PoiUIFilter(net.osmand.plus.poi.PoiUIFilter)

Aggregations

AbstractPoiType (net.osmand.osm.AbstractPoiType)1 PoiType (net.osmand.osm.PoiType)1 NominatimPoiFilter (net.osmand.plus.poi.NominatimPoiFilter)1 PoiUIFilter (net.osmand.plus.poi.PoiUIFilter)1 ResourceManager (net.osmand.plus.resources.ResourceManager)1