diff --git a/OsmAnd/src/net/osmand/plus/OsmandSettings.java b/OsmAnd/src/net/osmand/plus/OsmandSettings.java index 0383c1a0f4..e52cac68f4 100644 --- a/OsmAnd/src/net/osmand/plus/OsmandSettings.java +++ b/OsmAnd/src/net/osmand/plus/OsmandSettings.java @@ -675,9 +675,12 @@ public class OsmandSettings { public final OsmandPreference ARRIVAL_DISTANCE_FACTOR = new FloatPreference("arrival_distance_factor", 1f).makeProfile(); - public final OsmandPreference SPEED_LIMIT_EXCEED = + public final OsmandPreference SPEED_LIMIT_EXCEED_KM = new FloatPreference("speed_limit_exceed", 5f).makeProfile(); + public final OsmandPreference SPEED_LIMIT_EXCEED_MILE = + new FloatPreference("speed_limit_exceed", 3f).makeProfile(); + // this value string is synchronized with settings_pref.xml preference name public final OsmandPreference USE_TRACKBALL_FOR_MOVEMENTS = new BooleanPreference("use_trackball_for_movements", true).makeGlobal(); diff --git a/OsmAnd/src/net/osmand/plus/activities/SettingsNavigationActivity.java b/OsmAnd/src/net/osmand/plus/activities/SettingsNavigationActivity.java index 0113f32147..34b2d415c7 100644 --- a/OsmAnd/src/net/osmand/plus/activities/SettingsNavigationActivity.java +++ b/OsmAnd/src/net/osmand/plus/activities/SettingsNavigationActivity.java @@ -112,9 +112,9 @@ public class SettingsNavigationActivity extends SettingsBaseActivity { registerListPreference(settings.ARRIVAL_DISTANCE_FACTOR, screen, arrivalNames, arrivalValues); ApplicationMode mode = getMyApplication().getSettings().getApplicationMode(); - if (mode == ApplicationMode.CAR || mode == ApplicationMode.TRUCK || mode == ApplicationMode.MOTORCYCLE){ - Float[] speedLimits = new Float[] {5f, 7f, 10f, 15f, 20f}; + if (mode.isDerivedRoutingFrom(ApplicationMode.CAR)){ if (settings.METRIC_SYSTEM.get() == OsmandSettings.MetricsConstants.KILOMETERS_AND_METERS){ + Float[] speedLimits = new Float[] {5f, 7f, 10f, 15f, 20f}; String[] speedNames = new String[] { speedLimits[0] + " " + getString(R.string.km_h), @@ -122,15 +122,16 @@ public class SettingsNavigationActivity extends SettingsBaseActivity { speedLimits[2] + " " + getString(R.string.km_h), speedLimits[3] + " " + getString(R.string.km_h), speedLimits[4] + " " + getString(R.string.km_h)}; - registerListPreference(settings.SPEED_LIMIT_EXCEED, screen, speedNames, speedLimits); + registerListPreference(settings.SPEED_LIMIT_EXCEED_KM, screen, speedNames, speedLimits); } else { + Float[] speedLimits = new Float[] {3f, 5f, 7f, 10f, 15f}; String[] speedNames = new String[] { speedLimits[0] + " " + getString(R.string.mile_per_hour), speedLimits[1] + " " + getString(R.string.mile_per_hour), speedLimits[2] + " " + getString(R.string.mile_per_hour), speedLimits[3] + " " + getString(R.string.mile_per_hour), speedLimits[4] + " " + getString(R.string.mile_per_hour)}; - registerListPreference(settings.SPEED_LIMIT_EXCEED, screen, speedNames, speedLimits); + registerListPreference(settings.SPEED_LIMIT_EXCEED_MILE, screen, speedNames, speedLimits); } } diff --git a/OsmAnd/src/net/osmand/plus/helpers/WaypointHelper.java b/OsmAnd/src/net/osmand/plus/helpers/WaypointHelper.java index 888ce601e1..752e892022 100644 --- a/OsmAnd/src/net/osmand/plus/helpers/WaypointHelper.java +++ b/OsmAnd/src/net/osmand/plus/helpers/WaypointHelper.java @@ -159,9 +159,9 @@ public class WaypointHelper { float mxspeed = route.getCurrentMaxSpeed(); float delta; if (app.getSettings().METRIC_SYSTEM.get() == MetricsConstants.KILOMETERS_AND_METERS){ - delta = app.getSettings().SPEED_LIMIT_EXCEED.get(); + delta = app.getSettings().SPEED_LIMIT_EXCEED_KM.get(); } else { - delta = app.getSettings().SPEED_LIMIT_EXCEED.get() * 1.6f; + delta = app.getSettings().SPEED_LIMIT_EXCEED_KM.get() * 1.6f; } AlarmInfo speedAlarm = createSpeedAlarm(mc, mxspeed, lastProjection, delta); if (speedAlarm != null) { @@ -254,9 +254,9 @@ public class WaypointHelper { float mxspeed = ro.getMaximumSpeed(); float delta; if (app.getSettings().METRIC_SYSTEM.get() == MetricsConstants.KILOMETERS_AND_METERS){ - delta = app.getSettings().SPEED_LIMIT_EXCEED.get(); + delta = app.getSettings().SPEED_LIMIT_EXCEED_KM.get(); } else { - delta = app.getSettings().SPEED_LIMIT_EXCEED.get() * 1.6f; + delta = app.getSettings().SPEED_LIMIT_EXCEED_MILE.get() * 1.6f; } AlarmInfo speedAlarm = createSpeedAlarm(mc, mxspeed, loc, delta); if (speedAlarm != null) {