Don't overwrite units of measurement in automatic region

This commit is contained in:
cepprice 2021-02-28 21:56:07 +05:00
parent 8ff6eff178
commit 38d6183a43

View file

@ -848,7 +848,8 @@ public class OsmandSettings {
public final OsmandPreference<DrivingRegion> DRIVING_REGION = new EnumStringPreference<DrivingRegion>(this,
"default_driving_region", DrivingRegion.EUROPE_ASIA, DrivingRegion.values()) {
public boolean setValue(Object prefs, DrivingRegion val) {
if (val != null) {
boolean overrideMetricSystem = !DRIVING_REGION_AUTOMATIC.getValue(prefs, DRIVING_REGION_AUTOMATIC.getDefaultValue());
if (overrideMetricSystem && val != null) {
METRIC_SYSTEM.set(val.defMetrics);
}
return super.setValue(prefs, val);