diff --git a/OsmAnd/src/net/osmand/plus/routepreparationmenu/FollowTrackFragment.java b/OsmAnd/src/net/osmand/plus/routepreparationmenu/FollowTrackFragment.java index b726e23b19..82a8ea2d88 100644 --- a/OsmAnd/src/net/osmand/plus/routepreparationmenu/FollowTrackFragment.java +++ b/OsmAnd/src/net/osmand/plus/routepreparationmenu/FollowTrackFragment.java @@ -721,13 +721,11 @@ public class FollowTrackFragment extends ContextMenuScrollFragment implements Ca @Override public void onSegmentSelect(GPXFile gpxFile, int selectedSegment) { selectTrackToFollow(gpxFile); - if (selectedSegment != -1) { GPXRouteParamsBuilder paramsBuilder = app.getRoutingHelper().getCurrentGPXRoute(); if (paramsBuilder != null) { paramsBuilder.setSelectedSegment(selectedSegment); app.getSettings().GPX_ROUTE_SEGMENT.set(selectedSegment); app.getRoutingHelper().onSettingsChanged(true); - } } updateSelectionMode(false); } diff --git a/OsmAnd/src/net/osmand/plus/routepreparationmenu/MapRouteInfoMenu.java b/OsmAnd/src/net/osmand/plus/routepreparationmenu/MapRouteInfoMenu.java index 83a866c49e..f88f499125 100644 --- a/OsmAnd/src/net/osmand/plus/routepreparationmenu/MapRouteInfoMenu.java +++ b/OsmAnd/src/net/osmand/plus/routepreparationmenu/MapRouteInfoMenu.java @@ -1675,6 +1675,13 @@ public class MapRouteInfoMenu implements IRouteInformationListener, CardListener if (Algorithms.isEmpty(fileName)) { fileName = app.getString(R.string.shared_string_gpx_track); } + GPXRouteParamsBuilder routeParams = app.getRoutingHelper().getCurrentGPXRoute(); + + if (gpxFile.getNonEmptySegmentsCount() > 1 && routeParams != null && routeParams.getSelectedSegment() != -1) { + int selectedSegmentCount = routeParams.getSelectedSegment() + 1; + int totalSegmentCount = routeParams.getFile().getNonEmptyTrkSegments(false).size(); + fileName = app.getResources().getString(R.string.of, selectedSegmentCount, totalSegmentCount) + ", " + fileName; + } title.setText(GpxUiHelper.getGpxTitle(fileName)); description.setText(R.string.follow_track); buttonDescription.setText(R.string.shared_string_add); diff --git a/OsmAnd/src/net/osmand/plus/routepreparationmenu/cards/TrackEditCard.java b/OsmAnd/src/net/osmand/plus/routepreparationmenu/cards/TrackEditCard.java index dbf62447a9..c50292489a 100644 --- a/OsmAnd/src/net/osmand/plus/routepreparationmenu/cards/TrackEditCard.java +++ b/OsmAnd/src/net/osmand/plus/routepreparationmenu/cards/TrackEditCard.java @@ -21,7 +21,7 @@ import java.io.File; public class TrackEditCard extends BaseCard { - private GPXFile gpxFile; + private final GPXFile gpxFile; public TrackEditCard(MapActivity mapActivity, GPXFile gpxFile) { super(mapActivity); @@ -63,12 +63,15 @@ public class TrackEditCard extends BaseCard { if (Algorithms.isEmpty(fileName)) { fileName = app.getString(R.string.shared_string_gpx_track); } + GPXInfo gpxInfo = new GPXInfo(gpxFile.path, file != null ? file.lastModified() : 0, file != null ? file.length() : 0); GpxDataItem dataItem = getDataItem(gpxInfo); String title = GpxUiHelper.getGpxTitle(Algorithms.getFileWithoutDirs(fileName)); GPXRouteParamsBuilder routeParams = app.getRoutingHelper().getCurrentGPXRoute(); if (gpxFile.getNonEmptySegmentsCount() > 1 && routeParams != null && routeParams.getSelectedSegment() != -1) { - title = title + " segment " + (routeParams.getSelectedSegment() + 1); + int selectedSegmentCount = routeParams.getSelectedSegment() + 1; + int totalSegmentCount = routeParams.getFile().getNonEmptyTrkSegments(false).size(); + title = app.getResources().getString(R.string.of, selectedSegmentCount, totalSegmentCount) + ", " + title; } GpxUiHelper.updateGpxInfoView(view, title, gpxInfo, dataItem, false, app);