Updated to delta of speed exceed limit

This commit is contained in:
Denis 2014-10-09 21:29:42 +03:00
parent 54fbf15ea2
commit 45f266b1bc
3 changed files with 18 additions and 8 deletions

View file

@ -676,7 +676,7 @@ public class OsmandSettings {
new FloatPreference("arrival_distance_factor", 1f).makeProfile();
public final OsmandPreference<Float> SPEED_LIMIT_EXCEED =
new FloatPreference("speed_limit_exceed", 5000f).makeProfile();
new FloatPreference("speed_limit_exceed", 5f).makeProfile();
// this value string is synchronized with settings_pref.xml preference name
public final OsmandPreference<Boolean> USE_TRACKBALL_FOR_MOVEMENTS =

View file

@ -123,11 +123,11 @@ public class SettingsNavigationActivity extends SettingsBaseActivity {
registerListPreference(settings.SPEED_LIMIT_EXCEED, screen, speedNames, speedLimits);
} else {
String[] speedNames = new String[] {
(speedLimits[0] / 1.6) + " " + getString(R.string.mile_per_hour),
(speedLimits[1] / 1.6) + " " + getString(R.string.mile_per_hour),
(speedLimits[2] / 1.6) + " " + getString(R.string.mile_per_hour),
(speedLimits[3] / 1.6) + " " + getString(R.string.mile_per_hour),
(speedLimits[4] / 1.6) + " " + getString(R.string.mile_per_hour)};
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);
}

View file

@ -157,7 +157,12 @@ public class WaypointHelper {
public AlarmInfo getMostImportantAlarm(MetricsConstants mc, boolean showCameras) {
Location lastProjection = app.getRoutingHelper().getLastProjection();
float mxspeed = route.getCurrentMaxSpeed();
float delta = app.getSettings().SPEED_LIMIT_EXCEED.get() / 3.6f;
float delta;
if (app.getSettings().METRIC_SYSTEM.get() == MetricsConstants.KILOMETERS_AND_METERS){
delta = app.getSettings().SPEED_LIMIT_EXCEED.get();
} else {
delta = app.getSettings().SPEED_LIMIT_EXCEED.get() * 1.6f;
}
AlarmInfo speedAlarm = createSpeedAlarm(mc, mxspeed, lastProjection, delta);
if (speedAlarm != null) {
getVoiceRouter().announceSpeedAlarm();
@ -247,7 +252,12 @@ public class WaypointHelper {
public AlarmInfo calculateMostImportantAlarm(RouteDataObject ro, Location loc,
MetricsConstants mc, boolean showCameras) {
float mxspeed = ro.getMaximumSpeed();
float delta = app.getSettings().SPEED_LIMIT_EXCEED.get() / 3.6f;
float delta;
if (app.getSettings().METRIC_SYSTEM.get() == MetricsConstants.KILOMETERS_AND_METERS){
delta = app.getSettings().SPEED_LIMIT_EXCEED.get();
} else {
delta = app.getSettings().SPEED_LIMIT_EXCEED.get() * 1.6f;
}
AlarmInfo speedAlarm = createSpeedAlarm(mc, mxspeed, loc, delta);
if (speedAlarm != null) {
getVoiceRouter().announceSpeedAlarm();