From 8aa6fb1eb2099624b5b774644f991f3483d946a1 Mon Sep 17 00:00:00 2001 From: max-klaus Date: Sat, 21 Mar 2020 12:06:17 +0300 Subject: [PATCH] Fix settings import --- OsmAnd/src/net/osmand/plus/SettingsHelper.java | 16 ++++++++++++++-- 1 file changed, 14 insertions(+), 2 deletions(-) diff --git a/OsmAnd/src/net/osmand/plus/SettingsHelper.java b/OsmAnd/src/net/osmand/plus/SettingsHelper.java index 89263d9323..498eecbadd 100644 --- a/OsmAnd/src/net/osmand/plus/SettingsHelper.java +++ b/OsmAnd/src/net/osmand/plus/SettingsHelper.java @@ -140,14 +140,20 @@ public class SettingsHelper { boolean shouldReplace = false; SettingsItem(@NonNull SettingsItemType type) { + init(); this.type = type; } SettingsItem(@NonNull SettingsItemType type, @NonNull JSONObject json) throws JSONException { + init(); this.type = type; readFromJson(json); } + protected void init() { + // override + } + @NonNull public SettingsItemType getType() { return type; @@ -349,10 +355,16 @@ public class SettingsHelper { public abstract static class CollectionSettingsItem extends SettingsItem { - protected List items = new ArrayList<>(); - protected List duplicateItems = new ArrayList<>(); + protected List items; + protected List duplicateItems; protected List existingItems; + @Override + protected void init() { + items = new ArrayList<>(); + duplicateItems = new ArrayList<>(); + } + CollectionSettingsItem(@NonNull SettingsItemType type, @NonNull List items) { super(type); this.items = items;