From 29b03fd0eab4a822627c4dd6a454ede82f8aba29 Mon Sep 17 00:00:00 2001 From: Victor Shcherb Date: Fri, 14 Feb 2020 18:07:27 +0100 Subject: [PATCH] Fix settigns for straight to --- .../src/net/osmand/plus/routing/RoutingHelper.java | 4 ++-- .../plus/settings/RouteParametersFragment.java | 14 ++++++-------- 2 files changed, 8 insertions(+), 10 deletions(-) diff --git a/OsmAnd/src/net/osmand/plus/routing/RoutingHelper.java b/OsmAnd/src/net/osmand/plus/routing/RoutingHelper.java index 8d5a6a2178..33d114a333 100644 --- a/OsmAnd/src/net/osmand/plus/routing/RoutingHelper.java +++ b/OsmAnd/src/net/osmand/plus/routing/RoutingHelper.java @@ -413,8 +413,8 @@ public class RoutingHelper { if (mc == OsmandSettings.MetricsConstants.KILOMETERS_AND_METERS || mc == OsmandSettings.MetricsConstants.MILES_AND_METERS) { return 500.f; } else { - // 1500 ft - return 457.2f; + // 1/4 mile + return 482.f; } } return posTolerance * ALLOWED_DEVIATION; diff --git a/OsmAnd/src/net/osmand/plus/settings/RouteParametersFragment.java b/OsmAnd/src/net/osmand/plus/settings/RouteParametersFragment.java index 111ae75948..e2281a557c 100644 --- a/OsmAnd/src/net/osmand/plus/settings/RouteParametersFragment.java +++ b/OsmAnd/src/net/osmand/plus/settings/RouteParametersFragment.java @@ -140,12 +140,12 @@ public class RouteParametersFragment extends BaseSettingsFragment implements OnP ApplicationMode am = getSelectedAppMode(); - float posTolerance = (float) RoutingHelper.getDefaultAllowedDeviation(settings, RoutingHelper.getPosTolerance(0)); + float defaultAllowedDeviation = RoutingHelper.getDefaultAllowedDeviation(settings, RoutingHelper.getPosTolerance(0)); if (am.getRouteService() != RouteProvider.RouteService.OSMAND) { screen.addPreference(fastRoute); - setupSelectRouteRecalcDistance(screen, posTolerance); + setupSelectRouteRecalcDistance(screen, defaultAllowedDeviation); } else { - setupSelectRouteRecalcDistance(screen, posTolerance); + setupSelectRouteRecalcDistance(screen, defaultAllowedDeviation); GeneralRouter router = getRouter(getMyApplication().getRoutingConfig(), am); clearParameters(); if (router != null) { @@ -234,7 +234,7 @@ public class RouteParametersFragment extends BaseSettingsFragment implements OnP } } - private void setupSelectRouteRecalcDistance(PreferenceScreen screen, float posTolerance) { + private void setupSelectRouteRecalcDistance(PreferenceScreen screen, float defaultAllowedDeviation) { Float[] entryValues; OsmandSettings settings = app.getSettings(); OsmandSettings.MetricsConstants mc = settings.METRIC_SYSTEM.get(); @@ -246,18 +246,16 @@ public class RouteParametersFragment extends BaseSettingsFragment implements OnP String[] entries = new String[entryValues.length]; entries[0] = getString(R.string.no_recalculation_setting); - String defaultDistance = OsmAndFormatter.getFormattedDistance(settings.ROUTE_RECALCULATION_DISTANCE.getProfileDefaultValue(settings.getApplicationMode()), - app, false); + String defaultDistance = defaultAllowedDeviation < 0 ? getString(R.string.no_recalculation_setting) : + OsmAndFormatter.getFormattedDistance(defaultAllowedDeviation , app, false); entries[1] = String.format(getString(R.string.shared_string_app_default_w_val), defaultDistance); for (int i = 2; i < entryValues.length; i++) { entries[i] = OsmAndFormatter.getFormattedDistance(entryValues[i], app, false); } - ListPreferenceEx routeRecalculationDist = createListPreferenceEx(settings.ROUTE_RECALCULATION_DISTANCE.getId(), entries, entryValues, R.string.route_recalculation_dist_title, R.layout.preference_with_descr); - routeRecalculationDist.setEntries(entries); routeRecalculationDist.setEntryValues(entryValues); routeRecalculationDist.setDescription(getString(R.string.route_recalculation_dist_descr));