From bb81c0e53285d62ab768657792ebfe53b3c16eeb Mon Sep 17 00:00:00 2001 From: vshcherb Date: Sun, 30 Mar 2014 22:39:36 +0200 Subject: [PATCH] Fix crash --- OsmAnd/src/net/osmand/plus/activities/MapActivityActions.java | 2 +- OsmAnd/src/net/osmand/plus/routing/RoutingHelper.java | 4 +--- .../net/osmand/plus/views/controls/MapNavigateControl.java | 1 - .../net/osmand/plus/voice/AbstractPrologCommandPlayer.java | 1 + 4 files changed, 3 insertions(+), 5 deletions(-) diff --git a/OsmAnd/src/net/osmand/plus/activities/MapActivityActions.java b/OsmAnd/src/net/osmand/plus/activities/MapActivityActions.java index dca1e94ae8..282888b07b 100644 --- a/OsmAnd/src/net/osmand/plus/activities/MapActivityActions.java +++ b/OsmAnd/src/net/osmand/plus/activities/MapActivityActions.java @@ -501,10 +501,10 @@ public class MapActivityActions implements DialogProvider { mode = ApplicationMode.CAR; } OsmandApplication app = mapActivity.getMyApplication(); - app.initVoiceCommandPlayer(mapActivity); TargetPointsHelper targets = app.getTargetPointsHelper(); app.getSettings().APPLICATION_MODE.set(mode); app.getRoutingHelper().setAppMode(mode); + app.initVoiceCommandPlayer(mapActivity); // save application mode controls settings.FOLLOW_THE_ROUTE.set(false); app.getRoutingHelper().setFollowingMode(false); diff --git a/OsmAnd/src/net/osmand/plus/routing/RoutingHelper.java b/OsmAnd/src/net/osmand/plus/routing/RoutingHelper.java index 46b2af6132..313a06bbf1 100644 --- a/OsmAnd/src/net/osmand/plus/routing/RoutingHelper.java +++ b/OsmAnd/src/net/osmand/plus/routing/RoutingHelper.java @@ -537,9 +537,7 @@ public class RoutingHelper { // trigger voice prompt only if new route is in forward direction // If route is in wrong direction after one more setLocation it will be recalculated if (!wrongMovementDirection || newRoute) { - if(isFollowingMode) { - voiceRouter.newRouteIsCalculated(newRoute); - } + voiceRouter.newRouteIsCalculated(newRoute); } } diff --git a/OsmAnd/src/net/osmand/plus/views/controls/MapNavigateControl.java b/OsmAnd/src/net/osmand/plus/views/controls/MapNavigateControl.java index 134fff4274..09cf44bd74 100644 --- a/OsmAnd/src/net/osmand/plus/views/controls/MapNavigateControl.java +++ b/OsmAnd/src/net/osmand/plus/views/controls/MapNavigateControl.java @@ -45,7 +45,6 @@ public class MapNavigateControl extends MapControls { routingHelper.setRoutePlanningMode(false); mapActivity.getMapViewTrackingUtilities().switchToRoutePlanningMode(); routingHelper.setCurrentLocation(app.getLocationProvider().getLastKnownLocation(), false); - app.initVoiceCommandPlayer(mapActivity); app.getRoutingHelper().notifyIfRouteIsCalculated(); } } diff --git a/OsmAnd/src/net/osmand/plus/voice/AbstractPrologCommandPlayer.java b/OsmAnd/src/net/osmand/plus/voice/AbstractPrologCommandPlayer.java index 1a36955956..18159429e9 100644 --- a/OsmAnd/src/net/osmand/plus/voice/AbstractPrologCommandPlayer.java +++ b/OsmAnd/src/net/osmand/plus/voice/AbstractPrologCommandPlayer.java @@ -126,6 +126,7 @@ public abstract class AbstractPrologCommandPlayer implements CommandPlayer { prologSystem.addTheory(new Theory("appMode('"+m.getStringKey().toLowerCase()+"').")); prologSystem.addTheory(new Theory("measure('"+mc.toTTSString()+"').")); prologSystem.addTheory(new Theory(config)); + config.close(); } catch (InvalidTheoryException e) { log.error("Loading voice config exception " + voiceProvider, e); //$NON-NLS-1$ wrong = true;