Change app mode after navigation was started

This commit is contained in:
Alexey Kulish 2016-03-14 11:01:32 +03:00
parent a7a9b3073d
commit 5750cd60c1
6 changed files with 15 additions and 8 deletions

View file

@ -945,7 +945,7 @@ public class MapActivity extends AccessibleActivity implements DownloadEvents,
changeKeyguardFlags();
updateMapSettings();
mapViewTrackingUtilities.updateSettings();
app.getRoutingHelper().setAppMode(settings.getApplicationMode());
//app.getRoutingHelper().setAppMode(settings.getApplicationMode());
if (mapLayers.getMapInfoLayer() != null) {
mapLayers.getMapInfoLayer().recreateControls();
}

View file

@ -415,7 +415,7 @@ public class MapActivityActions implements DialogProvider {
TargetPointsHelper targets = app.getTargetPointsHelper();
ApplicationMode mode = getRouteMode(from);
app.getSettings().APPLICATION_MODE.set(mode);
//app.getSettings().APPLICATION_MODE.set(mode);
app.getRoutingHelper().setAppMode(mode);
app.initVoiceCommandPlayer(mapActivity);
// save application mode controls
@ -443,7 +443,7 @@ public class MapActivityActions implements DialogProvider {
TargetPointsHelper targets = app.getTargetPointsHelper();
ApplicationMode mode = getRouteMode(null);
app.getSettings().APPLICATION_MODE.set(mode);
//app.getSettings().APPLICATION_MODE.set(mode);
app.getRoutingHelper().setAppMode(mode);
app.initVoiceCommandPlayer(mapActivity);
// save application mode controls

View file

@ -28,7 +28,7 @@ public class AppModeDialog {
if(!showDefault) {
values.remove(ApplicationMode.DEFAULT);
}
if (showDefault || settings.getApplicationMode() != ApplicationMode.DEFAULT) {
if (showDefault || (settings.getApplicationMode() != ApplicationMode.DEFAULT && !singleSelection)) {
selected.add(settings.getApplicationMode());
}
return prepareAppModeView(a, values, selected, parent, singleSelection, false, useMapTheme, onClickListener);

View file

@ -225,8 +225,9 @@ public class MapRouteInfoMenu implements IRouteInformationListener {
}
private void updateApplicationModes(final View parentView) {
final OsmandSettings settings = mapActivity.getMyApplication().getSettings();
ApplicationMode am = settings.APPLICATION_MODE.get();
//final OsmandSettings settings = mapActivity.getMyApplication().getSettings();
//ApplicationMode am = settings.APPLICATION_MODE.get();
ApplicationMode am = routingHelper.getAppMode();
final Set<ApplicationMode> selected = new HashSet<>();
selected.add(am);
ViewGroup vg = (ViewGroup) parentView.findViewById(R.id.app_modes);
@ -237,8 +238,9 @@ public class MapRouteInfoMenu implements IRouteInformationListener {
public void onClick(View v) {
if (selected.size() > 0) {
ApplicationMode next = selected.iterator().next();
settings.APPLICATION_MODE.set(next);
updateMenu();
//settings.APPLICATION_MODE.set(next);
//updateMenu();
routingHelper.setAppMode(next);
mapActivity.getRoutingHelper().recalculateRouteDueToSettingsChange();
}
}

View file

@ -97,6 +97,7 @@ public class RoutingHelper {
settings = context.getSettings();
voiceRouter = new VoiceRouter(this, settings);
provider = new RouteProvider();
setAppMode(settings.APPLICATION_MODE.get());
}

View file

@ -464,11 +464,15 @@ public class MapControlsLayer extends OsmandMapLayer {
RoutingHelper routingHelper = app.getRoutingHelper();
if (routingHelper.isFollowingMode()) {
switchToRouteFollowingLayout();
if (app.getSettings().APPLICATION_MODE.get() != routingHelper.getAppMode()) {
app.getSettings().APPLICATION_MODE.set(routingHelper.getAppMode());
}
} else {
if (!app.getTargetPointsHelper().checkPointToNavigateShort()) {
mapRouteInfoMenu.show();
} else {
touchEvent = 0;
app.getSettings().APPLICATION_MODE.set(routingHelper.getAppMode());
mapActivity.getMapViewTrackingUtilities().backToLocationImpl();
app.getSettings().FOLLOW_THE_ROUTE.set(true);
routingHelper.setFollowingMode(true);