Fix metric system change

This commit is contained in:
max-klaus 2019-11-11 12:03:22 +03:00
parent 6d98882b65
commit 600871a943
3 changed files with 1 additions and 6 deletions

View file

@ -1253,7 +1253,7 @@ public class OsmandSettings {
public final OsmandPreference<DrivingRegion> DRIVING_REGION = new EnumIntPreference<DrivingRegion>(
"default_driving_region", DrivingRegion.EUROPE_ASIA, DrivingRegion.values()) {
protected boolean setValue(Object prefs, DrivingRegion val) {
if (val != null && !METRIC_SYSTEM_CHANGED_MANUALLY.get()) {
if (val != null) {
METRIC_SYSTEM.set(val.defMetrics);
}
return super.setValue(prefs, val);
@ -1283,8 +1283,6 @@ public class OsmandSettings {
}.makeProfile().makeGeneral().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
// cache of metrics constants as they are used very often
public final OsmandPreference<MetricsConstants> METRIC_SYSTEM = new EnumIntPreference<MetricsConstants>(

View file

@ -569,8 +569,6 @@ public class SettingsGeneralActivity extends SettingsBaseActivity implements OnR
getMyApplication().restartApp(this);
} else if (id.equals(settings.OSMAND_THEME.getId())) {
getMyApplication().restartApp(this);
} else if (id.equals(settings.METRIC_SYSTEM.getId())) {
settings.METRIC_SYSTEM_CHANGED_MANUALLY.set(true);
} else if (id.equals(settings.DO_NOT_USE_ANIMATIONS.getId())) {
getMyApplication().restartApp(this);
} else {

View file

@ -109,7 +109,6 @@ public class SettingsDevelopmentActivity extends SettingsBaseActivity {
settings.FIRST_MAP_IS_DOWNLOADED.set(false);
settings.MAPILLARY_FIRST_DIALOG_SHOWN.set(false);
settings.WEBGL_SUPPORTED.set(true);
settings.METRIC_SYSTEM_CHANGED_MANUALLY.set(false);
settings.WIKI_ARTICLE_SHOW_IMAGES_ASKED.set(false);
getMyApplication().showToastMessage(R.string.shared_string_ok);