This commit is contained in:
Alexey Kulish 2017-07-25 17:10:14 +03:00
parent 0be80bf1d6
commit 1340c003f1

View file

@ -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.ImageCard.GetImageCardsTask.GetImageCardsListener;
import net.osmand.plus.mapcontextmenu.builders.cards.NoImagesCard; import net.osmand.plus.mapcontextmenu.builders.cards.NoImagesCard;
import net.osmand.plus.render.RenderingIcons; import net.osmand.plus.render.RenderingIcons;
import net.osmand.util.Algorithms;
import net.osmand.util.MapUtils; import net.osmand.util.MapUtils;
import java.util.ArrayList; import java.util.ArrayList;
@ -648,6 +649,10 @@ public class MenuBuilder {
protected boolean processNearstWiki() { protected boolean processNearstWiki() {
if (showNearestWiki && latLon != null) { if (showNearestWiki && latLon != null) {
String preferredLang = app.getSettings().MAP_PREFERRED_LOCALE.get();
if (Algorithms.isEmpty(preferredLang)) {
preferredLang = app.getLanguage();
}
QuadRect rect = MapUtils.calculateLatLonBbox( QuadRect rect = MapUtils.calculateLatLonBbox(
latLon.getLatitude(), latLon.getLongitude(), 250); latLon.getLatitude(), latLon.getLongitude(), 250);
nearestWiki = app.getResourceManager().searchAmenities( nearestWiki = app.getResourceManager().searchAmenities(
@ -673,12 +678,14 @@ public class MenuBuilder {
}); });
Long id = objectId; Long id = objectId;
if (id != 0) { if (id != 0) {
List<Amenity> wikiList = new ArrayList<>();
for (Amenity wiki : nearestWiki) { for (Amenity wiki : nearestWiki) {
if (wiki.getId().equals(id)) { String lng = wiki.getContentLanguage("content", preferredLang, "en");
nearestWiki.remove(wiki); if (wiki.getId().equals(id) || (!lng.equals("en") && !lng.equals(preferredLang))) {
break; wikiList.add(wiki);
} }
} }
nearestWiki.removeAll(wikiList);
} }
return true; return true;
} }