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) {
|
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),
|
final ProgressDialog dlg = showDialog ? ProgressDialog.show(uiContext, getString(R.string.loading_data),
|
||||||
getString(R.string.voice_data_initializing));
|
getString(R.string.voice_data_initializing)) : null;
|
||||||
new Thread(new Runnable() {
|
new Thread(new Runnable() {
|
||||||
@Override
|
@Override
|
||||||
public void run() {
|
public void run() {
|
||||||
|
|
|
@ -500,8 +500,8 @@ public class MapActivityActions implements DialogProvider {
|
||||||
if(mode == ApplicationMode.DEFAULT) {
|
if(mode == ApplicationMode.DEFAULT) {
|
||||||
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);
|
||||||
|
|
|
@ -434,5 +434,6 @@ public class NavigateAction {
|
||||||
|
|
||||||
routingHelper.setFinalAndCurrentLocation(finalLocation, intermediatePoints, currentLocation, gpxRoute);
|
routingHelper.setFinalAndCurrentLocation(finalLocation, intermediatePoints, currentLocation, gpxRoute);
|
||||||
app.initVoiceCommandPlayer(mapActivity);
|
app.initVoiceCommandPlayer(mapActivity);
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -231,7 +231,6 @@ public class RoutingHelper {
|
||||||
if (finished) {
|
if (finished) {
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
announceGpxWaypoints(currentLocation);
|
|
||||||
List<Location> routeNodes = route.getImmutableLocations();
|
List<Location> routeNodes = route.getImmutableLocations();
|
||||||
int currentRoute = route.currentRoute;
|
int currentRoute = route.currentRoute;
|
||||||
|
|
||||||
|
@ -257,12 +256,16 @@ public class RoutingHelper {
|
||||||
// 4. Identify if UTurn is needed
|
// 4. Identify if UTurn is needed
|
||||||
boolean uTurnIsNeeded = identifyUTurnIsNeeded(currentLocation, posTolerance);
|
boolean uTurnIsNeeded = identifyUTurnIsNeeded(currentLocation, posTolerance);
|
||||||
// 5. Update Voice router
|
// 5. Update Voice router
|
||||||
|
if (isFollowingMode) {
|
||||||
|
// don't update in route planing mode
|
||||||
|
announceGpxWaypoints(currentLocation);
|
||||||
boolean inRecalc = calculateRoute || isRouteBeingCalculated();
|
boolean inRecalc = calculateRoute || isRouteBeingCalculated();
|
||||||
if (!inRecalc && !uTurnIsNeeded && !wrongMovementDirection) {
|
if (!inRecalc && !uTurnIsNeeded && !wrongMovementDirection) {
|
||||||
voiceRouter.updateStatus(currentLocation, false);
|
voiceRouter.updateStatus(currentLocation, false);
|
||||||
} else if (uTurnIsNeeded) {
|
} else if (uTurnIsNeeded) {
|
||||||
voiceRouter.makeUTStatus();
|
voiceRouter.makeUTStatus();
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
// calculate projection of current location
|
// calculate projection of current location
|
||||||
if (currentRoute > 0) {
|
if (currentRoute > 0) {
|
||||||
|
@ -534,9 +537,11 @@ 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);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
app.runInUIThread(new Runnable() {
|
app.runInUIThread(new Runnable() {
|
||||||
@Override
|
@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();
|
mapActivity.getMapViewTrackingUtilities().switchToRoutePlanningMode();
|
||||||
routingHelper.setCurrentLocation(app.getLocationProvider().getLastKnownLocation(), false);
|
routingHelper.setCurrentLocation(app.getLocationProvider().getLastKnownLocation(), false);
|
||||||
app.initVoiceCommandPlayer(mapActivity);
|
app.initVoiceCommandPlayer(mapActivity);
|
||||||
|
app.getRoutingHelper().notifyIfRouteIsCalculated();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue