Added different speed limit for miles
This commit is contained in:
parent
3863a864aa
commit
bf288499e7
3 changed files with 13 additions and 9 deletions
|
@ -675,9 +675,12 @@ public class OsmandSettings {
|
|||
public final OsmandPreference<Float> ARRIVAL_DISTANCE_FACTOR =
|
||||
new FloatPreference("arrival_distance_factor", 1f).makeProfile();
|
||||
|
||||
public final OsmandPreference<Float> SPEED_LIMIT_EXCEED =
|
||||
public final OsmandPreference<Float> SPEED_LIMIT_EXCEED_KM =
|
||||
new FloatPreference("speed_limit_exceed", 5f).makeProfile();
|
||||
|
||||
public final OsmandPreference<Float> 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<Boolean> USE_TRACKBALL_FOR_MOVEMENTS =
|
||||
new BooleanPreference("use_trackball_for_movements", true).makeGlobal();
|
||||
|
|
|
@ -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);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -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) {
|
||||
|
|
Loading…
Reference in a new issue