diff --git a/OsmAnd/src/net/osmand/plus/settings/MainSettingsFragment.java b/OsmAnd/src/net/osmand/plus/settings/MainSettingsFragment.java index 08f1698b18..809d4e4b4d 100644 --- a/OsmAnd/src/net/osmand/plus/settings/MainSettingsFragment.java +++ b/OsmAnd/src/net/osmand/plus/settings/MainSettingsFragment.java @@ -79,8 +79,7 @@ public class MainSettingsFragment extends BaseSettingsFragment { @Override public boolean onPreferenceChange(Preference preference, Object newValue) { - String key = preference.getKey(); - ApplicationMode applicationMode = getAppMode(key); + ApplicationMode applicationMode = ApplicationMode.valueOfStringKey(preference.getKey(), null); if (applicationMode != null) { if (newValue instanceof Boolean) { boolean isChecked = (Boolean) newValue; @@ -91,15 +90,6 @@ public class MainSettingsFragment extends BaseSettingsFragment { return super.onPreferenceChange(preference, newValue); } - ApplicationMode getAppMode(String key) { - for (ApplicationMode applicationMode : allAppModes) { - if (applicationMode.getStringKey().equals(key)) { - return applicationMode; - } - } - return null; - } - private void setupConfigureProfilePref() { ApplicationMode selectedMode = app.getSettings().APPLICATION_MODE.get(); String title = selectedMode.toHumanString(getContext());