Merge branch 'r3.3'

This commit is contained in:
crimean 2019-04-16 18:49:26 +03:00
commit 5199df0d86
3 changed files with 39 additions and 21 deletions

View file

@ -2029,17 +2029,4 @@ public class MapRouteInfoMenu implements IRouteInformationListener, CardListener
showMenu = true;
showMenuState = menuState;
}
public enum PermanentAppModeOptions {
CAR(MuteSoundRoutingParameter.KEY, AvoidRoadsRoutingParameter.KEY),
BICYCLE(MuteSoundRoutingParameter.KEY, DRIVING_STYLE, GeneralRouter.USE_HEIGHT_OBSTACLES),
PEDESTRIAN(MuteSoundRoutingParameter.KEY, GeneralRouter.USE_HEIGHT_OBSTACLES);
List<String> routingParameters;
PermanentAppModeOptions(String... routingParameters) {
this.routingParameters = Arrays.asList(routingParameters);
}
}
}

View file

@ -31,8 +31,8 @@ import net.osmand.plus.base.bottomsheetmenu.simpleitems.DividerStartItem;
import net.osmand.plus.base.bottomsheetmenu.simpleitems.TitleItem;
import net.osmand.plus.development.OsmandDevelopmentPlugin;
import net.osmand.plus.helpers.GpxUiHelper;
import net.osmand.plus.routepreparationmenu.RoutingOptionsHelper.AvoidRoadsRoutingParameter;
import net.osmand.plus.routepreparationmenu.RoutingOptionsHelper.AvoidPTTypesRoutingParameter;
import net.osmand.plus.routepreparationmenu.RoutingOptionsHelper.AvoidRoadsRoutingParameter;
import net.osmand.plus.routepreparationmenu.RoutingOptionsHelper.DividerItem;
import net.osmand.plus.routepreparationmenu.RoutingOptionsHelper.GpxLocalRoutingParameter;
import net.osmand.plus.routepreparationmenu.RoutingOptionsHelper.LocalRoutingParameter;
@ -46,7 +46,6 @@ import net.osmand.plus.routing.RoutingHelper;
import net.osmand.router.GeneralRouter;
import java.io.File;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.List;
@ -354,7 +353,7 @@ public class RouteOptionsBottomSheet extends MenuBottomSheetDialogFragment {
}
private List<LocalRoutingParameter> getRoutingParameters(ApplicationMode applicationMode) {
List<String> routingParameters = new ArrayList<>();
List<String> routingParameters;
if (applicationMode.isDerivedRoutingFrom(ApplicationMode.CAR)) {
routingParameters = AppModeOptions.CAR.routingParameters;
} else if (applicationMode.isDerivedRoutingFrom(ApplicationMode.BICYCLE)) {
@ -483,8 +482,8 @@ public class RouteOptionsBottomSheet extends MenuBottomSheetDialogFragment {
OtherSettingsRoutingParameter.KEY,
RouteSimulationItem.KEY),
PUBLIC_TRANSPORT(// MuteSoundRoutingParameter.KEY,
// DividerItem.KEY,
PUBLIC_TRANSPORT(MuteSoundRoutingParameter.KEY,
DividerItem.KEY,
AvoidPTTypesRoutingParameter.KEY,
// ShowAlongTheRouteItem.KEY,
// DividerItem.KEY,

View file

@ -44,6 +44,7 @@ import net.osmand.util.MapUtils;
import java.io.File;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.HashMap;
import java.util.LinkedHashSet;
import java.util.List;
@ -66,9 +67,20 @@ public class RoutingOptionsHelper {
app = application;
settings = app.getSettings();
modes.put(ApplicationMode.CAR, new RouteMenuAppModes(ApplicationMode.CAR, getRoutingParameters(ApplicationMode.CAR, MapRouteInfoMenu.PermanentAppModeOptions.CAR.routingParameters)));
modes.put(ApplicationMode.BICYCLE, new RouteMenuAppModes(ApplicationMode.BICYCLE, getRoutingParameters(ApplicationMode.BICYCLE, MapRouteInfoMenu.PermanentAppModeOptions.BICYCLE.routingParameters)));
modes.put(ApplicationMode.PEDESTRIAN, new RouteMenuAppModes(ApplicationMode.PEDESTRIAN, getRoutingParameters(ApplicationMode.PEDESTRIAN, MapRouteInfoMenu.PermanentAppModeOptions.PEDESTRIAN.routingParameters)));
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.AIRCAFT.routingParameters);
addRouteMenuAppModes(ApplicationMode.HIKING, PermanentAppModeOptions.HIKING.routingParameters);
addRouteMenuAppModes(ApplicationMode.MOTORCYCLE, PermanentAppModeOptions.MOTORCYCLE.routingParameters);
addRouteMenuAppModes(ApplicationMode.TRUCK, PermanentAppModeOptions.TRUCK.routingParameters);
addRouteMenuAppModes(ApplicationMode.TRAIN, PermanentAppModeOptions.TRAIN.routingParameters);
}
private void addRouteMenuAppModes(ApplicationMode am, List<String> routingParameters) {
modes.put(am, new RouteMenuAppModes(am, getRoutingParameters(am, routingParameters)));
}
public void addNewRouteMenuParameter(ApplicationMode applicationMode, LocalRoutingParameter parameter) {
@ -951,4 +963,24 @@ public class RoutingOptionsHelper {
return false;
}
}
public enum PermanentAppModeOptions {
CAR(MuteSoundRoutingParameter.KEY, AvoidRoadsRoutingParameter.KEY),
BICYCLE(MuteSoundRoutingParameter.KEY, DRIVING_STYLE, GeneralRouter.USE_HEIGHT_OBSTACLES),
PEDESTRIAN(MuteSoundRoutingParameter.KEY, GeneralRouter.USE_HEIGHT_OBSTACLES),
PUBLIC_TRANSPORT(MuteSoundRoutingParameter.KEY),
BOAT(MuteSoundRoutingParameter.KEY),
AIRCAFT(MuteSoundRoutingParameter.KEY),
HIKING(MuteSoundRoutingParameter.KEY),
MOTORCYCLE(MuteSoundRoutingParameter.KEY),
TRUCK(MuteSoundRoutingParameter.KEY),
TRAIN(MuteSoundRoutingParameter.KEY);
List<String> routingParameters;
PermanentAppModeOptions(String... routingParameters) {
this.routingParameters = Arrays.asList(routingParameters);
}
}
}