From f232395a71d701a8917345062955d655f3a42e27 Mon Sep 17 00:00:00 2001 From: Dima-1 Date: Tue, 1 Sep 2020 13:49:28 +0300 Subject: [PATCH 1/4] Disable ability to add new points while GPX Approximation menu is using. --- .../measurementtool/MeasurementEditingContext.java | 10 ++++++++++ .../measurementtool/MeasurementToolFragment.java | 14 +++++++++++--- .../plus/measurementtool/MeasurementToolLayer.java | 2 +- 3 files changed, 22 insertions(+), 4 deletions(-) diff --git a/OsmAnd/src/net/osmand/plus/measurementtool/MeasurementEditingContext.java b/OsmAnd/src/net/osmand/plus/measurementtool/MeasurementEditingContext.java index 74bdbce787..b1ef048ec0 100644 --- a/OsmAnd/src/net/osmand/plus/measurementtool/MeasurementEditingContext.java +++ b/OsmAnd/src/net/osmand/plus/measurementtool/MeasurementEditingContext.java @@ -60,6 +60,7 @@ public class MeasurementEditingContext { private WptPt originalPointToMove; private boolean inAddPointMode; + private boolean inApproximationMode; private int calculatedPairs; private int pointsToCalculateSize; private CalculationMode lastCalculationMode = WHOLE_TRACK; @@ -175,6 +176,15 @@ public class MeasurementEditingContext { this.inAddPointMode = inAddPointMode; } + public boolean isInApproximationMode() { + return inApproximationMode; + } + + public void setInApproximationMode(boolean inApproximationMode) { + this.inApproximationMode = inApproximationMode; + } + + @Nullable GpxData getGpxData() { return gpxData; diff --git a/OsmAnd/src/net/osmand/plus/measurementtool/MeasurementToolFragment.java b/OsmAnd/src/net/osmand/plus/measurementtool/MeasurementToolFragment.java index 55286a0461..d69fccc3c5 100644 --- a/OsmAnd/src/net/osmand/plus/measurementtool/MeasurementToolFragment.java +++ b/OsmAnd/src/net/osmand/plus/measurementtool/MeasurementToolFragment.java @@ -443,13 +443,18 @@ public class MeasurementToolFragment extends BaseOsmAndFragment implements Route StartPlanRouteBottomSheet.showInstance(mapActivity.getSupportFragmentManager(), createStartPlanRouteListener()); } else if (!editingCtx.isNewData() && !editingCtx.hasRoutePoints() && !editingCtx.hasRoute() && editingCtx.getPointsCount() > 1) { - SnapTrackWarningBottomSheet.showInstance(mapActivity.getSupportFragmentManager(), this); + showSnapTrackWarning(mapActivity); } } return view; } + private void showSnapTrackWarning(MapActivity mapActivity) { + editingCtx.setInApproximationMode(true); + SnapTrackWarningBottomSheet.showInstance(mapActivity.getSupportFragmentManager(), this); + } + public boolean isInEditMode() { return !planRouteMode && !editingCtx.isNewData() && !directionMode; } @@ -596,7 +601,7 @@ public class MeasurementToolFragment extends BaseOsmAndFragment implements Route : RouteBetweenPointsDialogMode.ALL, editingCtx.getAppMode()); } else { - SnapTrackWarningBottomSheet.showInstance(mapActivity.getSupportFragmentManager(), this); + showSnapTrackWarning(mapActivity); } } } @@ -628,6 +633,7 @@ public class MeasurementToolFragment extends BaseOsmAndFragment implements Route case SnapTrackWarningBottomSheet.CANCEL_RESULT_CODE: toolBarController.setSaveViewVisible(true); directionMode = false; + editingCtx.setInApproximationMode(false); updateToolbar(); break; case SnapTrackWarningBottomSheet.CONTINUE_RESULT_CODE: @@ -693,7 +699,7 @@ public class MeasurementToolFragment extends BaseOsmAndFragment implements Route mapActions.enterRoutePlanningModeGivenGpx(gpx, appMode, null, null, true, true, MenuState.HEADER_ONLY); } else { directionMode = true; - SnapTrackWarningBottomSheet.showInstance(mapActivity.getSupportFragmentManager(), this); + showSnapTrackWarning(mapActivity); } } } @@ -2041,6 +2047,7 @@ public class MeasurementToolFragment extends BaseOsmAndFragment implements Route @Override public void onApplyGpxApproximation() { + editingCtx.setInApproximationMode(false); doAddOrMovePointCommonStuff(); if (directionMode) { directionMode = false; @@ -2066,6 +2073,7 @@ public class MeasurementToolFragment extends BaseOsmAndFragment implements Route @Override public void onCancelGpxApproximation() { editingCtx.getCommandManager().undo(); + editingCtx.setInApproximationMode(false); directionMode = false; updateSnapToRoadControls(); updateToolbar(); diff --git a/OsmAnd/src/net/osmand/plus/measurementtool/MeasurementToolLayer.java b/OsmAnd/src/net/osmand/plus/measurementtool/MeasurementToolLayer.java index 268696bb5f..0c56a8c270 100644 --- a/OsmAnd/src/net/osmand/plus/measurementtool/MeasurementToolLayer.java +++ b/OsmAnd/src/net/osmand/plus/measurementtool/MeasurementToolLayer.java @@ -102,7 +102,7 @@ public class MeasurementToolLayer extends OsmandMapLayer implements ContextMenuL @Override public boolean onSingleTap(PointF point, RotatedTileBox tileBox) { - if (inMeasurementMode && editingCtx.getSelectedPointPosition() == -1) { + if (inMeasurementMode && !editingCtx.isInApproximationMode() && editingCtx.getSelectedPointPosition() == -1) { if (!overlapped) { selectPoint(point.x, point.y, true); } From 9c1ffd6c1317312aa4ff66659535b9b2fbd416e1 Mon Sep 17 00:00:00 2001 From: Dima-1 Date: Tue, 1 Sep 2020 19:43:28 +0300 Subject: [PATCH 2/4] Show original track line --- .../measurementtool/MeasurementEditingContext.java | 8 ++++++++ .../plus/measurementtool/MeasurementToolLayer.java | 10 +++++++++- 2 files changed, 17 insertions(+), 1 deletion(-) diff --git a/OsmAnd/src/net/osmand/plus/measurementtool/MeasurementEditingContext.java b/OsmAnd/src/net/osmand/plus/measurementtool/MeasurementEditingContext.java index b1ef048ec0..226e512a20 100644 --- a/OsmAnd/src/net/osmand/plus/measurementtool/MeasurementEditingContext.java +++ b/OsmAnd/src/net/osmand/plus/measurementtool/MeasurementEditingContext.java @@ -61,6 +61,7 @@ public class MeasurementEditingContext { private boolean inAddPointMode; private boolean inApproximationMode; + List originalTrackPointList = new ArrayList<>(); private int calculatedPairs; private int pointsToCalculateSize; private CalculationMode lastCalculationMode = WHOLE_TRACK; @@ -69,6 +70,7 @@ public class MeasurementEditingContext { private RouteCalculationProgress calculationProgress; private Map, RoadSegmentData> roadSegmentData = new ConcurrentHashMap<>(); + public enum CalculationMode { NEXT_SEGMENT, WHOLE_TRACK @@ -182,8 +184,14 @@ public class MeasurementEditingContext { public void setInApproximationMode(boolean inApproximationMode) { this.inApproximationMode = inApproximationMode; + if (inApproximationMode) { + originalTrackPointList = new ArrayList<>(before.points); + } } + public List getOriginalTrackPointList() { + return originalTrackPointList; + } @Nullable GpxData getGpxData() { diff --git a/OsmAnd/src/net/osmand/plus/measurementtool/MeasurementToolLayer.java b/OsmAnd/src/net/osmand/plus/measurementtool/MeasurementToolLayer.java index 0c56a8c270..ee12e8f205 100644 --- a/OsmAnd/src/net/osmand/plus/measurementtool/MeasurementToolLayer.java +++ b/OsmAnd/src/net/osmand/plus/measurementtool/MeasurementToolLayer.java @@ -7,6 +7,8 @@ import android.graphics.Paint; import android.graphics.Path; import android.graphics.PointF; +import androidx.core.content.ContextCompat; + import net.osmand.GPXUtilities.TrkSegment; import net.osmand.GPXUtilities.WptPt; import net.osmand.Location; @@ -178,7 +180,13 @@ public class MeasurementToolLayer extends OsmandMapLayer implements ContextMenuL TrkSegment after = editingCtx.getAfterTrkSegmentLine(); new Renderable.StandardTrack(new ArrayList<>(after.points), 17.2). drawSegment(view.getZoom(), lineAttrs.paint, canvas, tb); - + if (editingCtx.isInApproximationMode()) { + List current = editingCtx.getOriginalTrackPointList(); + lineAttrs.customColorPaint.setColor(ContextCompat.getColor(view.getContext(), + R.color.activity_background_transparent_color_dark)); + new Renderable.StandardTrack(new ArrayList<>(current), 17.2). + drawSegment(view.getZoom(), lineAttrs.customColorPaint, canvas, tb); + } drawPoints(canvas, tb); } } From 027dc3af352dda13b5193d59e10b87b2060e6f84 Mon Sep 17 00:00:00 2001 From: Dima-1 Date: Thu, 3 Sep 2020 13:26:51 +0300 Subject: [PATCH 3/4] Fix review --- .../MeasurementEditingContext.java | 13 ++++---- .../MeasurementToolFragment.java | 30 +++++++++++++------ .../measurementtool/MeasurementToolLayer.java | 21 ++++++++----- .../command/AddPointCommand.java | 2 +- .../command/ApplyGpxApproximationCommand.java | 6 +++- .../command/ChangeRouteModeCommand.java | 2 +- .../command/ClearPointsCommand.java | 2 +- .../command/MeasurementCommandManager.java | 4 +++ .../command/MeasurementModeCommand.java | 2 +- .../command/MovePointCommand.java | 2 +- .../command/RemovePointCommand.java | 2 +- .../command/ReorderPointCommand.java | 2 +- 12 files changed, 59 insertions(+), 29 deletions(-) diff --git a/OsmAnd/src/net/osmand/plus/measurementtool/MeasurementEditingContext.java b/OsmAnd/src/net/osmand/plus/measurementtool/MeasurementEditingContext.java index 226e512a20..eaeb91026b 100644 --- a/OsmAnd/src/net/osmand/plus/measurementtool/MeasurementEditingContext.java +++ b/OsmAnd/src/net/osmand/plus/measurementtool/MeasurementEditingContext.java @@ -13,7 +13,9 @@ import net.osmand.LocationsHolder; import net.osmand.binary.BinaryMapRouteReaderAdapter.RouteRegion; import net.osmand.data.LatLon; import net.osmand.plus.OsmandApplication; +import net.osmand.plus.measurementtool.command.ApplyGpxApproximationCommand; import net.osmand.plus.measurementtool.command.MeasurementCommandManager; +import net.osmand.plus.measurementtool.command.MeasurementModeCommand; import net.osmand.plus.routing.RouteCalculationParams; import net.osmand.plus.routing.RouteCalculationParams.RouteCalculationResultListener; import net.osmand.plus.routing.RouteCalculationResult; @@ -41,6 +43,7 @@ import java.util.Map; import java.util.concurrent.ConcurrentHashMap; import static net.osmand.plus.measurementtool.MeasurementEditingContext.CalculationMode.WHOLE_TRACK; +import static net.osmand.plus.measurementtool.command.MeasurementModeCommand.MeasurementCommandType.*; public class MeasurementEditingContext { @@ -61,7 +64,6 @@ public class MeasurementEditingContext { private boolean inAddPointMode; private boolean inApproximationMode; - List originalTrackPointList = new ArrayList<>(); private int calculatedPairs; private int pointsToCalculateSize; private CalculationMode lastCalculationMode = WHOLE_TRACK; @@ -184,13 +186,14 @@ public class MeasurementEditingContext { public void setInApproximationMode(boolean inApproximationMode) { this.inApproximationMode = inApproximationMode; - if (inApproximationMode) { - originalTrackPointList = new ArrayList<>(before.points); - } } public List getOriginalTrackPointList() { - return originalTrackPointList; + MeasurementModeCommand command = commandManager.getLastCommand(); + if (command.getType() == APPROXIMATE_POINTS) { + return ((ApplyGpxApproximationCommand) command).getPoints(); + } + return null; } @Nullable diff --git a/OsmAnd/src/net/osmand/plus/measurementtool/MeasurementToolFragment.java b/OsmAnd/src/net/osmand/plus/measurementtool/MeasurementToolFragment.java index d69fccc3c5..bee70f689b 100644 --- a/OsmAnd/src/net/osmand/plus/measurementtool/MeasurementToolFragment.java +++ b/OsmAnd/src/net/osmand/plus/measurementtool/MeasurementToolFragment.java @@ -443,16 +443,19 @@ public class MeasurementToolFragment extends BaseOsmAndFragment implements Route StartPlanRouteBottomSheet.showInstance(mapActivity.getSupportFragmentManager(), createStartPlanRouteListener()); } else if (!editingCtx.isNewData() && !editingCtx.hasRoutePoints() && !editingCtx.hasRoute() && editingCtx.getPointsCount() > 1) { - showSnapTrackWarning(mapActivity); + enterApproximationMode(mapActivity); } } return view; } - private void showSnapTrackWarning(MapActivity mapActivity) { - editingCtx.setInApproximationMode(true); - SnapTrackWarningBottomSheet.showInstance(mapActivity.getSupportFragmentManager(), this); + private void enterApproximationMode(MapActivity mapActivity) { + MeasurementToolLayer layer = getMeasurementLayer(); + if (layer != null) { + layer.setTapsDisabled(true); + SnapTrackWarningBottomSheet.showInstance(mapActivity.getSupportFragmentManager(), this); + } } public boolean isInEditMode() { @@ -601,7 +604,7 @@ public class MeasurementToolFragment extends BaseOsmAndFragment implements Route : RouteBetweenPointsDialogMode.ALL, editingCtx.getAppMode()); } else { - showSnapTrackWarning(mapActivity); + enterApproximationMode(mapActivity); } } } @@ -633,7 +636,7 @@ public class MeasurementToolFragment extends BaseOsmAndFragment implements Route case SnapTrackWarningBottomSheet.CANCEL_RESULT_CODE: toolBarController.setSaveViewVisible(true); directionMode = false; - editingCtx.setInApproximationMode(false); + afterExitApproximationMode(); updateToolbar(); break; case SnapTrackWarningBottomSheet.CONTINUE_RESULT_CODE: @@ -699,7 +702,7 @@ public class MeasurementToolFragment extends BaseOsmAndFragment implements Route mapActions.enterRoutePlanningModeGivenGpx(gpx, appMode, null, null, true, true, MenuState.HEADER_ONLY); } else { directionMode = true; - showSnapTrackWarning(mapActivity); + enterApproximationMode(mapActivity); } } } @@ -2034,6 +2037,7 @@ public class MeasurementToolFragment extends BaseOsmAndFragment implements Route public void onGpxApproximationDone(GpxRouteApproximation gpxApproximation, ApplicationMode mode) { MeasurementToolLayer measurementLayer = getMeasurementLayer(); if (measurementLayer != null) { + editingCtx.setInApproximationMode(true); ApplyGpxApproximationCommand command = new ApplyGpxApproximationCommand(measurementLayer, gpxApproximation, mode); if (!editingCtx.getCommandManager().update(command)) { editingCtx.getCommandManager().execute(command); @@ -2047,7 +2051,7 @@ public class MeasurementToolFragment extends BaseOsmAndFragment implements Route @Override public void onApplyGpxApproximation() { - editingCtx.setInApproximationMode(false); + afterExitApproximationMode(); doAddOrMovePointCommonStuff(); if (directionMode) { directionMode = false; @@ -2073,9 +2077,17 @@ public class MeasurementToolFragment extends BaseOsmAndFragment implements Route @Override public void onCancelGpxApproximation() { editingCtx.getCommandManager().undo(); - editingCtx.setInApproximationMode(false); + afterExitApproximationMode(); directionMode = false; updateSnapToRoadControls(); updateToolbar(); } + + private void afterExitApproximationMode() { + editingCtx.setInApproximationMode(false); + MeasurementToolLayer layer = getMeasurementLayer(); + if (layer != null) { + layer.setTapsDisabled(false); + } + } } diff --git a/OsmAnd/src/net/osmand/plus/measurementtool/MeasurementToolLayer.java b/OsmAnd/src/net/osmand/plus/measurementtool/MeasurementToolLayer.java index ee12e8f205..63d10688dc 100644 --- a/OsmAnd/src/net/osmand/plus/measurementtool/MeasurementToolLayer.java +++ b/OsmAnd/src/net/osmand/plus/measurementtool/MeasurementToolLayer.java @@ -51,6 +51,7 @@ public class MeasurementToolLayer extends OsmandMapLayer implements ContextMenuL private OnEnterMovePointModeListener enterMovePointModeListener; private LatLon pressedPointLatLon; private boolean overlapped; + private boolean tapsDisabled; private MeasurementEditingContext editingCtx; @Override @@ -102,9 +103,13 @@ public class MeasurementToolLayer extends OsmandMapLayer implements ContextMenuL this.inMeasurementMode = inMeasurementMode; } + public void setTapsDisabled(boolean tapsDisabled) { + this.tapsDisabled = tapsDisabled; + } + @Override public boolean onSingleTap(PointF point, RotatedTileBox tileBox) { - if (inMeasurementMode && !editingCtx.isInApproximationMode() && editingCtx.getSelectedPointPosition() == -1) { + if (inMeasurementMode && !tapsDisabled && editingCtx.getSelectedPointPosition() == -1) { if (!overlapped) { selectPoint(point.x, point.y, true); } @@ -120,7 +125,7 @@ public class MeasurementToolLayer extends OsmandMapLayer implements ContextMenuL @Override public boolean onLongPressEvent(PointF point, RotatedTileBox tileBox) { - if (inMeasurementMode) { + if (inMeasurementMode && !tapsDisabled) { if (!overlapped && getEditingCtx().getSelectedPointPosition() == -1 && editingCtx.getPointsCount() > 0) { selectPoint(point.x, point.y, false); if (editingCtx.getSelectedPointPosition() != -1) { @@ -181,11 +186,13 @@ public class MeasurementToolLayer extends OsmandMapLayer implements ContextMenuL new Renderable.StandardTrack(new ArrayList<>(after.points), 17.2). drawSegment(view.getZoom(), lineAttrs.paint, canvas, tb); if (editingCtx.isInApproximationMode()) { - List current = editingCtx.getOriginalTrackPointList(); - lineAttrs.customColorPaint.setColor(ContextCompat.getColor(view.getContext(), - R.color.activity_background_transparent_color_dark)); - new Renderable.StandardTrack(new ArrayList<>(current), 17.2). - drawSegment(view.getZoom(), lineAttrs.customColorPaint, canvas, tb); + List originalTrackPointList = editingCtx.getOriginalTrackPointList(); + if (originalTrackPointList != null) { + lineAttrs.customColorPaint.setColor(ContextCompat.getColor(view.getContext(), + R.color.activity_background_transparent_color_dark)); + new Renderable.StandardTrack(new ArrayList<>(originalTrackPointList), 17.2). + drawSegment(view.getZoom(), lineAttrs.customColorPaint, canvas, tb); + } } drawPoints(canvas, tb); } diff --git a/OsmAnd/src/net/osmand/plus/measurementtool/command/AddPointCommand.java b/OsmAnd/src/net/osmand/plus/measurementtool/command/AddPointCommand.java index 436f42aae5..2d4afe4ccd 100644 --- a/OsmAnd/src/net/osmand/plus/measurementtool/command/AddPointCommand.java +++ b/OsmAnd/src/net/osmand/plus/measurementtool/command/AddPointCommand.java @@ -64,7 +64,7 @@ public class AddPointCommand extends MeasurementModeCommand { } @Override - MeasurementCommandType getType() { + public MeasurementCommandType getType() { return MeasurementCommandType.ADD_POINT; } } diff --git a/OsmAnd/src/net/osmand/plus/measurementtool/command/ApplyGpxApproximationCommand.java b/OsmAnd/src/net/osmand/plus/measurementtool/command/ApplyGpxApproximationCommand.java index f9a79c96b6..99488a753e 100644 --- a/OsmAnd/src/net/osmand/plus/measurementtool/command/ApplyGpxApproximationCommand.java +++ b/OsmAnd/src/net/osmand/plus/measurementtool/command/ApplyGpxApproximationCommand.java @@ -22,8 +22,12 @@ public class ApplyGpxApproximationCommand extends MeasurementModeCommand { this.mode = mode; } + public List getPoints() { + return points; + } + @Override - MeasurementCommandType getType() { + public MeasurementCommandType getType() { return MeasurementCommandType.APPROXIMATE_POINTS; } diff --git a/OsmAnd/src/net/osmand/plus/measurementtool/command/ChangeRouteModeCommand.java b/OsmAnd/src/net/osmand/plus/measurementtool/command/ChangeRouteModeCommand.java index 9d3e9efaf0..383431bd65 100644 --- a/OsmAnd/src/net/osmand/plus/measurementtool/command/ChangeRouteModeCommand.java +++ b/OsmAnd/src/net/osmand/plus/measurementtool/command/ChangeRouteModeCommand.java @@ -123,7 +123,7 @@ public class ChangeRouteModeCommand extends MeasurementModeCommand { } @Override - MeasurementCommandType getType() { + public MeasurementCommandType getType() { return MeasurementCommandType.CHANGE_ROUTE_MODE; } diff --git a/OsmAnd/src/net/osmand/plus/measurementtool/command/ClearPointsCommand.java b/OsmAnd/src/net/osmand/plus/measurementtool/command/ClearPointsCommand.java index c447c18ba6..2e5b9aaf85 100644 --- a/OsmAnd/src/net/osmand/plus/measurementtool/command/ClearPointsCommand.java +++ b/OsmAnd/src/net/osmand/plus/measurementtool/command/ClearPointsCommand.java @@ -61,7 +61,7 @@ public class ClearPointsCommand extends MeasurementModeCommand { } @Override - MeasurementCommandType getType() { + public MeasurementCommandType getType() { return MeasurementCommandType.CLEAR_POINTS; } } diff --git a/OsmAnd/src/net/osmand/plus/measurementtool/command/MeasurementCommandManager.java b/OsmAnd/src/net/osmand/plus/measurementtool/command/MeasurementCommandManager.java index d809029f76..a1b5cad3ef 100644 --- a/OsmAnd/src/net/osmand/plus/measurementtool/command/MeasurementCommandManager.java +++ b/OsmAnd/src/net/osmand/plus/measurementtool/command/MeasurementCommandManager.java @@ -78,4 +78,8 @@ public class MeasurementCommandManager { command.setMeasurementLayer(layer); } } + + public MeasurementModeCommand getLastCommand() { + return undoCommands.getLast(); + } } diff --git a/OsmAnd/src/net/osmand/plus/measurementtool/command/MeasurementModeCommand.java b/OsmAnd/src/net/osmand/plus/measurementtool/command/MeasurementModeCommand.java index 99230f61e5..434ce81ea9 100644 --- a/OsmAnd/src/net/osmand/plus/measurementtool/command/MeasurementModeCommand.java +++ b/OsmAnd/src/net/osmand/plus/measurementtool/command/MeasurementModeCommand.java @@ -22,7 +22,7 @@ public abstract class MeasurementModeCommand implements Command { return false; } - abstract MeasurementCommandType getType(); + public abstract MeasurementCommandType getType(); MeasurementEditingContext getEditingCtx() { return measurementLayer.getEditingCtx(); diff --git a/OsmAnd/src/net/osmand/plus/measurementtool/command/MovePointCommand.java b/OsmAnd/src/net/osmand/plus/measurementtool/command/MovePointCommand.java index c734e6810a..f0b690fc7e 100644 --- a/OsmAnd/src/net/osmand/plus/measurementtool/command/MovePointCommand.java +++ b/OsmAnd/src/net/osmand/plus/measurementtool/command/MovePointCommand.java @@ -36,7 +36,7 @@ public class MovePointCommand extends MeasurementModeCommand { } @Override - MeasurementCommandType getType() { + public MeasurementCommandType getType() { return MeasurementCommandType.MOVE_POINT; } } diff --git a/OsmAnd/src/net/osmand/plus/measurementtool/command/RemovePointCommand.java b/OsmAnd/src/net/osmand/plus/measurementtool/command/RemovePointCommand.java index d112b8dfbf..c420d1c42e 100644 --- a/OsmAnd/src/net/osmand/plus/measurementtool/command/RemovePointCommand.java +++ b/OsmAnd/src/net/osmand/plus/measurementtool/command/RemovePointCommand.java @@ -34,7 +34,7 @@ public class RemovePointCommand extends MeasurementModeCommand { } @Override - MeasurementCommandType getType() { + public MeasurementCommandType getType() { return MeasurementCommandType.REMOVE_POINT; } } diff --git a/OsmAnd/src/net/osmand/plus/measurementtool/command/ReorderPointCommand.java b/OsmAnd/src/net/osmand/plus/measurementtool/command/ReorderPointCommand.java index 52ba7e8047..302371e490 100644 --- a/OsmAnd/src/net/osmand/plus/measurementtool/command/ReorderPointCommand.java +++ b/OsmAnd/src/net/osmand/plus/measurementtool/command/ReorderPointCommand.java @@ -41,7 +41,7 @@ public class ReorderPointCommand extends MeasurementModeCommand { } @Override - MeasurementCommandType getType() { + public MeasurementCommandType getType() { return MeasurementCommandType.REORDER_POINT; } } From 22cb9dd0212fd6f0aa0486b35eefd0312294334d Mon Sep 17 00:00:00 2001 From: Dima-1 Date: Thu, 3 Sep 2020 13:49:11 +0300 Subject: [PATCH 4/4] Fix review --- .../plus/measurementtool/MeasurementToolFragment.java | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/OsmAnd/src/net/osmand/plus/measurementtool/MeasurementToolFragment.java b/OsmAnd/src/net/osmand/plus/measurementtool/MeasurementToolFragment.java index bee70f689b..d6ca7cb187 100644 --- a/OsmAnd/src/net/osmand/plus/measurementtool/MeasurementToolFragment.java +++ b/OsmAnd/src/net/osmand/plus/measurementtool/MeasurementToolFragment.java @@ -636,7 +636,7 @@ public class MeasurementToolFragment extends BaseOsmAndFragment implements Route case SnapTrackWarningBottomSheet.CANCEL_RESULT_CODE: toolBarController.setSaveViewVisible(true); directionMode = false; - afterExitApproximationMode(); + exitApproximationMode(); updateToolbar(); break; case SnapTrackWarningBottomSheet.CONTINUE_RESULT_CODE: @@ -2051,7 +2051,7 @@ public class MeasurementToolFragment extends BaseOsmAndFragment implements Route @Override public void onApplyGpxApproximation() { - afterExitApproximationMode(); + exitApproximationMode(); doAddOrMovePointCommonStuff(); if (directionMode) { directionMode = false; @@ -2077,13 +2077,13 @@ public class MeasurementToolFragment extends BaseOsmAndFragment implements Route @Override public void onCancelGpxApproximation() { editingCtx.getCommandManager().undo(); - afterExitApproximationMode(); + exitApproximationMode(); directionMode = false; updateSnapToRoadControls(); updateToolbar(); } - private void afterExitApproximationMode() { + private void exitApproximationMode() { editingCtx.setInApproximationMode(false); MeasurementToolLayer layer = getMeasurementLayer(); if (layer != null) {