diff --git a/OsmAnd/src/net/osmand/plus/dashboard/DashboardOnMap.java b/OsmAnd/src/net/osmand/plus/dashboard/DashboardOnMap.java index c005c66ac5..9eca8830e8 100644 --- a/OsmAnd/src/net/osmand/plus/dashboard/DashboardOnMap.java +++ b/OsmAnd/src/net/osmand/plus/dashboard/DashboardOnMap.java @@ -1487,13 +1487,18 @@ public class DashboardOnMap implements ObservableScrollViewCallbacks, DynamicLis public void run() { if (visibleType == DashboardType.WAYPOINTS || visibleType == DashboardType.WAYPOINTS_FLAT) { List allTargets = new ArrayList<>(); + TargetPoint start = null; if (items != null) { for (Object obj : items) { if (obj instanceof LocationPointWrapper) { LocationPointWrapper p = (LocationPointWrapper) obj; if (p.getPoint() instanceof TargetPoint) { TargetPoint t = (TargetPoint) p.getPoint(); - t.intermediate = true; + if (t.start) { + start = t; + } else { + t.intermediate = true; + } allTargets.add(t); } } @@ -1503,15 +1508,24 @@ public class DashboardOnMap implements ObservableScrollViewCallbacks, DynamicLis } } TargetPointsHelper targetPointsHelper = getMyApplication().getTargetPointsHelper(); - if (allTargets.size() > 0) { - TargetPoint start = allTargets.remove(0); - targetPointsHelper.setStartPoint(new LatLon(start.getLatitude(), start.getLongitude()), - false, start.getPointDescription(getMyApplication())); + if (start != null) { + int startInd = allTargets.indexOf(start); + TargetPoint first = allTargets.remove(0); + if (startInd != 0) { + start.start = false; + start.intermediate = startInd != allTargets.size() - 1; + if (targetPointsHelper.getPointToStart() == null) { + start.getOriginalPointDescription().setName(start.getLatitude() + ", " + start.getLongitude()); + } + first.start = true; + first.intermediate = false; + targetPointsHelper.setStartPoint(new LatLon(first.getLatitude(), first.getLongitude()), + false, first.getPointDescription(getMyApplication())); + } } targetPointsHelper.reorderAllTargetPoints(allTargets, false); newRouteIsCalculated(false, new ValueHolder()); targetPointsHelper.updateRouteAndRefresh(true); - } } }, 50);