This commit is contained in:
Victor Shcherb 2016-05-08 23:22:48 +02:00
parent 9b9dfef76d
commit c0ab369316

View file

@ -10,6 +10,7 @@ import net.osmand.data.Amenity;
import net.osmand.osm.PoiCategory;
import net.osmand.plus.OsmandApplication;
import net.osmand.plus.R;
import net.osmand.util.Algorithms;
import net.osmand.util.MapUtils;
public class SearchByNameFilter extends PoiUIFilter {
@ -33,9 +34,11 @@ public class SearchByNameFilter extends PoiUIFilter {
double bottomLatitude, double leftLongitude, double rightLongitude, final ResultMatcher<Amenity> matcher) {
currentSearchResult = new ArrayList<Amenity>();
final int limit = distanceInd == 0 ? 500 : -1;
List<Amenity> result = app.getResourceManager().searchAmenitiesByName(getFilterByName(),
topLatitude, leftLongitude, bottomLatitude, rightLongitude, lat, lon, new ResultMatcher<Amenity>() {
if (!Algorithms.isBlank(getFilterByName())) {
List<Amenity> result = app.getResourceManager().searchAmenitiesByName(getFilterByName(), topLatitude,
leftLongitude, bottomLatitude, rightLongitude, lat, lon, new ResultMatcher<Amenity>() {
boolean elimit = false;
@Override
public boolean publish(Amenity object) {
if (limit != -1 && currentSearchResult.size() > limit) {
@ -54,6 +57,7 @@ public class SearchByNameFilter extends PoiUIFilter {
}
});
MapUtils.sortListOfMapObject(result, lat, lon);
}
currentSearchResult = result;
return currentSearchResult;
}