From f8a4aa5c37c14a268ccdd08d561a9039d9916d9b Mon Sep 17 00:00:00 2001 From: max-klaus Date: Wed, 15 Apr 2020 14:04:31 +0300 Subject: [PATCH] Use init method in SettingsHelper --- .../src/net/osmand/plus/SettingsHelper.java | 33 +++++++++++-------- 1 file changed, 20 insertions(+), 13 deletions(-) diff --git a/OsmAnd/src/net/osmand/plus/SettingsHelper.java b/OsmAnd/src/net/osmand/plus/SettingsHelper.java index 4fefebcd92..0c179c123d 100644 --- a/OsmAnd/src/net/osmand/plus/SettingsHelper.java +++ b/OsmAnd/src/net/osmand/plus/SettingsHelper.java @@ -1339,12 +1339,15 @@ public class SettingsHelper { public QuickActionsSettingsItem(@NonNull OsmandApplication app, @NonNull List items) { super(app, items); - actionRegistry = app.getQuickActionRegistry(); - existingItems = actionRegistry.getQuickActions(); } QuickActionsSettingsItem(@NonNull OsmandApplication app, @NonNull JSONObject json) throws JSONException { super(app, json); + } + + @Override + protected void init() { + super.init(); actionRegistry = app.getQuickActionRegistry(); existingItems = actionRegistry.getQuickActions(); } @@ -1490,11 +1493,15 @@ public class SettingsHelper { public PoiUiFilterSettingsItem(@NonNull OsmandApplication app, @NonNull List items) { super(app, items); - existingItems = app.getPoiFilters().getUserDefinedPoiFilters(false); } PoiUiFilterSettingsItem(@NonNull OsmandApplication app, @NonNull JSONObject json) throws JSONException { super(app, json); + } + + @Override + protected void init() { + super.init(); existingItems = app.getPoiFilters().getUserDefinedPoiFilters(false); } @@ -1632,18 +1639,19 @@ public class SettingsHelper { public static class MapSourcesSettingsItem extends CollectionSettingsItem { - private OsmandApplication app; private List existingItemsNames; public MapSourcesSettingsItem(@NonNull OsmandApplication app, @NonNull List items) { super(app, items); - this.app = app; - existingItemsNames = new ArrayList<>(app.getSettings().getTileSourceEntries().values()); } MapSourcesSettingsItem(@NonNull OsmandApplication app, @NonNull JSONObject json) throws JSONException { super(app, json); - this.app = app; + } + + @Override + protected void init() { + super.init(); existingItemsNames = new ArrayList<>(app.getSettings().getTileSourceEntries().values()); } @@ -1831,21 +1839,20 @@ public class SettingsHelper { public static class AvoidRoadsSettingsItem extends CollectionSettingsItem { - private OsmandApplication app; private OsmandSettings settings; private AvoidSpecificRoads specificRoads; public AvoidRoadsSettingsItem(@NonNull OsmandApplication app, @NonNull List items) { super(app, items); - this.app = app; - settings = app.getSettings(); - specificRoads = app.getAvoidSpecificRoads(); - existingItems = new ArrayList<>(specificRoads.getImpassableRoads().values()); } AvoidRoadsSettingsItem(@NonNull OsmandApplication app, @NonNull JSONObject json) throws JSONException { super(app, json); - this.app = app; + } + + @Override + protected void init() { + super.init(); settings = app.getSettings(); specificRoads = app.getAvoidSpecificRoads(); existingItems = new ArrayList<>(specificRoads.getImpassableRoads().values());