From fc7d91e494f369fb46fe6f332692a53755ca6c8d Mon Sep 17 00:00:00 2001 From: Alexander Sytnyk Date: Thu, 17 Aug 2017 16:15:29 +0300 Subject: [PATCH] Fix snap to road title change --- .../plus/measurementtool/MeasurementToolFragment.java | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/OsmAnd/src/net/osmand/plus/measurementtool/MeasurementToolFragment.java b/OsmAnd/src/net/osmand/plus/measurementtool/MeasurementToolFragment.java index 58f903d7e3..c623d1d5bc 100644 --- a/OsmAnd/src/net/osmand/plus/measurementtool/MeasurementToolFragment.java +++ b/OsmAnd/src/net/osmand/plus/measurementtool/MeasurementToolFragment.java @@ -480,10 +480,12 @@ public class MeasurementToolFragment extends Fragment { return iconsCache.getIcon(id, nightMode ? R.color.osmand_orange : R.color.color_myloc_distance); } - private void showSnapToRoadMenu() { + private void showSnapToRoadMenu(boolean rememberPreviousTitle) { MapActivity mapActivity = getMapActivity(); if (mapActivity != null) { - previousToolBarTitle = toolBarController.getTitle(); + if (rememberPreviousTitle) { + previousToolBarTitle = toolBarController.getTitle(); + } toolBarController.setTitle(getString(R.string.snap_to_road)); mapActivity.refreshMap(); SnapToRoadBottomSheetDialogFragment fragment = new SnapToRoadBottomSheetDialogFragment(); @@ -501,7 +503,7 @@ public class MeasurementToolFragment extends Fragment { @Override public void snapToRoadOnCLick() { if (!snapToRoadEnabled) { - showSnapToRoadMenu(); + showSnapToRoadMenu(true); } else { disableSnapToRoadMode(); } @@ -717,7 +719,7 @@ public class MeasurementToolFragment extends Fragment { snapToRoadBtn.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View view) { - showSnapToRoadMenu(); + showSnapToRoadMenu(false); } }); snapToRoadBtn.setVisibility(View.VISIBLE);