Fix crash

This commit is contained in:
vshcherb 2014-03-30 22:39:36 +02:00
parent 8cb90bbce3
commit bb81c0e532
4 changed files with 3 additions and 5 deletions

View file

@ -501,10 +501,10 @@ public class MapActivityActions implements DialogProvider {
mode = ApplicationMode.CAR; mode = ApplicationMode.CAR;
} }
OsmandApplication app = mapActivity.getMyApplication(); OsmandApplication app = mapActivity.getMyApplication();
app.initVoiceCommandPlayer(mapActivity);
TargetPointsHelper targets = app.getTargetPointsHelper(); TargetPointsHelper targets = app.getTargetPointsHelper();
app.getSettings().APPLICATION_MODE.set(mode); app.getSettings().APPLICATION_MODE.set(mode);
app.getRoutingHelper().setAppMode(mode); app.getRoutingHelper().setAppMode(mode);
app.initVoiceCommandPlayer(mapActivity);
// save application mode controls // save application mode controls
settings.FOLLOW_THE_ROUTE.set(false); settings.FOLLOW_THE_ROUTE.set(false);
app.getRoutingHelper().setFollowingMode(false); app.getRoutingHelper().setFollowingMode(false);

View file

@ -537,9 +537,7 @@ public class RoutingHelper {
// trigger voice prompt only if new route is in forward direction // 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 route is in wrong direction after one more setLocation it will be recalculated
if (!wrongMovementDirection || newRoute) { if (!wrongMovementDirection || newRoute) {
if(isFollowingMode) { voiceRouter.newRouteIsCalculated(newRoute);
voiceRouter.newRouteIsCalculated(newRoute);
}
} }
} }

View file

@ -45,7 +45,6 @@ public class MapNavigateControl extends MapControls {
routingHelper.setRoutePlanningMode(false); routingHelper.setRoutePlanningMode(false);
mapActivity.getMapViewTrackingUtilities().switchToRoutePlanningMode(); mapActivity.getMapViewTrackingUtilities().switchToRoutePlanningMode();
routingHelper.setCurrentLocation(app.getLocationProvider().getLastKnownLocation(), false); routingHelper.setCurrentLocation(app.getLocationProvider().getLastKnownLocation(), false);
app.initVoiceCommandPlayer(mapActivity);
app.getRoutingHelper().notifyIfRouteIsCalculated(); app.getRoutingHelper().notifyIfRouteIsCalculated();
} }
} }

View file

@ -126,6 +126,7 @@ public abstract class AbstractPrologCommandPlayer implements CommandPlayer {
prologSystem.addTheory(new Theory("appMode('"+m.getStringKey().toLowerCase()+"').")); prologSystem.addTheory(new Theory("appMode('"+m.getStringKey().toLowerCase()+"')."));
prologSystem.addTheory(new Theory("measure('"+mc.toTTSString()+"').")); prologSystem.addTheory(new Theory("measure('"+mc.toTTSString()+"')."));
prologSystem.addTheory(new Theory(config)); prologSystem.addTheory(new Theory(config));
config.close();
} catch (InvalidTheoryException e) { } catch (InvalidTheoryException e) {
log.error("Loading voice config exception " + voiceProvider, e); //$NON-NLS-1$ log.error("Loading voice config exception " + voiceProvider, e); //$NON-NLS-1$
wrong = true; wrong = true;