Speed limit exceed setting will be shown for car and other simular mods.

This commit is contained in:
Denis 2014-10-10 12:06:14 +03:00
parent 45f266b1bc
commit 90b4c7f8f7

View file

@ -111,27 +111,29 @@ public class SettingsNavigationActivity extends SettingsBaseActivity {
}; };
registerListPreference(settings.ARRIVAL_DISTANCE_FACTOR, screen, arrivalNames, arrivalValues); registerListPreference(settings.ARRIVAL_DISTANCE_FACTOR, screen, arrivalNames, arrivalValues);
Float[] speedLimits = new Float[] {5f, 7f, 10f, 15f, 20f}; ApplicationMode mode = getMyApplication().getSettings().getApplicationMode();
if (settings.METRIC_SYSTEM.get() == OsmandSettings.MetricsConstants.KILOMETERS_AND_METERS){ if (mode == ApplicationMode.CAR || mode == ApplicationMode.TRUCK || mode == ApplicationMode.MOTORCYCLE){
Float[] speedLimits = new Float[] {5f, 7f, 10f, 15f, 20f};
if (settings.METRIC_SYSTEM.get() == OsmandSettings.MetricsConstants.KILOMETERS_AND_METERS){
String[] speedNames = new String[] { String[] speedNames = new String[] {
speedLimits[0] + " " + getString(R.string.km_h), speedLimits[0] + " " + getString(R.string.km_h),
speedLimits[1] + " " + getString(R.string.km_h), speedLimits[1] + " " + getString(R.string.km_h),
speedLimits[2] + " " + getString(R.string.km_h), speedLimits[2] + " " + getString(R.string.km_h),
speedLimits[3] + " " + getString(R.string.km_h), speedLimits[3] + " " + getString(R.string.km_h),
speedLimits[4] + " " + 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, screen, speedNames, speedLimits);
} else { } else {
String[] speedNames = new String[] { String[] speedNames = new String[] {
speedLimits[0] + " " + getString(R.string.mile_per_hour), speedLimits[0] + " " + getString(R.string.mile_per_hour),
speedLimits[1] + " " + getString(R.string.mile_per_hour), speedLimits[1] + " " + getString(R.string.mile_per_hour),
speedLimits[2] + " " + getString(R.string.mile_per_hour), speedLimits[2] + " " + getString(R.string.mile_per_hour),
speedLimits[3] + " " + getString(R.string.mile_per_hour), speedLimits[3] + " " + getString(R.string.mile_per_hour),
speedLimits[4] + " " + 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, screen, speedNames, speedLimits);
}
} }
profileDialog(); profileDialog();
} }