Fix stop nav api action

This commit is contained in:
crimean 2018-08-25 19:04:10 +03:00
parent 038c6b305f
commit 9a309eadbe
3 changed files with 12 additions and 2 deletions

View file

@ -574,7 +574,7 @@ public class OsmandAidlApi {
public void onReceive(Context context, Intent intent) { public void onReceive(Context context, Intent intent) {
RoutingHelper routingHelper = mapActivity.getRoutingHelper(); RoutingHelper routingHelper = mapActivity.getRoutingHelper();
if (routingHelper.isPauseNavigation() || routingHelper.isFollowingMode()) { if (routingHelper.isPauseNavigation() || routingHelper.isFollowingMode()) {
mapActivity.getMapLayers().getMapControlsLayer().stopNavigation(); mapActivity.getMapLayers().getMapControlsLayer().stopNavigationWithoutConfirm();
} }
} }
}; };

View file

@ -281,24 +281,29 @@ public class ExternalApiHelper {
routingHelper.setRoutePlanningMode(true); routingHelper.setRoutePlanningMode(true);
routingHelper.setFollowingMode(false); routingHelper.setFollowingMode(false);
routingHelper.setPauseNavigation(true); routingHelper.setPauseNavigation(true);
resultCode = Activity.RESULT_OK;
} }
} else if (API_CMD_RESUME_NAVIGATION.equals(cmd)) { } else if (API_CMD_RESUME_NAVIGATION.equals(cmd)) {
RoutingHelper routingHelper = mapActivity.getRoutingHelper(); RoutingHelper routingHelper = mapActivity.getRoutingHelper();
if (routingHelper.isRouteCalculated() && routingHelper.isRoutePlanningMode()) { if (routingHelper.isRouteCalculated() && routingHelper.isRoutePlanningMode()) {
routingHelper.setRoutePlanningMode(false); routingHelper.setRoutePlanningMode(false);
routingHelper.setFollowingMode(true); routingHelper.setFollowingMode(true);
resultCode = Activity.RESULT_OK;
} }
} else if (API_CMD_STOP_NAVIGATION.equals(cmd)) { } else if (API_CMD_STOP_NAVIGATION.equals(cmd)) {
RoutingHelper routingHelper = mapActivity.getRoutingHelper(); RoutingHelper routingHelper = mapActivity.getRoutingHelper();
if (routingHelper.isPauseNavigation() || routingHelper.isFollowingMode()) { 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)) { } else if (API_CMD_MUTE_NAVIGATION.equals(cmd)) {
mapActivity.getMyApplication().getSettings().VOICE_MUTE.set(true); mapActivity.getMyApplication().getSettings().VOICE_MUTE.set(true);
mapActivity.getRoutingHelper().getVoiceRouter().setMute(true); mapActivity.getRoutingHelper().getVoiceRouter().setMute(true);
resultCode = Activity.RESULT_OK;
} else if (API_CMD_UNMUTE_NAVIGATION.equals(cmd)) { } else if (API_CMD_UNMUTE_NAVIGATION.equals(cmd)) {
mapActivity.getMyApplication().getSettings().VOICE_MUTE.set(false); mapActivity.getMyApplication().getSettings().VOICE_MUTE.set(false);
mapActivity.getRoutingHelper().getVoiceRouter().setMute(false); mapActivity.getRoutingHelper().getVoiceRouter().setMute(false);
resultCode = Activity.RESULT_OK;
} else if (API_CMD_RECORD_AUDIO.equals(cmd) } else if (API_CMD_RECORD_AUDIO.equals(cmd)
|| API_CMD_RECORD_VIDEO.equals(cmd) || API_CMD_RECORD_VIDEO.equals(cmd)
|| API_CMD_RECORD_PHOTO.equals(cmd) || API_CMD_RECORD_PHOTO.equals(cmd)

View file

@ -363,6 +363,11 @@ public class MapControlsLayer extends OsmandMapLayer {
} }
} }
public void stopNavigationWithoutConfirm() {
mapRouteInfoMenu.hide();
mapActivity.getMapActions().stopNavigationWithoutConfirm();
}
protected void clickRouteCancel() { protected void clickRouteCancel() {
stopNavigation(); stopNavigation();
} }