Add check for already set preference

This commit is contained in:
Vitaliy 2020-07-21 18:15:18 +03:00
parent 8dedb3908a
commit 297edbcf11

View file

@ -328,11 +328,13 @@ public class OsmandSettings {
HashMap<String, Boolean> quickActions = gson.fromJson(quickActionsJson, type); HashMap<String, Boolean> quickActions = gson.fromJson(quickActionsJson, type);
if (!Algorithms.isEmpty(quickActions)) { if (!Algorithms.isEmpty(quickActions)) {
for (ApplicationMode mode : ApplicationMode.allPossibleValues()) { for (ApplicationMode mode : ApplicationMode.allPossibleValues()) {
Boolean actionState = quickActions.get(mode.getStringKey()); if (!QUICK_ACTION.isSetForMode(mode)) {
if (actionState == null) { Boolean actionState = quickActions.get(mode.getStringKey());
actionState = QUICK_ACTION.getDefaultValue(); if (actionState == null) {
actionState = QUICK_ACTION.getDefaultValue();
}
setPreference(QUICK_ACTION.getId(), actionState, mode);
} }
setPreference(QUICK_ACTION.getId(), actionState, mode);
} }
} }
} }