Merge pull request #11032 from osmandapp/fix_units_switch

Don't overwrite units of measurement in automatic region
This commit is contained in:
Vitaliy 2021-02-28 19:14:06 +02:00 committed by GitHub
commit 29897a247e
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

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);