Fix #3679
This commit is contained in:
parent
ea15c68527
commit
a6470c5f47
3 changed files with 6 additions and 1 deletions
|
@ -752,7 +752,7 @@ public class OsmandSettings {
|
||||||
public final OsmandPreference<DrivingRegion> DRIVING_REGION = new EnumIntPreference<DrivingRegion>(
|
public final OsmandPreference<DrivingRegion> DRIVING_REGION = new EnumIntPreference<DrivingRegion>(
|
||||||
"default_driving_region", DrivingRegion.EUROPE_ASIA, DrivingRegion.values()) {
|
"default_driving_region", DrivingRegion.EUROPE_ASIA, DrivingRegion.values()) {
|
||||||
protected boolean setValue(Object prefs, DrivingRegion val) {
|
protected boolean setValue(Object prefs, DrivingRegion val) {
|
||||||
if (val != null) {
|
if (val != null && !METRIC_SYSTEM_CHANGED_MANUALLY.get()) {
|
||||||
METRIC_SYSTEM.set(val.defMetrics);
|
METRIC_SYSTEM.set(val.defMetrics);
|
||||||
}
|
}
|
||||||
return super.setValue(prefs, val);
|
return super.setValue(prefs, val);
|
||||||
|
@ -783,6 +783,8 @@ public class OsmandSettings {
|
||||||
;
|
;
|
||||||
}.makeGlobal().cache();
|
}.makeGlobal().cache();
|
||||||
|
|
||||||
|
public final CommonPreference<Boolean> METRIC_SYSTEM_CHANGED_MANUALLY = new BooleanPreference("metric_system_changed_manually", false).makeGlobal();
|
||||||
|
|
||||||
// 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 EnumIntPreference<MetricsConstants>(
|
public final OsmandPreference<MetricsConstants> METRIC_SYSTEM = new EnumIntPreference<MetricsConstants>(
|
||||||
|
|
|
@ -516,6 +516,8 @@ public class SettingsGeneralActivity extends SettingsBaseActivity implements OnR
|
||||||
restartApp();
|
restartApp();
|
||||||
} else if (id.equals(settings.OSMAND_THEME.getId())) {
|
} else if (id.equals(settings.OSMAND_THEME.getId())) {
|
||||||
restartApp();
|
restartApp();
|
||||||
|
} else if (id.equals(settings.METRIC_SYSTEM.getId())) {
|
||||||
|
settings.METRIC_SYSTEM_CHANGED_MANUALLY.set(true);
|
||||||
} else {
|
} else {
|
||||||
updateAllSettings();
|
updateAllSettings();
|
||||||
}
|
}
|
||||||
|
|
|
@ -78,6 +78,7 @@ public class SettingsDevelopmentActivity extends SettingsBaseActivity {
|
||||||
getMyApplication().getSettings().FIRST_MAP_IS_DOWNLOADED.set(false);
|
getMyApplication().getSettings().FIRST_MAP_IS_DOWNLOADED.set(false);
|
||||||
getMyApplication().getSettings().MAPILLARY_FIRST_DIALOG_SHOWN.set(false);
|
getMyApplication().getSettings().MAPILLARY_FIRST_DIALOG_SHOWN.set(false);
|
||||||
getMyApplication().getSettings().WEBGL_SUPPORTED.set(true);
|
getMyApplication().getSettings().WEBGL_SUPPORTED.set(true);
|
||||||
|
getMyApplication().getSettings().METRIC_SYSTEM_CHANGED_MANUALLY.set(false);
|
||||||
getMyApplication().showToastMessage(R.string.shared_string_ok);
|
getMyApplication().showToastMessage(R.string.shared_string_ok);
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue