Remove default value dependency from browse map preferences

This commit is contained in:
Vitaliy 2019-12-26 16:47:46 +02:00
parent a58fc0c8ba
commit d970918a19

View file

@ -151,7 +151,6 @@ public class OsmandSettings {
/// Settings variables /// Settings variables
private final OsmandApplication ctx; private final OsmandApplication ctx;
private SettingsAPI settingsAPI; private SettingsAPI settingsAPI;
private Object defaultProfilePreferences;
private Object globalPreferences; private Object globalPreferences;
private Object profilePreferences; private Object profilePreferences;
private ApplicationMode currentMode; private ApplicationMode currentMode;
@ -179,7 +178,6 @@ public class OsmandSettings {
private void initPrefs() { private void initPrefs() {
globalPreferences = settingsAPI.getPreferenceObject(getSharedPreferencesName(null)); globalPreferences = settingsAPI.getPreferenceObject(getSharedPreferencesName(null));
defaultProfilePreferences = getProfilePreferences(ApplicationMode.DEFAULT);
currentMode = readApplicationMode(); currentMode = readApplicationMode();
profilePreferences = getProfilePreferences(currentMode); profilePreferences = getProfilePreferences(currentMode);
registeredPreferences.put(APPLICATION_MODE.getId(), APPLICATION_MODE); registeredPreferences.put(APPLICATION_MODE.getId(), APPLICATION_MODE);
@ -245,7 +243,7 @@ public class OsmandSettings {
} }
} }
} }
SharedPreferences defaultProfilePreferences = (SharedPreferences) this.defaultProfilePreferences; SharedPreferences defaultProfilePreferences = (SharedPreferences) getProfilePreferences(ApplicationMode.DEFAULT);
Map<String, ?> defaultPrefsMap = defaultProfilePreferences.getAll(); Map<String, ?> defaultPrefsMap = defaultProfilePreferences.getAll();
for (String key : defaultPrefsMap.keySet()) { for (String key : defaultPrefsMap.keySet()) {
OsmandPreference pref = getPreference(key); OsmandPreference pref = getPreference(key);
@ -650,11 +648,7 @@ public class OsmandSettings {
if (pt != null) { if (pt != null) {
return getProfileDefaultValue(pt); return getProfileDefaultValue(pt);
} }
if (settingsAPI.contains(defaultProfilePreferences, getId())) { return defaultValue;
return getValue(defaultProfilePreferences, defaultValue);
} else {
return defaultValue;
}
} }
public boolean hasDefaultValues() { public boolean hasDefaultValues() {