Fix reverse for multisegment

This commit is contained in:
Vitaliy 2021-02-17 15:02:26 +02:00
parent e4b902c6f4
commit c941880444
2 changed files with 16 additions and 14 deletions

View file

@ -226,16 +226,14 @@ public class FollowTrackFragment extends ContextMenuScrollFragment implements Ca
GPXRouteParamsBuilder rparams = routingHelper.getCurrentGPXRoute(); GPXRouteParamsBuilder rparams = routingHelper.getCurrentGPXRoute();
boolean osmandRouter = mode.getRouteService() == RouteProvider.RouteService.OSMAND; boolean osmandRouter = mode.getRouteService() == RouteProvider.RouteService.OSMAND;
if (rparams != null && osmandRouter) { if (rparams != null && osmandRouter) {
boolean showReverseCard = !routingHelper.isCurrentGPXRouteV2();
if (showReverseCard) {
cardsContainer.addView(buildDividerView(cardsContainer, false)); cardsContainer.addView(buildDividerView(cardsContainer, false));
ReverseTrackCard reverseTrackCard = new ReverseTrackCard(mapActivity, rparams.isReverse()); ReverseTrackCard reverseTrackCard = new ReverseTrackCard(mapActivity, rparams.isReverse());
reverseTrackCard.setListener(this); reverseTrackCard.setListener(this);
cardsContainer.addView(reverseTrackCard.build(mapActivity)); cardsContainer.addView(reverseTrackCard.build(mapActivity));
}
if (!gpxFile.hasRtePt() && !gpxFile.hasRoute()) { if (!gpxFile.hasRtePt() && !gpxFile.hasRoute()) {
cardsContainer.addView(buildDividerView(cardsContainer, showReverseCard)); cardsContainer.addView(buildDividerView(cardsContainer, true));
AttachTrackToRoadsCard attachTrackCard = new AttachTrackToRoadsCard(mapActivity); AttachTrackToRoadsCard attachTrackCard = new AttachTrackToRoadsCard(mapActivity);
attachTrackCard.setListener(this); attachTrackCard.setListener(this);

View file

@ -289,7 +289,11 @@ public class RouteProvider {
int selectedSegment = builder.getSelectedSegment(); int selectedSegment = builder.getSelectedSegment();
if (OSMAND_ROUTER_V2.equals(file.author)) { if (OSMAND_ROUTER_V2.equals(file.author)) {
route = parseOsmAndGPXRoute(points, file, selectedSegment); route = parseOsmAndGPXRoute(points, file, selectedSegment);
if (selectedSegment == -1) {
routePoints = file.getRoutePoints(); routePoints = file.getRoutePoints();
} else {
routePoints = file.getRoutePoints(selectedSegment);
}
if (reverse) { if (reverse) {
Collections.reverse(points); Collections.reverse(points);
Collections.reverse(routePoints); Collections.reverse(routePoints);