Change app mode after navigation was started
This commit is contained in:
parent
a7a9b3073d
commit
5750cd60c1
6 changed files with 15 additions and 8 deletions
|
@ -945,7 +945,7 @@ public class MapActivity extends AccessibleActivity implements DownloadEvents,
|
||||||
changeKeyguardFlags();
|
changeKeyguardFlags();
|
||||||
updateMapSettings();
|
updateMapSettings();
|
||||||
mapViewTrackingUtilities.updateSettings();
|
mapViewTrackingUtilities.updateSettings();
|
||||||
app.getRoutingHelper().setAppMode(settings.getApplicationMode());
|
//app.getRoutingHelper().setAppMode(settings.getApplicationMode());
|
||||||
if (mapLayers.getMapInfoLayer() != null) {
|
if (mapLayers.getMapInfoLayer() != null) {
|
||||||
mapLayers.getMapInfoLayer().recreateControls();
|
mapLayers.getMapInfoLayer().recreateControls();
|
||||||
}
|
}
|
||||||
|
|
|
@ -415,7 +415,7 @@ public class MapActivityActions implements DialogProvider {
|
||||||
TargetPointsHelper targets = app.getTargetPointsHelper();
|
TargetPointsHelper targets = app.getTargetPointsHelper();
|
||||||
|
|
||||||
ApplicationMode mode = getRouteMode(from);
|
ApplicationMode mode = getRouteMode(from);
|
||||||
app.getSettings().APPLICATION_MODE.set(mode);
|
//app.getSettings().APPLICATION_MODE.set(mode);
|
||||||
app.getRoutingHelper().setAppMode(mode);
|
app.getRoutingHelper().setAppMode(mode);
|
||||||
app.initVoiceCommandPlayer(mapActivity);
|
app.initVoiceCommandPlayer(mapActivity);
|
||||||
// save application mode controls
|
// save application mode controls
|
||||||
|
@ -443,7 +443,7 @@ public class MapActivityActions implements DialogProvider {
|
||||||
TargetPointsHelper targets = app.getTargetPointsHelper();
|
TargetPointsHelper targets = app.getTargetPointsHelper();
|
||||||
|
|
||||||
ApplicationMode mode = getRouteMode(null);
|
ApplicationMode mode = getRouteMode(null);
|
||||||
app.getSettings().APPLICATION_MODE.set(mode);
|
//app.getSettings().APPLICATION_MODE.set(mode);
|
||||||
app.getRoutingHelper().setAppMode(mode);
|
app.getRoutingHelper().setAppMode(mode);
|
||||||
app.initVoiceCommandPlayer(mapActivity);
|
app.initVoiceCommandPlayer(mapActivity);
|
||||||
// save application mode controls
|
// save application mode controls
|
||||||
|
|
|
@ -28,7 +28,7 @@ public class AppModeDialog {
|
||||||
if(!showDefault) {
|
if(!showDefault) {
|
||||||
values.remove(ApplicationMode.DEFAULT);
|
values.remove(ApplicationMode.DEFAULT);
|
||||||
}
|
}
|
||||||
if (showDefault || settings.getApplicationMode() != ApplicationMode.DEFAULT) {
|
if (showDefault || (settings.getApplicationMode() != ApplicationMode.DEFAULT && !singleSelection)) {
|
||||||
selected.add(settings.getApplicationMode());
|
selected.add(settings.getApplicationMode());
|
||||||
}
|
}
|
||||||
return prepareAppModeView(a, values, selected, parent, singleSelection, false, useMapTheme, onClickListener);
|
return prepareAppModeView(a, values, selected, parent, singleSelection, false, useMapTheme, onClickListener);
|
||||||
|
|
|
@ -225,8 +225,9 @@ public class MapRouteInfoMenu implements IRouteInformationListener {
|
||||||
}
|
}
|
||||||
|
|
||||||
private void updateApplicationModes(final View parentView) {
|
private void updateApplicationModes(final View parentView) {
|
||||||
final OsmandSettings settings = mapActivity.getMyApplication().getSettings();
|
//final OsmandSettings settings = mapActivity.getMyApplication().getSettings();
|
||||||
ApplicationMode am = settings.APPLICATION_MODE.get();
|
//ApplicationMode am = settings.APPLICATION_MODE.get();
|
||||||
|
ApplicationMode am = routingHelper.getAppMode();
|
||||||
final Set<ApplicationMode> selected = new HashSet<>();
|
final Set<ApplicationMode> selected = new HashSet<>();
|
||||||
selected.add(am);
|
selected.add(am);
|
||||||
ViewGroup vg = (ViewGroup) parentView.findViewById(R.id.app_modes);
|
ViewGroup vg = (ViewGroup) parentView.findViewById(R.id.app_modes);
|
||||||
|
@ -237,8 +238,9 @@ public class MapRouteInfoMenu implements IRouteInformationListener {
|
||||||
public void onClick(View v) {
|
public void onClick(View v) {
|
||||||
if (selected.size() > 0) {
|
if (selected.size() > 0) {
|
||||||
ApplicationMode next = selected.iterator().next();
|
ApplicationMode next = selected.iterator().next();
|
||||||
settings.APPLICATION_MODE.set(next);
|
//settings.APPLICATION_MODE.set(next);
|
||||||
updateMenu();
|
//updateMenu();
|
||||||
|
routingHelper.setAppMode(next);
|
||||||
mapActivity.getRoutingHelper().recalculateRouteDueToSettingsChange();
|
mapActivity.getRoutingHelper().recalculateRouteDueToSettingsChange();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -97,6 +97,7 @@ public class RoutingHelper {
|
||||||
settings = context.getSettings();
|
settings = context.getSettings();
|
||||||
voiceRouter = new VoiceRouter(this, settings);
|
voiceRouter = new VoiceRouter(this, settings);
|
||||||
provider = new RouteProvider();
|
provider = new RouteProvider();
|
||||||
|
setAppMode(settings.APPLICATION_MODE.get());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -464,11 +464,15 @@ public class MapControlsLayer extends OsmandMapLayer {
|
||||||
RoutingHelper routingHelper = app.getRoutingHelper();
|
RoutingHelper routingHelper = app.getRoutingHelper();
|
||||||
if (routingHelper.isFollowingMode()) {
|
if (routingHelper.isFollowingMode()) {
|
||||||
switchToRouteFollowingLayout();
|
switchToRouteFollowingLayout();
|
||||||
|
if (app.getSettings().APPLICATION_MODE.get() != routingHelper.getAppMode()) {
|
||||||
|
app.getSettings().APPLICATION_MODE.set(routingHelper.getAppMode());
|
||||||
|
}
|
||||||
} else {
|
} else {
|
||||||
if (!app.getTargetPointsHelper().checkPointToNavigateShort()) {
|
if (!app.getTargetPointsHelper().checkPointToNavigateShort()) {
|
||||||
mapRouteInfoMenu.show();
|
mapRouteInfoMenu.show();
|
||||||
} else {
|
} else {
|
||||||
touchEvent = 0;
|
touchEvent = 0;
|
||||||
|
app.getSettings().APPLICATION_MODE.set(routingHelper.getAppMode());
|
||||||
mapActivity.getMapViewTrackingUtilities().backToLocationImpl();
|
mapActivity.getMapViewTrackingUtilities().backToLocationImpl();
|
||||||
app.getSettings().FOLLOW_THE_ROUTE.set(true);
|
app.getSettings().FOLLOW_THE_ROUTE.set(true);
|
||||||
routingHelper.setFollowingMode(true);
|
routingHelper.setFollowingMode(true);
|
||||||
|
|
Loading…
Reference in a new issue