Fix current location route & voice prompts in planning mode
This commit is contained in:
parent
e6580e8829
commit
8cb90bbce3
5 changed files with 23 additions and 10 deletions
|
@ -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() {
|
||||
|
|
|
@ -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);
|
||||
|
|
|
@ -434,5 +434,6 @@ public class NavigateAction {
|
|||
|
||||
routingHelper.setFinalAndCurrentLocation(finalLocation, intermediatePoints, currentLocation, gpxRoute);
|
||||
app.initVoiceCommandPlayer(mapActivity);
|
||||
|
||||
}
|
||||
}
|
||||
|
|
|
@ -231,7 +231,6 @@ public class RoutingHelper {
|
|||
if (finished) {
|
||||
return null;
|
||||
}
|
||||
announceGpxWaypoints(currentLocation);
|
||||
List<Location> routeNodes = route.getImmutableLocations();
|
||||
int currentRoute = route.currentRoute;
|
||||
|
||||
|
@ -257,12 +256,16 @@ public class RoutingHelper {
|
|||
// 4. Identify if UTurn is needed
|
||||
boolean uTurnIsNeeded = identifyUTurnIsNeeded(currentLocation, posTolerance);
|
||||
// 5. Update Voice router
|
||||
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
|
||||
if (currentRoute > 0) {
|
||||
|
@ -534,9 +537,11 @@ 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);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
app.runInUIThread(new Runnable() {
|
||||
@Override
|
||||
|
@ -890,4 +895,10 @@ public class RoutingHelper {
|
|||
}
|
||||
|
||||
|
||||
public void notifyIfRouteIsCalculated() {
|
||||
if(route.isCalculated()) {
|
||||
voiceRouter.newRouteIsCalculated(true) ;
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -46,6 +46,7 @@ public class MapNavigateControl extends MapControls {
|
|||
mapActivity.getMapViewTrackingUtilities().switchToRoutePlanningMode();
|
||||
routingHelper.setCurrentLocation(app.getLocationProvider().getLastKnownLocation(), false);
|
||||
app.initVoiceCommandPlayer(mapActivity);
|
||||
app.getRoutingHelper().notifyIfRouteIsCalculated();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue