Merge pull request #11313 from osmandapp/fix_10978

Fix_10978
This commit is contained in:
vshcherb 2021-04-01 17:08:25 +02:00 committed by GitHub
commit 60585fdfaf
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -853,7 +853,7 @@ public class OsmandSettings {
public boolean setValue(Object prefs, DrivingRegion val) { public boolean setValue(Object prefs, DrivingRegion val) {
boolean overrideMetricSystem = !DRIVING_REGION_AUTOMATIC.getValue(prefs, DRIVING_REGION_AUTOMATIC.getDefaultValue()); boolean overrideMetricSystem = !DRIVING_REGION_AUTOMATIC.getValue(prefs, DRIVING_REGION_AUTOMATIC.getDefaultValue());
if (overrideMetricSystem && val != null) { if (overrideMetricSystem && val != null) {
METRIC_SYSTEM.set(val.defMetrics); METRIC_SYSTEM.setValue(prefs, val.defMetrics);
} }
return super.setValue(prefs, val); return super.setValue(prefs, val);
} }
@ -866,7 +866,7 @@ public class OsmandSettings {
// this value string is synchronized with settings_pref.xml preference name // this value string is synchronized with settings_pref.xml preference name
// cache of metrics constants as they are used very often // cache of metrics constants as they are used very often
public final OsmandPreference<MetricsConstants> METRIC_SYSTEM = new EnumStringPreference<MetricsConstants>(this, public final EnumStringPreference<MetricsConstants> METRIC_SYSTEM = (EnumStringPreference<MetricsConstants>) new EnumStringPreference<MetricsConstants>(this,
"default_metric_system", MetricsConstants.KILOMETERS_AND_METERS, MetricsConstants.values()) { "default_metric_system", MetricsConstants.KILOMETERS_AND_METERS, MetricsConstants.values()) {
protected MetricsConstants getDefaultValue() { protected MetricsConstants getDefaultValue() {
return DRIVING_REGION.get().defMetrics; return DRIVING_REGION.get().defMetrics;