Fix #6021
This commit is contained in:
parent
0becec1231
commit
4b829182cd
3 changed files with 16 additions and 12 deletions
|
@ -106,8 +106,8 @@ public class MapPoiTypes {
|
|||
return textPoiAdditionals;
|
||||
}
|
||||
|
||||
public List<PoiFilter> getTopVisibleFilters() {
|
||||
List<PoiFilter> lf = new ArrayList<PoiFilter>();
|
||||
public List<AbstractPoiType> getTopVisibleFilters() {
|
||||
List<AbstractPoiType> lf = new ArrayList<AbstractPoiType>();
|
||||
for (PoiCategory pc : categories) {
|
||||
if (pc.isTopVisible()) {
|
||||
lf.add(pc);
|
||||
|
@ -117,17 +117,21 @@ public class MapPoiTypes {
|
|||
lf.add(p);
|
||||
}
|
||||
}
|
||||
for (PoiType p : pc.getPoiTypes()) {
|
||||
if (p.isTopVisible()) {
|
||||
lf.add(p);
|
||||
}
|
||||
}
|
||||
}
|
||||
sortList(lf);
|
||||
return lf;
|
||||
}
|
||||
|
||||
|
||||
private void sortList(List<? extends PoiFilter> lf) {
|
||||
private void sortList(List<? extends AbstractPoiType> lf) {
|
||||
final Collator instance = Collator.getInstance();
|
||||
Collections.sort(lf, new Comparator<PoiFilter>() {
|
||||
Collections.sort(lf, new Comparator<AbstractPoiType>() {
|
||||
@Override
|
||||
public int compare(PoiFilter object1, PoiFilter object2) {
|
||||
public int compare(AbstractPoiType object1, AbstractPoiType object2) {
|
||||
return instance.compare(object1.getTranslation(), object2.getTranslation());
|
||||
}
|
||||
});
|
||||
|
@ -603,6 +607,7 @@ public class MapPoiTypes {
|
|||
tp.setNameTag(parser.getAttributeValue("", "name_tag"));
|
||||
tp.setRelation("true".equals(parser.getAttributeValue("", "relation")));
|
||||
tp.setNotEditableOsm("true".equals(parser.getAttributeValue("", "no_edit")));
|
||||
tp.setTopVisible(Boolean.parseBoolean(parser.getAttributeValue("", "top")));
|
||||
if (lastFilter != null) {
|
||||
lastFilter.addPoiType(tp);
|
||||
}
|
||||
|
@ -699,8 +704,8 @@ public class MapPoiTypes {
|
|||
DEFAULT_INSTANCE.init();
|
||||
// print(DEFAULT_INSTANCE) ;
|
||||
// System.out.println("-----------------");
|
||||
List<PoiFilter> lf = DEFAULT_INSTANCE.getTopVisibleFilters();
|
||||
for (PoiFilter l : lf) {
|
||||
List<AbstractPoiType> lf = DEFAULT_INSTANCE.getTopVisibleFilters();
|
||||
for (AbstractPoiType l : lf) {
|
||||
System.out.println("----------------- " + l.getKeyName());
|
||||
// print("", l);
|
||||
Map<PoiCategory, LinkedHashSet<String>> m =
|
||||
|
|
|
@ -648,7 +648,7 @@ public class SearchCoreFactory {
|
|||
public static class SearchAmenityTypesAPI extends SearchBaseAPI {
|
||||
|
||||
private Map<String, PoiType> translatedNames = new LinkedHashMap<>();
|
||||
private List<PoiFilter> topVisibleFilters;
|
||||
private List<AbstractPoiType> topVisibleFilters;
|
||||
private List<PoiCategory> categories;
|
||||
private List<CustomSearchPoiFilter> customPoiFilters = new ArrayList<>();
|
||||
private TIntArrayList customPoiFiltersPriorites = new TIntArrayList();
|
||||
|
@ -697,7 +697,7 @@ public class SearchCoreFactory {
|
|||
List<AbstractPoiType> results = new ArrayList<AbstractPoiType>();
|
||||
NameStringMatcher nm =
|
||||
new NameStringMatcher(phrase.getUnknownSearchPhrase(), StringMatcherMode.CHECK_ONLY_STARTS_WITH_TRIM);
|
||||
for (PoiFilter pf : topVisibleFilters) {
|
||||
for (AbstractPoiType pf : topVisibleFilters) {
|
||||
if (!phrase.isUnknownSearchWordPresent()
|
||||
|| nm.matches(pf.getTranslation())
|
||||
|| nm.matches(pf.getEnTranslation())
|
||||
|
|
|
@ -5,7 +5,6 @@ import android.support.annotation.NonNull;
|
|||
import net.osmand.osm.AbstractPoiType;
|
||||
import net.osmand.osm.MapPoiTypes;
|
||||
import net.osmand.osm.PoiCategory;
|
||||
import net.osmand.osm.PoiFilter;
|
||||
import net.osmand.osm.PoiType;
|
||||
import net.osmand.plus.OsmandApplication;
|
||||
import net.osmand.plus.R;
|
||||
|
@ -232,7 +231,7 @@ public class PoiFiltersHelper {
|
|||
}
|
||||
// default
|
||||
MapPoiTypes poiTypes = application.getPoiTypes();
|
||||
for (PoiFilter t : poiTypes.getTopVisibleFilters()) {
|
||||
for (AbstractPoiType t : poiTypes.getTopVisibleFilters()) {
|
||||
PoiUIFilter f = new PoiUIFilter(t, application, "");
|
||||
top.add(f);
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue