Fix settigns for straight to
This commit is contained in:
parent
116673f081
commit
29b03fd0ea
2 changed files with 8 additions and 10 deletions
|
@ -413,8 +413,8 @@ public class RoutingHelper {
|
||||||
if (mc == OsmandSettings.MetricsConstants.KILOMETERS_AND_METERS || mc == OsmandSettings.MetricsConstants.MILES_AND_METERS) {
|
if (mc == OsmandSettings.MetricsConstants.KILOMETERS_AND_METERS || mc == OsmandSettings.MetricsConstants.MILES_AND_METERS) {
|
||||||
return 500.f;
|
return 500.f;
|
||||||
} else {
|
} else {
|
||||||
// 1500 ft
|
// 1/4 mile
|
||||||
return 457.2f;
|
return 482.f;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return posTolerance * ALLOWED_DEVIATION;
|
return posTolerance * ALLOWED_DEVIATION;
|
||||||
|
|
|
@ -140,12 +140,12 @@ public class RouteParametersFragment extends BaseSettingsFragment implements OnP
|
||||||
|
|
||||||
|
|
||||||
ApplicationMode am = getSelectedAppMode();
|
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) {
|
if (am.getRouteService() != RouteProvider.RouteService.OSMAND) {
|
||||||
screen.addPreference(fastRoute);
|
screen.addPreference(fastRoute);
|
||||||
setupSelectRouteRecalcDistance(screen, posTolerance);
|
setupSelectRouteRecalcDistance(screen, defaultAllowedDeviation);
|
||||||
} else {
|
} else {
|
||||||
setupSelectRouteRecalcDistance(screen, posTolerance);
|
setupSelectRouteRecalcDistance(screen, defaultAllowedDeviation);
|
||||||
GeneralRouter router = getRouter(getMyApplication().getRoutingConfig(), am);
|
GeneralRouter router = getRouter(getMyApplication().getRoutingConfig(), am);
|
||||||
clearParameters();
|
clearParameters();
|
||||||
if (router != null) {
|
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;
|
Float[] entryValues;
|
||||||
OsmandSettings settings = app.getSettings();
|
OsmandSettings settings = app.getSettings();
|
||||||
OsmandSettings.MetricsConstants mc = settings.METRIC_SYSTEM.get();
|
OsmandSettings.MetricsConstants mc = settings.METRIC_SYSTEM.get();
|
||||||
|
@ -246,18 +246,16 @@ public class RouteParametersFragment extends BaseSettingsFragment implements OnP
|
||||||
|
|
||||||
String[] entries = new String[entryValues.length];
|
String[] entries = new String[entryValues.length];
|
||||||
entries[0] = getString(R.string.no_recalculation_setting);
|
entries[0] = getString(R.string.no_recalculation_setting);
|
||||||
String defaultDistance = OsmAndFormatter.getFormattedDistance(settings.ROUTE_RECALCULATION_DISTANCE.getProfileDefaultValue(settings.getApplicationMode()),
|
String defaultDistance = defaultAllowedDeviation < 0 ? getString(R.string.no_recalculation_setting) :
|
||||||
app, false);
|
OsmAndFormatter.getFormattedDistance(defaultAllowedDeviation , app, false);
|
||||||
entries[1] = String.format(getString(R.string.shared_string_app_default_w_val), defaultDistance);
|
entries[1] = String.format(getString(R.string.shared_string_app_default_w_val), defaultDistance);
|
||||||
|
|
||||||
for (int i = 2; i < entryValues.length; i++) {
|
for (int i = 2; i < entryValues.length; i++) {
|
||||||
entries[i] = OsmAndFormatter.getFormattedDistance(entryValues[i], app, false);
|
entries[i] = OsmAndFormatter.getFormattedDistance(entryValues[i], app, false);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
ListPreferenceEx routeRecalculationDist = createListPreferenceEx(settings.ROUTE_RECALCULATION_DISTANCE.getId(),
|
ListPreferenceEx routeRecalculationDist = createListPreferenceEx(settings.ROUTE_RECALCULATION_DISTANCE.getId(),
|
||||||
entries, entryValues, R.string.route_recalculation_dist_title, R.layout.preference_with_descr);
|
entries, entryValues, R.string.route_recalculation_dist_title, R.layout.preference_with_descr);
|
||||||
|
|
||||||
routeRecalculationDist.setEntries(entries);
|
routeRecalculationDist.setEntries(entries);
|
||||||
routeRecalculationDist.setEntryValues(entryValues);
|
routeRecalculationDist.setEntryValues(entryValues);
|
||||||
routeRecalculationDist.setDescription(getString(R.string.route_recalculation_dist_descr));
|
routeRecalculationDist.setDescription(getString(R.string.route_recalculation_dist_descr));
|
||||||
|
|
Loading…
Reference in a new issue