Merge branch 'master' of github.com:osmandapp/Osmand

This commit is contained in:
max-klaus 2020-05-13 17:00:14 +03:00
commit 57998b6cd0
6 changed files with 32 additions and 29 deletions

View file

@ -1011,6 +1011,17 @@ public class RouteDataObject {
rf == null ? "" : rf);
}
public boolean hasNameTagStartsWith(String tagStartsWith) {
int[] nextSegmentNameIds = nameIds;
for (int nm = 0; nm < nameIds.length; nm++) {
RouteTypeRule rtr = region.quickGetEncodingRule(nameIds[nm]);
if (rtr != null && rtr.getTag().startsWith(tagStartsWith)) {
return true;
}
}
return false;
}
public static class RestrictionInfo {
public int type;
public long toWay;

View file

@ -1294,6 +1294,7 @@
<string name="trip_rec_notification_settings">Turn on quick recording</string>
<string name="trip_rec_notification_settings_desc">Display a system notification allowing trip recording.</string>
<string name="shared_string_notifications">Notifications</string>
<string name="shared_string_resume">Resume</string>
<string name="shared_string_continue">Continue</string>
<string name="shared_string_pause">Pause</string>
<string name="shared_string_paused">Paused</string>
@ -2112,8 +2113,8 @@
<string name="live_monitoring_m">Online tracking (GPX required)</string>
<string name="live_monitoring_start">Start online tracking</string>
<string name="live_monitoring_stop">Stop online tracking</string>
<string name="gpx_monitoring_start">Start GPX logging</string>
<string name="gpx_monitoring_stop">Stop GPX logging</string>
<string name="gpx_monitoring_start">Resume GPX logging</string>
<string name="gpx_monitoring_stop">Pause GPX logging</string>
<string name="gpx_start_new_segment">Start new segment</string>
<string name="rendering_attr_hideBuildings_name">Buildings</string>
<string name="rendering_attr_hideNonVehicleHighways_name">Non-vehicle highways</string>

View file

@ -175,7 +175,7 @@ public class GpxNotification extends OsmandNotification {
PendingIntent.FLAG_UPDATE_CURRENT);
if (recordedDistance > 0) {
notificationBuilder.addAction(R.drawable.ic_notification_rec_start,
app.getString(R.string.shared_string_continue), startPendingIntent);
app.getString(R.string.shared_string_resume), startPendingIntent);
notificationBuilder.addAction(R.drawable.ic_notification_save,
app.getString(R.string.shared_string_save), savePendingIntent);
} else {

View file

@ -230,6 +230,7 @@ public class RouteCalculationResult {
RouteDirectionInfo info = new RouteDirectionInfo(localDirections.get(currentDirection).getAverageSpeed(), TurnType.straight());
info.setRef(toSplit.getRef());
info.setStreetName(toSplit.getStreetName());
info.setRouteDataObject(toSplit.getRouteDataObject());
info.setDestinationName(toSplit.getDestinationName());
info.routePointOffset = interLocations[currentIntermediate];
info.setDescriptionRoute(ctx.getString(R.string.route_head));//; //$NON-NLS-1$
@ -412,32 +413,17 @@ public class RouteCalculationResult {
if (ref != null) {
RouteDataObject nextRoad = next.getObject();
boolean isNextShieldFound = false;
int[] nextSegmentNameIds = nextRoad.nameIds;
for (int nm = 0; nm < nextSegmentNameIds.length; nm++) {
if (nextRoad.region.quickGetEncodingRule(nextSegmentNameIds[nm]).getTag().startsWith("road_ref")) {
info.setRouteDataObject(nextRoad);
isNextShieldFound = true;
}
}
if (!isNextShieldFound) {
for (int ind = lind; ind < list.size(); ind++) {
boolean isNextShieldFound = nextRoad.hasNameTagStartsWith("road_ref");
for (int ind = lind; ind < list.size() && !isNextShieldFound; ind++) {
if (list.get(ind).getTurnType() != null) {
info.setRouteDataObject(null);
break;
isNextShieldFound = true;
} else {
RouteDataObject obj = list.get(ind).getObject();
int[] nameIds = obj.nameIds;
for (int idx = 0; idx < nameIds.length; idx ++) {
if (obj.region.routeEncodingRules.get(obj.nameIds[idx]).getTag().startsWith("road_ref")) {
if (obj.hasNameTagStartsWith("road_ref")) {
info.setRouteDataObject(obj);
break;
}
}
if (info.getRouteDataObject() != null) {
break;
}
isNextShieldFound = true;
}
}
}
@ -787,6 +773,7 @@ public class RouteCalculationResult {
if (segs != null) {
RouteSegmentResult lastSegmentResult = segs.get(segs.size() - 1);
RouteDataObject routeDataObject = lastSegmentResult.getObject();
info.setRouteDataObject(routeDataObject);
info.setRef(routeDataObject.getRef(ctx.getSettings().MAP_PREFERRED_LOCALE.get(),
ctx.getSettings().MAP_TRANSLITERATE_NAMES.get(), lastSegmentResult.isForwardDirection()));
info.setStreetName(routeDataObject.getName(ctx.getSettings().MAP_PREFERRED_LOCALE.get(),
@ -1143,6 +1130,7 @@ public class RouteCalculationResult {
p = new RouteDirectionInfo(i.getAverageSpeed(), i.getTurnType());
p.routePointOffset = i.routePointOffset;
p.routeEndPointOffset = i.routeEndPointOffset;
p.setRouteDataObject(i.getRouteDataObject());
p.setDestinationName(i.getDestinationName());
p.setRef(i.getRef());
p.setStreetName(i.getStreetName());

View file

@ -480,7 +480,7 @@ public class RouteProvider {
ch.routeEndPointOffset = info.routeEndPointOffset - startI[0];
}
ch.setDescriptionRoute(info.getDescriptionRoutePart());
ch.setRouteDataObject(info.getRouteDataObject());
// Issue #2894
if (info.getRef() != null && !"null".equals(info.getRef())) {
ch.setRef(info.getRef());

View file

@ -1145,6 +1145,9 @@ public class MapInfoWidgetsFactory {
additional.append(key).append("=").append(val).append(";");
}
}
if(name == null || nameTag == null) {
return false;
}
Context context = topBar.getContext();
int[] tps = object.getTypes();