Add city part to every street and fix search

This commit is contained in:
Victor Shcherb 2013-02-09 16:22:35 +01:00
parent 072d0d4ef1
commit d4891ff4e4

View file

@ -78,7 +78,8 @@ public class SearchStreetByNameActivity extends SearchByNameAbstractActivity<Str
if (namesFilter.isCancelled) { if (namesFilter.isCancelled) {
break; break;
} }
if (emptyQuery || CollatorStringMatcher.cmatches(collator, getText(obj), query, StringMatcherMode.CHECK_ONLY_STARTS_WITH)) { if (emptyQuery || CollatorStringMatcher.cmatches(collator, obj.getNameWithoutCityPart(region.useEnglishNames()),
query, StringMatcherMode.CHECK_ONLY_STARTS_WITH)) {
Message msg = uiHandler.obtainMessage(MESSAGE_ADD_ENTITY, obj); Message msg = uiHandler.obtainMessage(MESSAGE_ADD_ENTITY, obj);
msg.sendToTarget(); msg.sendToTarget();
} }
@ -88,7 +89,7 @@ public class SearchStreetByNameActivity extends SearchByNameAbstractActivity<Str
if (namesFilter.isCancelled) { if (namesFilter.isCancelled) {
break; break;
} }
if (CollatorStringMatcher.cmatches(collator, getText(obj), query, StringMatcherMode.CHECK_STARTS_FROM_SPACE_NOT_BEGINNING)) { if (CollatorStringMatcher.cmatches(collator, obj.getNameWithoutCityPart(region.useEnglishNames()), query, StringMatcherMode.CHECK_STARTS_FROM_SPACE_NOT_BEGINNING)) {
Message msg = uiHandler.obtainMessage(MESSAGE_ADD_ENTITY, obj); Message msg = uiHandler.obtainMessage(MESSAGE_ADD_ENTITY, obj);
msg.sendToTarget(); msg.sendToTarget();
} }
@ -101,6 +102,7 @@ public class SearchStreetByNameActivity extends SearchByNameAbstractActivity<Str
return obj.getName(region.useEnglishNames()); return obj.getName(region.useEnglishNames());
} }
@Override @Override
public void itemSelected(Street obj) { public void itemSelected(Street obj) {
settings.setLastSearchedStreet(obj.getName(region.useEnglishNames()), obj.getLocation()); settings.setLastSearchedStreet(obj.getName(region.useEnglishNames()), obj.getLocation());