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.PoiFilter;
|
||||||
import net.osmand.osm.PoiType;
|
import net.osmand.osm.PoiType;
|
||||||
import net.osmand.plus.MapMarkersHelper.MapMarker;
|
import net.osmand.plus.MapMarkersHelper.MapMarker;
|
||||||
|
import net.osmand.plus.OsmandApplication;
|
||||||
import net.osmand.plus.R;
|
import net.osmand.plus.R;
|
||||||
import net.osmand.plus.activities.MapActivity;
|
import net.osmand.plus.activities.MapActivity;
|
||||||
import net.osmand.plus.mapcontextmenu.MenuBuilder;
|
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.render.RenderingIcons;
|
||||||
import net.osmand.plus.transport.TransportStopRoute;
|
import net.osmand.plus.transport.TransportStopRoute;
|
||||||
import net.osmand.plus.wikipedia.WikipediaDialogFragment;
|
import net.osmand.plus.wikipedia.WikipediaDialogFragment;
|
||||||
|
import net.osmand.plus.wikipedia.WikipediaPoiMenu;
|
||||||
import net.osmand.util.Algorithms;
|
import net.osmand.util.Algorithms;
|
||||||
import net.osmand.util.OpeningHoursParser;
|
import net.osmand.util.OpeningHoursParser;
|
||||||
|
|
||||||
|
@ -156,9 +158,13 @@ public class AmenityMenuController extends MenuController {
|
||||||
@NonNull
|
@NonNull
|
||||||
@Override
|
@Override
|
||||||
public String getNameStr() {
|
public String getNameStr() {
|
||||||
String name = amenity.getName(
|
String preferredLang = getPreferredMapLang();
|
||||||
amenity.getType().isWiki() ? getPreferredMapAppLang() : getPreferredMapLang(),
|
if (amenity.getType().isWiki()) {
|
||||||
isTransliterateNames());
|
OsmandApplication app = getMapActivity().getMyApplication();
|
||||||
|
preferredLang = WikipediaPoiMenu.getWikiArticleLanguage(app,
|
||||||
|
amenity.getSupportedContentLocales(), getPreferredMapAppLang());
|
||||||
|
}
|
||||||
|
String name = amenity.getName(preferredLang, isTransliterateNames());
|
||||||
Map<String, String> additionalInfo = amenity.getAdditionalInfo();
|
Map<String, String> additionalInfo = amenity.getAdditionalInfo();
|
||||||
if (additionalInfo != null) {
|
if (additionalInfo != null) {
|
||||||
String ref = additionalInfo.get("ref");
|
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.IRouteInformationListener;
|
||||||
import net.osmand.plus.routing.RoutingHelper;
|
import net.osmand.plus.routing.RoutingHelper;
|
||||||
import net.osmand.plus.views.MapTextLayer.MapTextProvider;
|
import net.osmand.plus.views.MapTextLayer.MapTextProvider;
|
||||||
|
import net.osmand.plus.wikipedia.WikipediaPoiMenu;
|
||||||
import net.osmand.util.Algorithms;
|
import net.osmand.util.Algorithms;
|
||||||
|
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
|
@ -354,16 +355,19 @@ public class POIMapLayer extends OsmandMapLayer implements ContextMenuLayer.ICon
|
||||||
public PointDescription getObjectName(Object o) {
|
public PointDescription getObjectName(Object o) {
|
||||||
if (o instanceof Amenity) {
|
if (o instanceof Amenity) {
|
||||||
Amenity a = (Amenity) o;
|
Amenity a = (Amenity) o;
|
||||||
String preferredMapLang = app.getSettings().MAP_PREFERRED_LOCALE.get();
|
String preferredLang = app.getSettings().MAP_PREFERRED_LOCALE.get();
|
||||||
String preferredMapAppLang = preferredMapLang;
|
|
||||||
if (Algorithms.isEmpty(preferredMapAppLang)) {
|
|
||||||
preferredMapAppLang = app.getLanguage();
|
|
||||||
}
|
|
||||||
boolean transliterateNames = app.getSettings().MAP_TRANSLITERATE_NAMES.get();
|
boolean transliterateNames = app.getSettings().MAP_TRANSLITERATE_NAMES.get();
|
||||||
|
|
||||||
return new PointDescription(PointDescription.POINT_TYPE_POI, a.getName(
|
if (a.getType().isWiki()) {
|
||||||
a.getType().isWiki() ? preferredMapAppLang : preferredMapLang,
|
if (Algorithms.isEmpty(preferredLang)) {
|
||||||
transliterateNames));
|
preferredLang = app.getLanguage();
|
||||||
|
}
|
||||||
|
preferredLang = WikipediaPoiMenu.getWikiArticleLanguage(app,
|
||||||
|
a.getSupportedContentLocales(), preferredLang);
|
||||||
|
}
|
||||||
|
|
||||||
|
return new PointDescription(PointDescription.POINT_TYPE_POI,
|
||||||
|
a.getName(preferredLang, transliterateNames));
|
||||||
}
|
}
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue