Fix #4027
This commit is contained in:
parent
1c1a6d869b
commit
8268caaf35
2 changed files with 16 additions and 11 deletions
|
@ -1,5 +1,7 @@
|
|||
package net.osmand.plus.poi;
|
||||
|
||||
import android.support.annotation.NonNull;
|
||||
|
||||
import net.osmand.osm.AbstractPoiType;
|
||||
import net.osmand.osm.MapPoiTypes;
|
||||
import net.osmand.osm.PoiCategory;
|
||||
|
@ -12,15 +14,9 @@ import net.osmand.plus.api.SQLiteAPI.SQLiteCursor;
|
|||
import net.osmand.plus.api.SQLiteAPI.SQLiteStatement;
|
||||
import net.osmand.util.Algorithms;
|
||||
|
||||
import android.support.annotation.NonNull;
|
||||
import android.util.ArraySet;
|
||||
|
||||
import java.lang.reflect.Array;
|
||||
import java.text.Collator;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Arrays;
|
||||
import java.util.Collections;
|
||||
import java.util.Comparator;
|
||||
import java.util.HashSet;
|
||||
import java.util.Iterator;
|
||||
import java.util.LinkedHashMap;
|
||||
|
@ -198,7 +194,7 @@ public class PoiFiltersHelper {
|
|||
}
|
||||
|
||||
public List<PoiUIFilter> getTopDefinedPoiFilters() {
|
||||
if (cacheTopStandardFilters == null) {
|
||||
// if (cacheTopStandardFilters == null) {
|
||||
List<PoiUIFilter> top = new ArrayList<PoiUIFilter>();
|
||||
// user defined
|
||||
top.addAll(getUserDefinedPoiFilters());
|
||||
|
@ -213,7 +209,7 @@ public class PoiFiltersHelper {
|
|||
}
|
||||
Collections.sort(top);
|
||||
cacheTopStandardFilters = top;
|
||||
}
|
||||
// }
|
||||
List<PoiUIFilter> result = new ArrayList<PoiUIFilter>();
|
||||
result.addAll(cacheTopStandardFilters);
|
||||
result.add(getShowAllPOIFilter());
|
||||
|
|
|
@ -26,7 +26,6 @@ import net.osmand.util.OpeningHoursParser;
|
|||
import net.osmand.util.OpeningHoursParser.OpeningHours;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.Arrays;
|
||||
import java.util.Calendar;
|
||||
import java.util.Collections;
|
||||
import java.util.HashMap;
|
||||
|
@ -261,7 +260,7 @@ public class PoiUIFilter implements SearchPoiTypeFilter, Comparable<PoiUIFilter>
|
|||
}
|
||||
}
|
||||
}
|
||||
List<Amenity> amenities = searchAmenitiesInternal(top / 2 + bottom / 2, left / 2 + right / 2,
|
||||
List<Amenity> amenities = searchAmenitiesInternal(top / 2 + bottom / 2, left / 2 + right / 2,
|
||||
top, bottom, left, right, zoom, matcher);
|
||||
results.addAll(amenities);
|
||||
return results;
|
||||
|
@ -573,10 +572,20 @@ public class PoiUIFilter implements SearchPoiTypeFilter, Comparable<PoiUIFilter>
|
|||
}
|
||||
|
||||
public void combineWithPoiFilter(PoiUIFilter f) {
|
||||
acceptedTypes.putAll(f.acceptedTypes);
|
||||
putAllAcceptedTypes(f.acceptedTypes);
|
||||
poiAdditionals.putAll(f.poiAdditionals);
|
||||
}
|
||||
|
||||
private void putAllAcceptedTypes(Map<PoiCategory, LinkedHashSet<String>> types) {
|
||||
for (PoiCategory category : types.keySet()) {
|
||||
if (acceptedTypes.containsKey(category)) {
|
||||
acceptedTypes.get(category).addAll(types.get(category));
|
||||
} else {
|
||||
acceptedTypes.put(category, types.get(category));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public void combineWithPoiFilters(Set<PoiUIFilter> filters) {
|
||||
for (PoiUIFilter f : filters) {
|
||||
combineWithPoiFilter(f);
|
||||
|
|
Loading…
Reference in a new issue