Fix stop nav api action

This commit is contained in:
crimean 2018-08-25 19:04:10 +03:00
parent 191a3ef99d
commit c8bee8f39b
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) {
RoutingHelper routingHelper = mapActivity.getRoutingHelper();
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.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)

View file

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