From 49f68acc59c1686cdbd3bfd0efa90c0eac8d9215 Mon Sep 17 00:00:00 2001 From: Dima-1 Date: Tue, 4 Aug 2020 09:04:02 +0300 Subject: [PATCH] Fix directions empty points and save new route --- .../measurementtool/MeasurementToolFragment.java | 14 +++++++++++--- 1 file changed, 11 insertions(+), 3 deletions(-) diff --git a/OsmAnd/src/net/osmand/plus/measurementtool/MeasurementToolFragment.java b/OsmAnd/src/net/osmand/plus/measurementtool/MeasurementToolFragment.java index b641c577d8..cd8aa362d8 100644 --- a/OsmAnd/src/net/osmand/plus/measurementtool/MeasurementToolFragment.java +++ b/OsmAnd/src/net/osmand/plus/measurementtool/MeasurementToolFragment.java @@ -586,7 +586,7 @@ public class MeasurementToolFragment extends BaseOsmAndFragment { } toolBarController.setTitle(getString(R.string.route_between_points)); mapActivity.refreshMap(); - if(editingCtx.isSnapToRoadTrack()) { + if(editingCtx.isSnapToRoadTrack() || editingCtx.getNewGpxData() == null) { RouteBetweenPointsBottomSheetDialogFragment.showInstance(mapActivity.getSupportFragmentManager(), createRouteBetweenPointsFragmentListener(), editingCtx.getCalculationType(), editingCtx.getSnapToRoadAppMode()); @@ -634,7 +634,11 @@ public class MeasurementToolFragment extends BaseOsmAndFragment { if (mapActivity != null) { MapControlsLayer mapControlsLayer = mapActivity.getMapLayers().getMapControlsLayer(); if (mapControlsLayer != null) { - mapControlsLayer.doRoute(false); + if (editingCtx.getPointsCount() > 0) { + mapControlsLayer.doRoute(false); + }else{ + Toast.makeText(mapActivity, getString(R.string.none_point_error), Toast.LENGTH_SHORT).show(); + } } } } @@ -649,7 +653,11 @@ public class MeasurementToolFragment extends BaseOsmAndFragment { editingCtx.getBeforePoints().clear(); editingCtx.getBeforePoints().addAll(editingCtx.getBeforeTrkSegmentLine().points); } - addToGpx(mapActivity); + if(editingCtx.getNewGpxData()!=null) { + addToGpx(mapActivity); + }else { + saveAsGpx(SaveType.ROUTE_POINT); + } } else { Toast.makeText(mapActivity, getString(R.string.none_point_error), Toast.LENGTH_SHORT).show(); }