Fix translations at transport route menu
This commit is contained in:
parent
b2924dab1d
commit
5b54709cd8
3 changed files with 24 additions and 5 deletions
|
@ -170,6 +170,9 @@ public class ShowRouteInfoDialogFragment extends BaseOsmAndFragment {
|
|||
private GpxSelectionHelper.GpxDisplayItem gpxItem;
|
||||
private List<BaseCard> 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());
|
||||
|
|
|
@ -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<TransportRouteResultSegment> 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) {
|
||||
|
|
|
@ -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;
|
||||
|
|
Loading…
Reference in a new issue