diff --git a/OsmAnd/src/net/osmand/plus/helpers/AvoidSpecificRoads.java b/OsmAnd/src/net/osmand/plus/helpers/AvoidSpecificRoads.java index b837d1d28a..8ca27b7878 100644 --- a/OsmAnd/src/net/osmand/plus/helpers/AvoidSpecificRoads.java +++ b/OsmAnd/src/net/osmand/plus/helpers/AvoidSpecificRoads.java @@ -99,7 +99,7 @@ public class AvoidSpecificRoads { protected String getText(RouteDataObject obj) { return RoutingHelper.formatStreetName(obj.getName(app.getSettings().MAP_PREFERRED_LOCALE.get()), - obj.getRef(), obj.getDestinationName(app.getSettings().MAP_PREFERRED_LOCALE.get())); + obj.getRef(), obj.getDestinationName(app.getSettings().MAP_PREFERRED_LOCALE.get()), true); } public void showDialog(final MapActivity mapActivity) { diff --git a/OsmAnd/src/net/osmand/plus/helpers/ExternalApiHelper.java b/OsmAnd/src/net/osmand/plus/helpers/ExternalApiHelper.java index f345cbcc75..a44e341b41 100644 --- a/OsmAnd/src/net/osmand/plus/helpers/ExternalApiHelper.java +++ b/OsmAnd/src/net/osmand/plus/helpers/ExternalApiHelper.java @@ -428,7 +428,7 @@ public class ExternalApiHelper { if (ni.directionInfo != null && ni.directionInfo.getTurnType() != null) { TurnType tt = ni.directionInfo.getTurnType(); RouteDirectionInfo a = ni.directionInfo; - result.putExtra(prefix + PARAM_NT_DIRECTION_NAME, RoutingHelper.formatStreetName(a.getStreetName(), a.getRef(), a.getDestinationName())); + result.putExtra(prefix + PARAM_NT_DIRECTION_NAME, RoutingHelper.formatStreetName(a.getStreetName(), a.getRef(), a.getDestinationName(), false)); result.putExtra(prefix + PARAM_NT_DIRECTION_TURN, tt.toXmlString()); if (tt.getLanes() != null) { result.putExtra(prefix + PARAM_NT_DIRECTION_LANES, Arrays.toString(tt.getLanes())); diff --git a/OsmAnd/src/net/osmand/plus/routing/RouteCalculationResult.java b/OsmAnd/src/net/osmand/plus/routing/RouteCalculationResult.java index 321acae9c1..22464f3e40 100644 --- a/OsmAnd/src/net/osmand/plus/routing/RouteCalculationResult.java +++ b/OsmAnd/src/net/osmand/plus/routing/RouteCalculationResult.java @@ -261,7 +261,7 @@ public class RouteCalculationResult { } String description = toString(turn, ctx) + " " + RoutingHelper.formatStreetName(info.getStreetName(), - info.getRef(), info.getDestinationName()); + info.getRef(), info.getDestinationName(), true); String[] pointNames = s.getObject().getPointNames(s.getStartPointIndex()); if(pointNames != null) { for (int t = 0; t < pointNames.length; t++) { diff --git a/OsmAnd/src/net/osmand/plus/routing/RoutingHelper.java b/OsmAnd/src/net/osmand/plus/routing/RoutingHelper.java index 777ae49bf3..78e68347d1 100644 --- a/OsmAnd/src/net/osmand/plus/routing/RoutingHelper.java +++ b/OsmAnd/src/net/osmand/plus/routing/RoutingHelper.java @@ -709,7 +709,7 @@ public class RoutingHelper { } - public static String formatStreetName(String name, String ref, String destination) { + public static String formatStreetName(String name, String ref, String destination, boolean includeTowards) { //Original version returned: // 1. ref + " " + dest // 2. dest @@ -733,8 +733,11 @@ public class RoutingHelper { if (formattedStreetName.length() > 0) { formattedStreetName = formattedStreetName + " "; } - //formattedStreetName = formattedStreetName + app.getString(R.string.towards) + " " + destination; - formattedStreetName = formattedStreetName + " " + destination; + if (includeTowards) { + formattedStreetName = formattedStreetName + R.string.towards + " " + destination; + } else { + formattedStreetName = formattedStreetName + " " + destination; + } } return formattedStreetName; @@ -778,14 +781,14 @@ public class RoutingHelper { if(next != null) { next[0] = n.directionInfo.getTurnType(); } - return formatStreetName(nm, rf, dn); + return formatStreetName(nm, rf, dn, true); } RouteSegmentResult rs = getCurrentSegmentResult(); if(rs != null) { String nm = rs.getObject().getName(settings.MAP_PREFERRED_LOCALE.get()); String rf = rs.getObject().getRef(); String dn = rs.getObject().getDestinationName(settings.MAP_PREFERRED_LOCALE.get()); - return formatStreetName(nm, rf, dn); + return formatStreetName(nm, rf, dn, true); } return null; } diff --git a/OsmAnd/src/net/osmand/plus/views/mapwidgets/MapInfoWidgetsFactory.java b/OsmAnd/src/net/osmand/plus/views/mapwidgets/MapInfoWidgetsFactory.java index 10eb65eb1d..3219e2bf1c 100644 --- a/OsmAnd/src/net/osmand/plus/views/mapwidgets/MapInfoWidgetsFactory.java +++ b/OsmAnd/src/net/osmand/plus/views/mapwidgets/MapInfoWidgetsFactory.java @@ -317,7 +317,7 @@ public class MapInfoWidgetsFactory { showNextTurn = true; RouteDirectionInfo next = routingHelper.getRouteDirections().get(di); type[0] = next.getTurnType(); - text = RoutingHelper.formatStreetName(next.getStreetName(), next.getRef(), next.getDestinationName()); + text = RoutingHelper.formatStreetName(next.getStreetName(), next.getRef(), next.getDestinationName(), true); // if (next.distance > 0) { // text += " " + OsmAndFormatter.getFormattedDistance(next.distance, map.getMyApplication()); // } @@ -332,7 +332,7 @@ public class MapInfoWidgetsFactory { RouteDataObject rt = locationProvider.getLastKnownRouteSegment(); if (rt != null) { text = RoutingHelper.formatStreetName(rt.getName(settings.MAP_PREFERRED_LOCALE.get()), - rt.getRef(), rt.getDestinationName(settings.MAP_PREFERRED_LOCALE.get())); + rt.getRef(), rt.getDestinationName(settings.MAP_PREFERRED_LOCALE.get()), true); } if (text == null) { text = "";