From a85be2912020145f4ffef07f62d8c5a2e4847fe0 Mon Sep 17 00:00:00 2001 From: alex Date: Fri, 24 Nov 2017 15:50:31 +0200 Subject: [PATCH] Stop navigation only after "Finish navigation" click otherwise only close the menu --- .../other/DestinationReachedMenuFragment.java | 20 +++++++++---------- 1 file changed, 9 insertions(+), 11 deletions(-) diff --git a/OsmAnd/src/net/osmand/plus/mapcontextmenu/other/DestinationReachedMenuFragment.java b/OsmAnd/src/net/osmand/plus/mapcontextmenu/other/DestinationReachedMenuFragment.java index 401f6d6e3a..42c35fe2cc 100644 --- a/OsmAnd/src/net/osmand/plus/mapcontextmenu/other/DestinationReachedMenuFragment.java +++ b/OsmAnd/src/net/osmand/plus/mapcontextmenu/other/DestinationReachedMenuFragment.java @@ -51,7 +51,7 @@ public class DestinationReachedMenuFragment extends Fragment { view.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View v) { - dismissMenu(true); + dismissMenu(); } }); @@ -62,7 +62,7 @@ public class DestinationReachedMenuFragment extends Fragment { closeImageButton.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View v) { - dismissMenu(true); + dismissMenu(); } }); @@ -82,7 +82,10 @@ public class DestinationReachedMenuFragment extends Fragment { getMapActivity().getContextMenu().close(); } } - dismissMenu(true); + OsmandSettings settings = getMapActivity().getMyApplication().getSettings(); + settings.APPLICATION_MODE.set(settings.DEFAULT_APPLICATION_MODE.get()); + getMapActivity().getMapActions().stopNavigationWithoutConfirm(); + dismissMenu(); } }); @@ -96,7 +99,7 @@ public class DestinationReachedMenuFragment extends Fragment { TargetPointsHelper helper = getMapActivity().getMyApplication().getTargetPointsHelper(); TargetPoint target = helper.getPointToNavigate(); - dismissMenu(false); + dismissMenu(); if (target != null) { helper.navigateToPoint(new LatLon(target.getLatitude(), target.getLongitude()), @@ -130,7 +133,7 @@ public class DestinationReachedMenuFragment extends Fragment { newIntent.putExtra(SearchActivity.SEARCH_NEARBY, true); startActivityForResult(newIntent, 0); } - dismissMenu(false); + dismissMenu(); } }); @@ -182,12 +185,7 @@ public class DestinationReachedMenuFragment extends Fragment { .addToBackStack(TAG).commitAllowingStateLoss(); } - public void dismissMenu(boolean restoreAppMode) { - if (restoreAppMode) { - OsmandSettings settings = getMapActivity().getMyApplication().getSettings(); - settings.APPLICATION_MODE.set(settings.DEFAULT_APPLICATION_MODE.get()); - } - getMapActivity().getMapActions().stopNavigationWithoutConfirm(); + public void dismissMenu() { getMapActivity().getSupportFragmentManager().popBackStack(); }