use of net.osmand.plus.resources.RegionAddressRepository in project Osmand by osmandapp.
the class QuickSearchDialogFragment method completeQueryWithObject.
public void completeQueryWithObject(SearchResult sr) {
if (sr.object instanceof PoiType && ((PoiType) sr.object).isAdditional()) {
PoiType additional = (PoiType) sr.object;
AbstractPoiType parent = additional.getParentType();
if (parent != null) {
PoiUIFilter custom = app.getPoiFilters().getFilterById(PoiUIFilter.STD_PREFIX + parent.getKeyName());
if (custom != null) {
custom.clearFilter();
custom.updateTypesToAccept(parent);
custom.setFilterByName(additional.getKeyName().replace('_', ':').toLowerCase());
SearchPhrase phrase = searchUICore.getPhrase();
sr = new SearchResult(phrase);
sr.localeName = custom.getName();
sr.object = custom;
sr.priority = SEARCH_AMENITY_TYPE_PRIORITY;
sr.priorityDistance = 0;
sr.objectType = ObjectType.POI_TYPE;
}
}
}
searchUICore.selectSearchResult(sr);
if (addressSearch) {
startAddressSearch();
if (sr.objectType == ObjectType.CITY) {
if (sr.relatedObject != null && sr.relatedObject instanceof BinaryMapIndexReader) {
File f = ((BinaryMapIndexReader) sr.relatedObject).getFile();
if (f != null) {
RegionAddressRepository region = app.getResourceManager().getRegionRepository(f.getName());
if (region != null) {
app.getSettings().setLastSearchedRegion(region.getFileName(), region.getEstimatedRegionCenter());
City city = (City) sr.object;
app.getSettings().setLastSearchedCity(city.getId(), sr.localeName, city.getLocation());
}
}
}
}
}
String txt = searchUICore.getPhrase().getText(true);
replaceQueryWithText(txt);
if (sr.objectType == ObjectType.CITY) {
openKeyboard();
}
}
Aggregations