Fix current location route & voice prompts in planning mode

This commit is contained in:
vshcherb 2014-03-30 21:51:41 +02:00
parent e6580e8829
commit 8cb90bbce3
5 changed files with 23 additions and 10 deletions

View file

@ -416,8 +416,8 @@ public class OsmandApplication extends Application implements ClientContext {
}
private void initVoiceDataInDifferentThread(final Activity uiContext, final String voiceProvider, final Runnable run, boolean showDialog) {
final ProgressDialog dlg = showDialog ? null : ProgressDialog.show(uiContext, getString(R.string.loading_data),
getString(R.string.voice_data_initializing));
final ProgressDialog dlg = showDialog ? ProgressDialog.show(uiContext, getString(R.string.loading_data),
getString(R.string.voice_data_initializing)) : null;
new Thread(new Runnable() {
@Override
public void run() {

View file

@ -500,8 +500,8 @@ public class MapActivityActions implements DialogProvider {
if(mode == ApplicationMode.DEFAULT) {
mode = ApplicationMode.CAR;
}
OsmandApplication app = mapActivity.getMyApplication();
app.initVoiceCommandPlayer(mapActivity);
TargetPointsHelper targets = app.getTargetPointsHelper();
app.getSettings().APPLICATION_MODE.set(mode);
app.getRoutingHelper().setAppMode(mode);

View file

@ -434,5 +434,6 @@ public class NavigateAction {
routingHelper.setFinalAndCurrentLocation(finalLocation, intermediatePoints, currentLocation, gpxRoute);
app.initVoiceCommandPlayer(mapActivity);
}
}

View file

@ -231,7 +231,6 @@ public class RoutingHelper {
if (finished) {
return null;
}
announceGpxWaypoints(currentLocation);
List<Location> routeNodes = route.getImmutableLocations();
int currentRoute = route.currentRoute;
@ -257,11 +256,15 @@ public class RoutingHelper {
// 4. Identify if UTurn is needed
boolean uTurnIsNeeded = identifyUTurnIsNeeded(currentLocation, posTolerance);
// 5. Update Voice router
boolean inRecalc = calculateRoute || isRouteBeingCalculated();
if (!inRecalc && !uTurnIsNeeded && !wrongMovementDirection) {
voiceRouter.updateStatus(currentLocation, false);
} else if (uTurnIsNeeded) {
voiceRouter.makeUTStatus();
if (isFollowingMode) {
// don't update in route planing mode
announceGpxWaypoints(currentLocation);
boolean inRecalc = calculateRoute || isRouteBeingCalculated();
if (!inRecalc && !uTurnIsNeeded && !wrongMovementDirection) {
voiceRouter.updateStatus(currentLocation, false);
} else if (uTurnIsNeeded) {
voiceRouter.makeUTStatus();
}
}
// calculate projection of current location
@ -534,7 +537,9 @@ 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) {
voiceRouter.newRouteIsCalculated(newRoute);
if(isFollowingMode) {
voiceRouter.newRouteIsCalculated(newRoute);
}
}
}
@ -890,4 +895,10 @@ public class RoutingHelper {
}
public void notifyIfRouteIsCalculated() {
if(route.isCalculated()) {
voiceRouter.newRouteIsCalculated(true) ;
}
}
}

View file

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