Minor fixes in plan route and follow track

This commit is contained in:
Vitaliy 2020-09-22 16:13:40 +03:00
parent d6e4bd5b8b
commit a5610b7352
2 changed files with 24 additions and 11 deletions

View file

@ -536,7 +536,7 @@ public class MeasurementToolFragment extends BaseOsmAndFragment implements Route
editingCtx.getCommandManager().setMeasurementLayer(mapActivity.getMapLayers().getMeasurementToolLayer());
enterMeasurementMode();
updateSnapToRoadControls();
if (gpxData != null) {
if (gpxData != null && addPoints) {
if (!isUndoMode()) {
List<WptPt> points = gpxData.getGpxFile().getRoutePoints();
if (!points.isEmpty()) {
@ -546,13 +546,11 @@ public class MeasurementToolFragment extends BaseOsmAndFragment implements Route
}
}
}
if (addPoints) {
ActionType actionType = gpxData.getActionType();
if (actionType == ActionType.ADD_ROUTE_POINTS) {
displayRoutePoints();
} else if (actionType == ActionType.EDIT_SEGMENT) {
displaySegmentPoints();
}
ActionType actionType = gpxData.getActionType();
if (actionType == ActionType.ADD_ROUTE_POINTS) {
displayRoutePoints();
} else if (actionType == ActionType.EDIT_SEGMENT) {
displaySegmentPoints();
}
}
setMode(UNDO_MODE, false);
@ -807,7 +805,11 @@ public class MeasurementToolFragment extends BaseOsmAndFragment implements Route
@Override
public void saveChangesOnClick() {
saveChanges(FinalSaveAction.SHOW_TOAST, true);
if (isFollowTrackMode()) {
startTrackNavigation();
} else {
saveChanges(FinalSaveAction.SHOW_TOAST, true);
}
}
@Override

View file

@ -63,6 +63,7 @@ import net.osmand.plus.routing.RouteProvider.GPXRouteParamsBuilder;
import net.osmand.plus.routing.RoutingHelper;
import net.osmand.plus.settings.backend.ApplicationMode;
import net.osmand.plus.views.layers.MapControlsLayer;
import net.osmand.util.Algorithms;
import org.apache.commons.logging.Log;
@ -185,8 +186,18 @@ public class FollowTrackFragment extends ContextMenuScrollFragment implements Ca
setupTracksCard();
} else {
File file = new File(gpxFile.path);
GPXInfo gpxInfo = new GPXInfo(gpxFile.path, file.lastModified(), file.length());
String fileName = null;
File file = null;
if (!Algorithms.isEmpty(gpxFile.path)) {
file = new File(gpxFile.path);
fileName = file.getName();
} else if (!Algorithms.isEmpty(gpxFile.tracks)) {
fileName = gpxFile.tracks.get(0).name;
}
if (Algorithms.isEmpty(fileName)) {
fileName = app.getString(R.string.shared_string_gpx_track);
}
GPXInfo gpxInfo = new GPXInfo(fileName, file != null ? file.lastModified() : 0, file != null ? file.length() : 0);
TrackEditCard importTrackCard = new TrackEditCard(mapActivity, gpxInfo);
importTrackCard.setListener(this);
cardsContainer.addView(importTrackCard.build(mapActivity));