File formatting and prevent extra blanks

This commit is contained in:
sonora 2016-08-06 09:10:51 +02:00
parent e9ce449d43
commit eafca496fe

View file

@ -241,33 +241,35 @@ public class RouteCalculationResult {
if(turn != null) { if(turn != null) {
RouteDirectionInfo info = new RouteDirectionInfo(s.getSegmentSpeed(), turn); RouteDirectionInfo info = new RouteDirectionInfo(s.getSegmentSpeed(), turn);
if (routeInd < list.size()) { if (routeInd < list.size()) {
int lind = routeInd; int lind = routeInd;
if(turn.isRoundAbout()) { if(turn.isRoundAbout()) {
int roundAboutEnd = prevLocationSize ; int roundAboutEnd = prevLocationSize ;
// take next name for roundabout (not roundabout name) // take next name for roundabout (not roundabout name)
while (lind < list.size() - 1 && list.get(lind).getObject().roundabout()) { while (lind < list.size() - 1 && list.get(lind).getObject().roundabout()) {
roundAboutEnd += Math.abs(list.get(lind).getEndPointIndex() roundAboutEnd += Math.abs(list.get(lind).getEndPointIndex()
- list.get(lind).getStartPointIndex()); - list.get(lind).getStartPointIndex());
lind++; lind++;
} }
// Consider roundabout end. // Consider roundabout end.
info.routeEndPointOffset = roundAboutEnd; info.routeEndPointOffset = roundAboutEnd;
} }
RouteSegmentResult next = list.get(lind); RouteSegmentResult next = list.get(lind);
info.setRef(next.getObject().getRef()); info.setRef(next.getObject().getRef());
info.setStreetName(next.getObject().getName(ctx.getSettings().MAP_PREFERRED_LOCALE.get())); info.setStreetName(next.getObject().getName(ctx.getSettings().MAP_PREFERRED_LOCALE.get()));
info.setDestinationName(next.getObject().getDestinationName(ctx.getSettings().MAP_PREFERRED_LOCALE.get())); info.setDestinationName(next.getObject().getDestinationName(ctx.getSettings().MAP_PREFERRED_LOCALE.get()));
} }
String description = toString(turn, ctx) + " " + RoutingHelper.formatStreetName(info.getStreetName(), String description = toString(turn, ctx) + " " + RoutingHelper.formatStreetName(info.getStreetName(),
info.getRef(), info.getDestinationName(), ctx.getString(R.string.towards)); info.getRef(), info.getDestinationName(), ctx.getString(R.string.towards));
String[] pointNames = s.getObject().getPointNames(s.getStartPointIndex()); destination = destination.trim();
if(pointNames != null) { String[] pointNames = s.getObject().getPointNames(s.getStartPointIndex());
if(pointNames != null) {
for (int t = 0; t < pointNames.length; t++) { for (int t = 0; t < pointNames.length; t++) {
description = description.trim();
description += " " + pointNames[t]; description += " " + pointNames[t];
} }
} }
info.setDescriptionRoute(description); info.setDescriptionRoute(description);
info.routePointOffset = prevLocationSize; info.routePointOffset = prevLocationSize;
if(directions.size() > 0 && prevDirectionTime > 0 && prevDirectionDistance > 0) { if(directions.size() > 0 && prevDirectionTime > 0 && prevDirectionDistance > 0) {