Add sound button to all profiles
This commit is contained in:
Nazar 2019-11-05 10:25:17 +02:00
parent ef90f4e794
commit e1c76c4a0f

View file

@ -68,13 +68,9 @@ public class RoutingOptionsHelper {
app = application;
settings = app.getSettings();
addRouteMenuAppModes(ApplicationMode.CAR, PermanentAppModeOptions.CAR.routingParameters);
addRouteMenuAppModes(ApplicationMode.BICYCLE, PermanentAppModeOptions.BICYCLE.routingParameters);
addRouteMenuAppModes(ApplicationMode.PEDESTRIAN, PermanentAppModeOptions.PEDESTRIAN.routingParameters);
addRouteMenuAppModes(ApplicationMode.PUBLIC_TRANSPORT, PermanentAppModeOptions.PUBLIC_TRANSPORT.routingParameters);
addRouteMenuAppModes(ApplicationMode.BOAT, PermanentAppModeOptions.BOAT.routingParameters);
addRouteMenuAppModes(ApplicationMode.AIRCRAFT, PermanentAppModeOptions.AIRCRAFT.routingParameters);
addRouteMenuAppModes(ApplicationMode.SKI, PermanentAppModeOptions.SKI.routingParameters);
for (ApplicationMode activeMode : ApplicationMode.values(app)) {
addRouteMenuAppModes(activeMode, getRoutingParametersForProfileType(activeMode));
}
}
private void addRouteMenuAppModes(ApplicationMode am, List<String> routingParameters) {
@ -1011,4 +1007,27 @@ public class RoutingOptionsHelper {
this.routingParameters = Arrays.asList(routingParameters);
}
}
private List<String> getRoutingParametersForProfileType(ApplicationMode appMode) {
if (appMode != null) {
if (appMode.isDerivedRoutingFrom(ApplicationMode.CAR)) {
return PermanentAppModeOptions.CAR.routingParameters;
} else if (appMode.isDerivedRoutingFrom(ApplicationMode.BICYCLE)) {
return PermanentAppModeOptions.BICYCLE.routingParameters;
} else if (appMode.isDerivedRoutingFrom(ApplicationMode.PEDESTRIAN)) {
return PermanentAppModeOptions.PEDESTRIAN.routingParameters;
} else if (appMode.isDerivedRoutingFrom(ApplicationMode.PUBLIC_TRANSPORT)) {
return PermanentAppModeOptions.PUBLIC_TRANSPORT.routingParameters;
} else if (appMode.isDerivedRoutingFrom(ApplicationMode.BOAT)) {
return PermanentAppModeOptions.BOAT.routingParameters;
} else if (appMode.isDerivedRoutingFrom(ApplicationMode.AIRCRAFT)) {
return PermanentAppModeOptions.AIRCRAFT.routingParameters;
} else if (appMode.isDerivedRoutingFrom(ApplicationMode.SKI)) {
return PermanentAppModeOptions.SKI.routingParameters;
} else {
return new ArrayList<>();
}
}
return null;
}
}