Merge pull request #10547 from osmandapp/fix_links

Fix links to wikivoyage
This commit is contained in:
alex-osm 2021-01-10 15:38:07 +03:00 committed by GitHub
commit f8a7929310
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -492,7 +492,7 @@ public class TravelObfHelper implements TravelHelper {
@Override @Override
public TravelArticle getArticleByTitle(@NonNull final String title, @NonNull QuadRect rect, @NonNull final String lang) { public TravelArticle getArticleByTitle(@NonNull final String title, @NonNull QuadRect rect, @NonNull final String lang) {
TravelArticle article = null; TravelArticle article = null;
List<Amenity> amenities = null; final List<Amenity> amenities = new ArrayList<>();
int x = 0; int x = 0;
int y = 0; int y = 0;
int left = 0; int left = 0;
@ -510,8 +510,25 @@ public class TravelObfHelper implements TravelHelper {
for (BinaryMapIndexReader reader : getReaders()) { for (BinaryMapIndexReader reader : getReaders()) {
try { try {
SearchRequest<Amenity> req = BinaryMapIndexReader.buildSearchPoiRequest( SearchRequest<Amenity> req = BinaryMapIndexReader.buildSearchPoiRequest(
x, y, title, left, right, top, bottom, getSearchRouteArticleFilter(), null, null); x, y, title, left, right, top, bottom, getSearchRouteArticleFilter(),
amenities = reader.searchPoiByName(req); new ResultMatcher<Amenity>() {
boolean done = false;
@Override
public boolean publish(Amenity amenity) {
if (Algorithms.stringsEqual(title, Algorithms.emptyIfNull(amenity.getName(lang)))) {
amenities.add(amenity);
done = true;
}
return false;
}
@Override
public boolean isCancelled() {
return done;
}
}, null);
reader.searchPoiByName(req);
} catch (IOException e) { } catch (IOException e) {
LOG.error(e.getMessage()); LOG.error(e.getMessage());
} }