From f0ba8d20dc1933bc48e59c67c5e08b11de2e27ba Mon Sep 17 00:00:00 2001 From: Chumva Date: Thu, 7 Mar 2019 12:04:01 +0200 Subject: [PATCH] create routingOptionsHelper variable --- .../AvoidRoadsBottomSheetDialogFragment.java | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/OsmAnd/src/net/osmand/plus/routepreparationmenu/AvoidRoadsBottomSheetDialogFragment.java b/OsmAnd/src/net/osmand/plus/routepreparationmenu/AvoidRoadsBottomSheetDialogFragment.java index 1cd3c6223f..3505a53bee 100644 --- a/OsmAnd/src/net/osmand/plus/routepreparationmenu/AvoidRoadsBottomSheetDialogFragment.java +++ b/OsmAnd/src/net/osmand/plus/routepreparationmenu/AvoidRoadsBottomSheetDialogFragment.java @@ -50,6 +50,8 @@ public class AvoidRoadsBottomSheetDialogFragment extends MenuBottomSheetDialogFr private static final String AVOID_ROADS_TYPES_KEY = "avoid_roads_types"; private static final String AVOID_ROADS_OBJECTS_KEY = "avoid_roads_objects"; + private RoutingOptionsHelper routingOptionsHelper; + private HashMap routingParametersMap; private List removedImpassableRoads; private LinearLayout stylesContainer; @@ -62,6 +64,7 @@ public class AvoidRoadsBottomSheetDialogFragment extends MenuBottomSheetDialogFr if (app == null) { return; } + routingOptionsHelper = app.getRoutingOptionsHelper(); if (savedInstanceState != null) { if (savedInstanceState.containsKey(AVOID_ROADS_TYPES_KEY)) { routingParametersMap = (HashMap) savedInstanceState.getSerializable(AVOID_ROADS_TYPES_KEY); @@ -200,7 +203,7 @@ public class AvoidRoadsBottomSheetDialogFragment extends MenuBottomSheetDialogFr for (Map.Entry entry : routingParametersMap.entrySet()) { final String parameterId = entry.getKey(); boolean selected = entry.getValue(); - GeneralRouter.RoutingParameter parameter = app.getRoutingOptionsHelper().getRoutingPrefsForAppModeById(app.getRoutingHelper().getAppMode(), parameterId); + GeneralRouter.RoutingParameter parameter = routingOptionsHelper.getRoutingPrefsForAppModeById(app.getRoutingHelper().getAppMode(), parameterId); String defValue = ""; if (parameter != null) { defValue = parameter.getName(); @@ -266,7 +269,7 @@ public class AvoidRoadsBottomSheetDialogFragment extends MenuBottomSheetDialogFr for (Map.Entry entry : routingParametersMap.entrySet()) { String parameterId = entry.getKey(); - GeneralRouter.RoutingParameter parameter = app.getRoutingOptionsHelper().getRoutingPrefsForAppModeById(app.getRoutingHelper().getAppMode(), parameterId); + GeneralRouter.RoutingParameter parameter = routingOptionsHelper.getRoutingPrefsForAppModeById(app.getRoutingHelper().getAppMode(), parameterId); if (parameter != null) { boolean checked = entry.getValue(); OsmandSettings.CommonPreference preference = app.getSettings().getCustomRoutingBooleanProperty(parameter.getId(), parameter.getDefaultBoolean()); @@ -298,7 +301,7 @@ public class AvoidRoadsBottomSheetDialogFragment extends MenuBottomSheetDialogFr @NonNull private HashMap generateStylesMap(OsmandApplication app) { HashMap res = new HashMap<>(); - List avoidParameters = app.getRoutingOptionsHelper().getAvoidRoutingPrefsForAppMode(app.getRoutingHelper().getAppMode()); + List avoidParameters = routingOptionsHelper.getAvoidRoutingPrefsForAppMode(app.getRoutingHelper().getAppMode()); for (GeneralRouter.RoutingParameter parameter : avoidParameters) { OsmandSettings.CommonPreference preference = app.getSettings().getCustomRoutingBooleanProperty(parameter.getId(), parameter.getDefaultBoolean());