From fdd66efc5c414f7774a0e4fa7db5ae508526a866 Mon Sep 17 00:00:00 2001 From: crimean Date: Tue, 16 Apr 2019 18:49:06 +0300 Subject: [PATCH] Show sound button in all profiles --- .../MapRouteInfoMenu.java | 13 ------- .../RouteOptionsBottomSheet.java | 9 ++--- .../RoutingOptionsHelper.java | 38 +++++++++++++++++-- 3 files changed, 39 insertions(+), 21 deletions(-) diff --git a/OsmAnd/src/net/osmand/plus/routepreparationmenu/MapRouteInfoMenu.java b/OsmAnd/src/net/osmand/plus/routepreparationmenu/MapRouteInfoMenu.java index ed3d0f61c6..bd19726243 100644 --- a/OsmAnd/src/net/osmand/plus/routepreparationmenu/MapRouteInfoMenu.java +++ b/OsmAnd/src/net/osmand/plus/routepreparationmenu/MapRouteInfoMenu.java @@ -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 routingParameters; - - PermanentAppModeOptions(String... routingParameters) { - this.routingParameters = Arrays.asList(routingParameters); - } - } } \ No newline at end of file diff --git a/OsmAnd/src/net/osmand/plus/routepreparationmenu/RouteOptionsBottomSheet.java b/OsmAnd/src/net/osmand/plus/routepreparationmenu/RouteOptionsBottomSheet.java index 2aa68c397e..9e1e3ff4b9 100644 --- a/OsmAnd/src/net/osmand/plus/routepreparationmenu/RouteOptionsBottomSheet.java +++ b/OsmAnd/src/net/osmand/plus/routepreparationmenu/RouteOptionsBottomSheet.java @@ -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 getRoutingParameters(ApplicationMode applicationMode) { - List routingParameters = new ArrayList<>(); + List 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, diff --git a/OsmAnd/src/net/osmand/plus/routepreparationmenu/RoutingOptionsHelper.java b/OsmAnd/src/net/osmand/plus/routepreparationmenu/RoutingOptionsHelper.java index 7e176b8210..552702bfeb 100644 --- a/OsmAnd/src/net/osmand/plus/routepreparationmenu/RoutingOptionsHelper.java +++ b/OsmAnd/src/net/osmand/plus/routepreparationmenu/RoutingOptionsHelper.java @@ -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 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 routingParameters; + + PermanentAppModeOptions(String... routingParameters) { + this.routingParameters = Arrays.asList(routingParameters); + } + } } \ No newline at end of file