From 9a309eadbefe74b21fe5dfc227b9e2b3c6feb9e3 Mon Sep 17 00:00:00 2001 From: crimean Date: Sat, 25 Aug 2018 19:04:10 +0300 Subject: [PATCH] Fix stop nav api action --- OsmAnd/src/net/osmand/aidl/OsmandAidlApi.java | 2 +- OsmAnd/src/net/osmand/plus/helpers/ExternalApiHelper.java | 7 ++++++- OsmAnd/src/net/osmand/plus/views/MapControlsLayer.java | 5 +++++ 3 files changed, 12 insertions(+), 2 deletions(-) diff --git a/OsmAnd/src/net/osmand/aidl/OsmandAidlApi.java b/OsmAnd/src/net/osmand/aidl/OsmandAidlApi.java index f74f77118c..0e50d9e73f 100644 --- a/OsmAnd/src/net/osmand/aidl/OsmandAidlApi.java +++ b/OsmAnd/src/net/osmand/aidl/OsmandAidlApi.java @@ -574,7 +574,7 @@ public class OsmandAidlApi { public void onReceive(Context context, Intent intent) { RoutingHelper routingHelper = mapActivity.getRoutingHelper(); if (routingHelper.isPauseNavigation() || routingHelper.isFollowingMode()) { - mapActivity.getMapLayers().getMapControlsLayer().stopNavigation(); + mapActivity.getMapLayers().getMapControlsLayer().stopNavigationWithoutConfirm(); } } }; diff --git a/OsmAnd/src/net/osmand/plus/helpers/ExternalApiHelper.java b/OsmAnd/src/net/osmand/plus/helpers/ExternalApiHelper.java index b77e369a41..59c370f6e5 100644 --- a/OsmAnd/src/net/osmand/plus/helpers/ExternalApiHelper.java +++ b/OsmAnd/src/net/osmand/plus/helpers/ExternalApiHelper.java @@ -281,24 +281,29 @@ public class ExternalApiHelper { routingHelper.setRoutePlanningMode(true); routingHelper.setFollowingMode(false); routingHelper.setPauseNavigation(true); + resultCode = Activity.RESULT_OK; } } else if (API_CMD_RESUME_NAVIGATION.equals(cmd)) { RoutingHelper routingHelper = mapActivity.getRoutingHelper(); if (routingHelper.isRouteCalculated() && routingHelper.isRoutePlanningMode()) { routingHelper.setRoutePlanningMode(false); routingHelper.setFollowingMode(true); + resultCode = Activity.RESULT_OK; } } else if (API_CMD_STOP_NAVIGATION.equals(cmd)) { RoutingHelper routingHelper = mapActivity.getRoutingHelper(); if (routingHelper.isPauseNavigation() || routingHelper.isFollowingMode()) { - mapActivity.getMapLayers().getMapControlsLayer().stopNavigation(); + mapActivity.getMapLayers().getMapControlsLayer().stopNavigationWithoutConfirm(); + resultCode = Activity.RESULT_OK; } } else if (API_CMD_MUTE_NAVIGATION.equals(cmd)) { mapActivity.getMyApplication().getSettings().VOICE_MUTE.set(true); mapActivity.getRoutingHelper().getVoiceRouter().setMute(true); + resultCode = Activity.RESULT_OK; } else if (API_CMD_UNMUTE_NAVIGATION.equals(cmd)) { mapActivity.getMyApplication().getSettings().VOICE_MUTE.set(false); mapActivity.getRoutingHelper().getVoiceRouter().setMute(false); + resultCode = Activity.RESULT_OK; } else if (API_CMD_RECORD_AUDIO.equals(cmd) || API_CMD_RECORD_VIDEO.equals(cmd) || API_CMD_RECORD_PHOTO.equals(cmd) diff --git a/OsmAnd/src/net/osmand/plus/views/MapControlsLayer.java b/OsmAnd/src/net/osmand/plus/views/MapControlsLayer.java index 6946f3bee3..1650d6b059 100644 --- a/OsmAnd/src/net/osmand/plus/views/MapControlsLayer.java +++ b/OsmAnd/src/net/osmand/plus/views/MapControlsLayer.java @@ -363,6 +363,11 @@ public class MapControlsLayer extends OsmandMapLayer { } } + public void stopNavigationWithoutConfirm() { + mapRouteInfoMenu.hide(); + mapActivity.getMapActions().stopNavigationWithoutConfirm(); + } + protected void clickRouteCancel() { stopNavigation(); }