From c5b49de6deff0e0d7eae9412b36b19542d5a08ca Mon Sep 17 00:00:00 2001 From: Alexey Kulish Date: Thu, 3 Nov 2016 14:39:07 +0300 Subject: [PATCH] Fix app mode change while navigating --- .../mapcontextmenu/other/MapRouteInfoMenu.java | 14 ++++++++++---- 1 file changed, 10 insertions(+), 4 deletions(-) diff --git a/OsmAnd/src/net/osmand/plus/mapcontextmenu/other/MapRouteInfoMenu.java b/OsmAnd/src/net/osmand/plus/mapcontextmenu/other/MapRouteInfoMenu.java index 6f11c61e40..4e3880d133 100644 --- a/OsmAnd/src/net/osmand/plus/mapcontextmenu/other/MapRouteInfoMenu.java +++ b/OsmAnd/src/net/osmand/plus/mapcontextmenu/other/MapRouteInfoMenu.java @@ -33,6 +33,8 @@ import net.osmand.plus.MapMarkersHelper; import net.osmand.plus.MapMarkersHelper.MapMarker; import net.osmand.plus.OsmAndFormatter; import net.osmand.plus.OsmandApplication; +import net.osmand.plus.OsmandSettings; +import net.osmand.plus.OsmandSettings.OsmandPreference; import net.osmand.plus.R; import net.osmand.plus.TargetPointsHelper; import net.osmand.plus.TargetPointsHelper.TargetPoint; @@ -228,7 +230,7 @@ public class MapRouteInfoMenu implements IRouteInformationListener { private void updateApplicationModes(final View parentView) { //final OsmandSettings settings = mapActivity.getMyApplication().getSettings(); //ApplicationMode am = settings.APPLICATION_MODE.get(); - ApplicationMode am = routingHelper.getAppMode(); + final ApplicationMode am = routingHelper.getAppMode(); final Set selected = new HashSet<>(); selected.add(am); ViewGroup vg = (ViewGroup) parentView.findViewById(R.id.app_modes); @@ -239,10 +241,14 @@ public class MapRouteInfoMenu implements IRouteInformationListener { public void onClick(View v) { if (selected.size() > 0) { ApplicationMode next = selected.iterator().next(); - //settings.APPLICATION_MODE.set(next); - //updateMenu(); + OsmandPreference appMode + = mapActivity.getMyApplication().getSettings().APPLICATION_MODE; + if (routingHelper.isFollowingMode() && appMode.get() == am) { + appMode.set(next); + //updateMenu(); + } routingHelper.setAppMode(next); - mapActivity.getRoutingHelper().recalculateRouteDueToSettingsChange(); + routingHelper.recalculateRouteDueToSettingsChange(); } } });