From a8719b542fef323dcc2af7923590653ed71273b4 Mon Sep 17 00:00:00 2001 From: androiddevkotlin <64539346+androiddevkotlin@users.noreply.github.com> Date: Mon, 15 Mar 2021 23:56:14 +0200 Subject: [PATCH] Navigation > Follow track > select simplified track > edit > open "Route between points" --- .../MeasurementToolFragment.java | 19 ++++++++++++++++--- 1 file changed, 16 insertions(+), 3 deletions(-) diff --git a/OsmAnd/src/net/osmand/plus/measurementtool/MeasurementToolFragment.java b/OsmAnd/src/net/osmand/plus/measurementtool/MeasurementToolFragment.java index fcc7f0ca03..34fde58555 100644 --- a/OsmAnd/src/net/osmand/plus/measurementtool/MeasurementToolFragment.java +++ b/OsmAnd/src/net/osmand/plus/measurementtool/MeasurementToolFragment.java @@ -132,6 +132,8 @@ public class MeasurementToolFragment extends BaseOsmAndFragment implements Route private ImageView mainIcon; private String fileName; private OnBackPressedCallback onBackPressedCallback; + private boolean isShowSnapWarning; + private static final String SHOW_SNAP_WARNING = "show_snap_warning"; private InfoType currentInfoType; @@ -235,6 +237,11 @@ public class MeasurementToolFragment extends BaseOsmAndFragment implements Route if (mapActivity == null) { return null; } + if (savedInstanceState != null) { + restoreState(savedInstanceState); + } else if (getArguments() != null) { + restoreState(getArguments()); + } final MeasurementToolLayer measurementLayer = mapActivity.getMapLayers().getMeasurementToolLayer(); final OsmandApplication app = mapActivity.getMyApplication(); @@ -349,7 +356,6 @@ public class MeasurementToolFragment extends BaseOsmAndFragment implements Route } }); - View applyPointBeforeAfterButton = mainView.findViewById(R.id.apply_point_before_after_point_button); UiUtilities.setupDialogButton(nightMode, applyPointBeforeAfterButton, UiUtilities.DialogButtonType.PRIMARY, R.string.shared_string_apply); @@ -553,6 +559,7 @@ public class MeasurementToolFragment extends BaseOsmAndFragment implements Route } }); + isShowSnapWarning = getArguments().getBoolean(SHOW_SNAP_WARNING); initMeasurementMode(gpxData, savedInstanceState == null); if (savedInstanceState == null) { if (fileName != null) { @@ -1963,7 +1970,7 @@ public class MeasurementToolFragment extends BaseOsmAndFragment implements Route fragment.setEditingCtx(editingCtx); fragment.setMode(FOLLOW_TRACK_MODE, followTrackMode); Bundle bundle = new Bundle(); - bundle.putBoolean("isShowSnapWarning", isShowSnapWarning); + bundle.putBoolean(SHOW_SNAP_WARNING, isShowSnapWarning); fragment.setArguments(bundle); return showFragment(fragment, fragmentManager); } @@ -2107,7 +2114,9 @@ public class MeasurementToolFragment extends BaseOsmAndFragment implements Route manager.beginTransaction() .hide(this).commit(); layer.setTapsDisabled(true); - SnapTrackWarningFragment.showInstance(mapActivity.getSupportFragmentManager(), this); + if (isShowSnapWarning) { + SnapTrackWarningFragment.showInstance(mapActivity.getSupportFragmentManager(), this); + } AndroidUiHelper.setVisibility(mapActivity, View.GONE, R.id.map_ruler_container); } } @@ -2132,4 +2141,8 @@ public class MeasurementToolFragment extends BaseOsmAndFragment implements Route public interface OnUpdateInfoListener { void onUpdateInfo(); } + + public void restoreState(Bundle bundle) { + isShowSnapWarning = bundle.getBoolean(SHOW_SNAP_WARNING); + } } \ No newline at end of file