From 42c0766f6d641c8a9f7573a3f1710875741a2832 Mon Sep 17 00:00:00 2001 From: Alexey Kulish Date: Tue, 25 Jul 2017 17:10:14 +0300 Subject: [PATCH] Fix #4145 --- .../net/osmand/plus/mapcontextmenu/MenuBuilder.java | 13 ++++++++++--- 1 file changed, 10 insertions(+), 3 deletions(-) diff --git a/OsmAnd/src/net/osmand/plus/mapcontextmenu/MenuBuilder.java b/OsmAnd/src/net/osmand/plus/mapcontextmenu/MenuBuilder.java index b5ef8000af..00a836b75d 100644 --- a/OsmAnd/src/net/osmand/plus/mapcontextmenu/MenuBuilder.java +++ b/OsmAnd/src/net/osmand/plus/mapcontextmenu/MenuBuilder.java @@ -45,6 +45,7 @@ import net.osmand.plus.mapcontextmenu.builders.cards.ImageCard.GetImageCardsTask import net.osmand.plus.mapcontextmenu.builders.cards.ImageCard.GetImageCardsTask.GetImageCardsListener; import net.osmand.plus.mapcontextmenu.builders.cards.NoImagesCard; import net.osmand.plus.render.RenderingIcons; +import net.osmand.util.Algorithms; import net.osmand.util.MapUtils; import java.util.ArrayList; @@ -648,6 +649,10 @@ public class MenuBuilder { protected boolean processNearstWiki() { if (showNearestWiki && latLon != null) { + String preferredLang = app.getSettings().MAP_PREFERRED_LOCALE.get(); + if (Algorithms.isEmpty(preferredLang)) { + preferredLang = app.getLanguage(); + } QuadRect rect = MapUtils.calculateLatLonBbox( latLon.getLatitude(), latLon.getLongitude(), 250); nearestWiki = app.getResourceManager().searchAmenities( @@ -673,12 +678,14 @@ public class MenuBuilder { }); Long id = objectId; if (id != 0) { + List wikiList = new ArrayList<>(); for (Amenity wiki : nearestWiki) { - if (wiki.getId().equals(id)) { - nearestWiki.remove(wiki); - break; + String lng = wiki.getContentLanguage("content", preferredLang, "en"); + if (wiki.getId().equals(id) || (!lng.equals("en") && !lng.equals(preferredLang))) { + wikiList.add(wiki); } } + nearestWiki.removeAll(wikiList); } return true; }