diff --git a/OsmAnd/src/net/osmand/plus/activities/ShowRouteInfoDialogFragment.java b/OsmAnd/src/net/osmand/plus/activities/ShowRouteInfoDialogFragment.java index b3f4513980..d8a13418f1 100644 --- a/OsmAnd/src/net/osmand/plus/activities/ShowRouteInfoDialogFragment.java +++ b/OsmAnd/src/net/osmand/plus/activities/ShowRouteInfoDialogFragment.java @@ -170,6 +170,9 @@ public class ShowRouteInfoDialogFragment extends BaseOsmAndFragment { private GpxSelectionHelper.GpxDisplayItem gpxItem; private List menuCards = new ArrayList<>(); + private String preferredMapLang; + private boolean transliterateNames; + @Override public View onCreateView(@NonNull LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) { @@ -177,6 +180,9 @@ public class ShowRouteInfoDialogFragment extends BaseOsmAndFragment { final MapActivity mapActivity = requireMapActivity(); routingHelper = app.getRoutingHelper(); + preferredMapLang = app.getSettings().MAP_PREFERRED_LOCALE.get(); + transliterateNames = app.getSettings().MAP_TRANSLITERATE_NAMES.get(); + view = inflater.inflate(R.layout.route_info_layout, container, false); AndroidUtils.addStatusBarPadding21v(getActivity(), view); @@ -617,7 +623,7 @@ public class ShowRouteInfoDialogFragment extends BaseOsmAndFragment { SpannableString secondaryText = new SpannableString(getString(R.string.sit_on_the_stop)); secondaryText.setSpan(new ForegroundColorSpan(ContextCompat.getColor(app, nightMode ? R.color.primary_text_dark : R.color.primary_text_light)), 0, secondaryText.length(), Spannable.SPAN_EXCLUSIVE_EXCLUSIVE); - SpannableString title = new SpannableString(startStop.getName()); + SpannableString title = new SpannableString(startStop.getName(preferredMapLang, transliterateNames)); title.setSpan(new CustomTypefaceSpan(typeface), 0, title.length(), Spannable.SPAN_EXCLUSIVE_EXCLUSIVE); title.setSpan(new ForegroundColorSpan(getActiveColor()), 0, title.length(), Spannable.SPAN_EXCLUSIVE_EXCLUSIVE); @@ -679,7 +685,7 @@ public class ShowRouteInfoDialogFragment extends BaseOsmAndFragment { if (spaceIndex != -1) { secondaryText.setSpan(new ForegroundColorSpan(ContextCompat.getColor(app, nightMode ? R.color.primary_text_dark : R.color.primary_text_light)), 0, spaceIndex, Spannable.SPAN_EXCLUSIVE_EXCLUSIVE); } - title = new SpannableString(endStop.getName()); + title = new SpannableString(endStop.getName(preferredMapLang, transliterateNames)); title.setSpan(new CustomTypefaceSpan(typeface), 0, title.length(), Spannable.SPAN_EXCLUSIVE_EXCLUSIVE); title.setSpan(new ForegroundColorSpan(getActiveColor()), 0, title.length(), Spannable.SPAN_EXCLUSIVE_EXCLUSIVE); @@ -1100,7 +1106,7 @@ public class ShowRouteInfoDialogFragment extends BaseOsmAndFragment { routeTypeView.setLayoutParams(routeTypeParams); routeTypeView.setTextSize(16); AndroidUtils.setTextSecondaryColor(app, routeTypeView, nightMode); - routeTypeView.setText(transportStopRoute.desc); + routeTypeView.setText(transportStopRoute.getDescription(app)); llText.addView(routeTypeView); View routeBadge = createRouteBadge(mapActivity, transportStopRoute, nightMode); @@ -1474,7 +1480,7 @@ public class ShowRouteInfoDialogFragment extends BaseOsmAndFragment { Drawable icon = getContentIcon(drawableResId); for (int i = 0; i < stops.size(); i++) { final TransportStop stop = stops.get(i); - buildIntermediateRow(view, icon, new SpannableString(stop.getName()), new OnClickListener() { + buildIntermediateRow(view, icon, new SpannableString(stop.getName(preferredMapLang, transliterateNames)), new OnClickListener() { @Override public void onClick(View v) { showLocationOnMap(stop.getLocation()); diff --git a/OsmAnd/src/net/osmand/plus/routepreparationmenu/cards/PublicTransportCard.java b/OsmAnd/src/net/osmand/plus/routepreparationmenu/cards/PublicTransportCard.java index 0f63deac93..9592da2ec8 100644 --- a/OsmAnd/src/net/osmand/plus/routepreparationmenu/cards/PublicTransportCard.java +++ b/OsmAnd/src/net/osmand/plus/routepreparationmenu/cards/PublicTransportCard.java @@ -126,8 +126,11 @@ public class PublicTransportCard extends BaseCard { } private SpannableString getFirstLineDescrSpan() { + String preferredMapLang = app.getSettings().MAP_PREFERRED_LOCALE.get(); + boolean transliterateNames = app.getSettings().MAP_TRANSLITERATE_NAMES.get(); + List segments = routeResult.getSegments(); - String name = segments.get(0).getStart().getName(); + String name = segments.get(0).getStart().getName(preferredMapLang, transliterateNames); String firstLine = Algorithms.capitalizeFirstLetter(app.getString(R.string.shared_string_from)) + " " + name; if (segments.size() > 1) { diff --git a/OsmAnd/src/net/osmand/plus/transport/TransportStopRoute.java b/OsmAnd/src/net/osmand/plus/transport/TransportStopRoute.java index de7453e138..b4976e0826 100644 --- a/OsmAnd/src/net/osmand/plus/transport/TransportStopRoute.java +++ b/OsmAnd/src/net/osmand/plus/transport/TransportStopRoute.java @@ -49,6 +49,16 @@ public class TransportStopRoute { return desc; } + // TODO: [Hot fix] - Move changes to upper method later + public String getDescription(OsmandApplication ctx) { + String preferredMapLang = ctx.getSettings().MAP_PREFERRED_LOCALE.get(); + boolean transliterateNames = ctx.getSettings().MAP_TRANSLITERATE_NAMES.get(); + if (route != null) { + return route.getName(preferredMapLang, transliterateNames); + } + return ""; + } + public int calculateZoom(int startPosition, RotatedTileBox currentRotatedTileBox) { RotatedTileBox cp = currentRotatedTileBox.copy(); boolean notContains = true;