Wikipedia poi title in context menu and on the map in article language
This commit is contained in:
parent
10c8840f3a
commit
4b6d0b28eb
2 changed files with 21 additions and 11 deletions
|
@ -13,6 +13,7 @@ import net.osmand.osm.PoiCategory;
|
|||
import net.osmand.osm.PoiFilter;
|
||||
import net.osmand.osm.PoiType;
|
||||
import net.osmand.plus.MapMarkersHelper.MapMarker;
|
||||
import net.osmand.plus.OsmandApplication;
|
||||
import net.osmand.plus.R;
|
||||
import net.osmand.plus.activities.MapActivity;
|
||||
import net.osmand.plus.mapcontextmenu.MenuBuilder;
|
||||
|
@ -21,6 +22,7 @@ import net.osmand.plus.mapcontextmenu.builders.AmenityMenuBuilder;
|
|||
import net.osmand.plus.render.RenderingIcons;
|
||||
import net.osmand.plus.transport.TransportStopRoute;
|
||||
import net.osmand.plus.wikipedia.WikipediaDialogFragment;
|
||||
import net.osmand.plus.wikipedia.WikipediaPoiMenu;
|
||||
import net.osmand.util.Algorithms;
|
||||
import net.osmand.util.OpeningHoursParser;
|
||||
|
||||
|
@ -156,9 +158,13 @@ public class AmenityMenuController extends MenuController {
|
|||
@NonNull
|
||||
@Override
|
||||
public String getNameStr() {
|
||||
String name = amenity.getName(
|
||||
amenity.getType().isWiki() ? getPreferredMapAppLang() : getPreferredMapLang(),
|
||||
isTransliterateNames());
|
||||
String preferredLang = getPreferredMapLang();
|
||||
if (amenity.getType().isWiki()) {
|
||||
OsmandApplication app = getMapActivity().getMyApplication();
|
||||
preferredLang = WikipediaPoiMenu.getWikiArticleLanguage(app,
|
||||
amenity.getSupportedContentLocales(), getPreferredMapAppLang());
|
||||
}
|
||||
String name = amenity.getName(preferredLang, isTransliterateNames());
|
||||
Map<String, String> additionalInfo = amenity.getAdditionalInfo();
|
||||
if (additionalInfo != null) {
|
||||
String ref = additionalInfo.get("ref");
|
||||
|
|
|
@ -43,6 +43,7 @@ import net.osmand.plus.render.RenderingIcons;
|
|||
import net.osmand.plus.routing.IRouteInformationListener;
|
||||
import net.osmand.plus.routing.RoutingHelper;
|
||||
import net.osmand.plus.views.MapTextLayer.MapTextProvider;
|
||||
import net.osmand.plus.wikipedia.WikipediaPoiMenu;
|
||||
import net.osmand.util.Algorithms;
|
||||
|
||||
import java.util.ArrayList;
|
||||
|
@ -354,16 +355,19 @@ public class POIMapLayer extends OsmandMapLayer implements ContextMenuLayer.ICon
|
|||
public PointDescription getObjectName(Object o) {
|
||||
if (o instanceof Amenity) {
|
||||
Amenity a = (Amenity) o;
|
||||
String preferredMapLang = app.getSettings().MAP_PREFERRED_LOCALE.get();
|
||||
String preferredMapAppLang = preferredMapLang;
|
||||
if (Algorithms.isEmpty(preferredMapAppLang)) {
|
||||
preferredMapAppLang = app.getLanguage();
|
||||
}
|
||||
String preferredLang = app.getSettings().MAP_PREFERRED_LOCALE.get();
|
||||
boolean transliterateNames = app.getSettings().MAP_TRANSLITERATE_NAMES.get();
|
||||
|
||||
return new PointDescription(PointDescription.POINT_TYPE_POI, a.getName(
|
||||
a.getType().isWiki() ? preferredMapAppLang : preferredMapLang,
|
||||
transliterateNames));
|
||||
if (a.getType().isWiki()) {
|
||||
if (Algorithms.isEmpty(preferredLang)) {
|
||||
preferredLang = app.getLanguage();
|
||||
}
|
||||
preferredLang = WikipediaPoiMenu.getWikiArticleLanguage(app,
|
||||
a.getSupportedContentLocales(), preferredLang);
|
||||
}
|
||||
|
||||
return new PointDescription(PointDescription.POINT_TYPE_POI,
|
||||
a.getName(preferredLang, transliterateNames));
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue