Add small fixes
This commit is contained in:
parent
be21c20bbe
commit
0eff2e7850
2 changed files with 14 additions and 15 deletions
|
@ -57,7 +57,7 @@ public class PoiUIFilter implements SearchPoiTypeFilter, Comparable<PoiUIFilter>
|
|||
|
||||
protected int distanceInd = 0;
|
||||
// in kilometers
|
||||
protected double[] distanceToSearchValues = new double[] { 1, 2, 5, 10, 20, 50, 100, 200, 500 };
|
||||
protected double[] distanceToSearchValues = new double[]{1, 2, 5, 10, 20, 50, 100, 200, 500};
|
||||
|
||||
private final MapPoiTypes poiTypes;
|
||||
|
||||
|
@ -96,7 +96,7 @@ public class PoiUIFilter implements SearchPoiTypeFilter, Comparable<PoiUIFilter>
|
|||
|
||||
// constructor for user defined filters
|
||||
public PoiUIFilter(String name, String filterId,
|
||||
Map<PoiCategory, LinkedHashSet<String>> acceptedTypes, OsmandApplication app) {
|
||||
Map<PoiCategory, LinkedHashSet<String>> acceptedTypes, OsmandApplication app) {
|
||||
this.app = app;
|
||||
isStandardFilter = false;
|
||||
poiTypes = app.getPoiTypes();
|
||||
|
@ -214,6 +214,8 @@ public class PoiUIFilter implements SearchPoiTypeFilter, Comparable<PoiUIFilter>
|
|||
clearPreviousZoom();
|
||||
} else if (radius < distanceToSearchValues.length) {
|
||||
distanceInd = radius;
|
||||
} else {
|
||||
distanceInd = distanceToSearchValues.length - 1;
|
||||
}
|
||||
List<Amenity> amenityList = searchAmenities(lat, lon, matcher);
|
||||
MapUtils.sortListOfMapObject(amenityList, lat, lon);
|
||||
|
@ -250,7 +252,7 @@ public class PoiUIFilter implements SearchPoiTypeFilter, Comparable<PoiUIFilter>
|
|||
}
|
||||
|
||||
public List<Amenity> searchAmenities(double top, double left, double bottom, double right, int zoom,
|
||||
ResultMatcher<Amenity> matcher) {
|
||||
ResultMatcher<Amenity> matcher) {
|
||||
List<Amenity> results = new ArrayList<Amenity>();
|
||||
List<Amenity> tempResults = currentSearchResult;
|
||||
if (tempResults != null) {
|
||||
|
@ -275,7 +277,7 @@ public class PoiUIFilter implements SearchPoiTypeFilter, Comparable<PoiUIFilter>
|
|||
}
|
||||
|
||||
protected List<Amenity> searchAmenitiesInternal(double lat, double lon, double topLatitude,
|
||||
double bottomLatitude, double leftLongitude, double rightLongitude, int zoom, final ResultMatcher<Amenity> matcher) {
|
||||
double bottomLatitude, double leftLongitude, double rightLongitude, int zoom, final ResultMatcher<Amenity> matcher) {
|
||||
return app.getResourceManager().searchAmenities(this,
|
||||
topLatitude, leftLongitude, bottomLatitude, rightLongitude, zoom, wrapResultMatcher(matcher));
|
||||
}
|
||||
|
@ -319,10 +321,10 @@ public class PoiUIFilter implements SearchPoiTypeFilter, Comparable<PoiUIFilter>
|
|||
}
|
||||
|
||||
private AmenityNameFilter getNameFilterInternal(StringBuilder nmFilter,
|
||||
final boolean allTime, final boolean open, final List<PoiType> poiAdditionals) {
|
||||
final boolean allTime, final boolean open, final List<PoiType> poiAdditionals) {
|
||||
final CollatorStringMatcher sm =
|
||||
nmFilter.length() > 0 ?
|
||||
new CollatorStringMatcher(nmFilter.toString().trim(), StringMatcherMode.CHECK_CONTAINS) : null;
|
||||
new CollatorStringMatcher(nmFilter.toString().trim(), StringMatcherMode.CHECK_CONTAINS) : null;
|
||||
return new AmenityNameFilter() {
|
||||
|
||||
@Override
|
||||
|
@ -337,8 +339,8 @@ public class PoiUIFilter implements SearchPoiTypeFilter, Comparable<PoiUIFilter>
|
|||
if (poiAdditionals != null) {
|
||||
Map<PoiType, PoiType> textPoiAdditionalsMap = new HashMap<>();
|
||||
Map<String, List<PoiType>> poiAdditionalCategoriesMap = new HashMap<>();
|
||||
for (PoiType pt : poiAdditionals) {
|
||||
String category = pt.getPoiAdditionalCategory();
|
||||
for (PoiType pt : poiAdditionals) {
|
||||
String category = pt.getPoiAdditionalCategory();
|
||||
List<PoiType> types = poiAdditionalCategoriesMap.get(category);
|
||||
if (types == null) {
|
||||
types = new ArrayList<>();
|
||||
|
|
|
@ -39,7 +39,8 @@ public class QuickSearchHelper implements ResourceListener {
|
|||
public static final int SEARCH_WPT_OBJECT_PRIORITY = 52;
|
||||
public static final int SEARCH_HISTORY_API_PRIORITY = 50;
|
||||
public static final int SEARCH_HISTORY_OBJECT_PRIORITY = 53;
|
||||
public static final int SEARCH_ONLINE_PRIORITY = 53;
|
||||
public static final int SEARCH_ONLINE_AMENITY_PRIORITY = 700;
|
||||
public static final int SEARCH_ONLINE_ADDRESS_PRIORITY = 500;
|
||||
private OsmandApplication app;
|
||||
private SearchUICore core;
|
||||
private SearchResultCollection resultCollection;
|
||||
|
@ -302,15 +303,11 @@ public class QuickSearchHelper implements ResourceListener {
|
|||
SearchResult sr = new SearchResult(phrase);
|
||||
sr.localeName = amenity.getName();
|
||||
sr.object = amenity;
|
||||
sr.priority = SEARCH_ONLINE_PRIORITY + (p++);
|
||||
sr.priority = poi ? SEARCH_ONLINE_AMENITY_PRIORITY : SEARCH_ONLINE_ADDRESS_PRIORITY + (p++);
|
||||
sr.objectType = poi ? ObjectType.POI : ObjectType.POI; // todo
|
||||
sr.location = amenity.getLocation();
|
||||
sr.preferredZoom = 17;
|
||||
if (phrase.getUnknownSearchWordLength() <= 1 && phrase.isNoSelectedType()) {
|
||||
matcher.publish(sr);
|
||||
} else if (phrase.getNameStringMatcher().matches(sr.localeName)) {
|
||||
matcher.publish(sr);
|
||||
}
|
||||
matcher.publish(sr);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue