From 1027493abbae431d2b98c1105ef2cd28a2d08b22 Mon Sep 17 00:00:00 2001 From: Victor Shcherb Date: Wed, 3 Feb 2021 17:14:45 +0100 Subject: [PATCH] Try to enable plugin by default --- OsmAnd/src/net/osmand/plus/OsmandPlugin.java | 17 +++++------------ .../plus/settings/backend/OsmandSettings.java | 2 +- 2 files changed, 6 insertions(+), 13 deletions(-) diff --git a/OsmAnd/src/net/osmand/plus/OsmandPlugin.java b/OsmAnd/src/net/osmand/plus/OsmandPlugin.java index d3bcfb205e..90342ff256 100644 --- a/OsmAnd/src/net/osmand/plus/OsmandPlugin.java +++ b/OsmAnd/src/net/osmand/plus/OsmandPlugin.java @@ -277,26 +277,19 @@ public abstract class OsmandPlugin { public static void initPlugins(@NonNull OsmandApplication app) { Set enabledPlugins = app.getSettings().getEnabledPlugins(); - allPlugins.clear(); - - enableHiddenPlugin(app, enabledPlugins, new WikipediaPlugin(app)); - - allPlugins.add(new MapillaryPlugin(app)); + enablePluginByDefault(app, enabledPlugins, new WikipediaPlugin(app)); allPlugins.add(new OsmandRasterMapsPlugin(app)); allPlugins.add(new OsmandMonitoringPlugin(app)); checkMarketPlugin(app, enabledPlugins, new SRTMPlugin(app)); - - // ? questionable - definitely not market plugin -// checkMarketPlugin(app, enabledPlugins, new TouringViewPlugin(app), false, TouringViewPlugin.COMPONENT, null); checkMarketPlugin(app, enabledPlugins, new NauticalMapsPlugin(app)); checkMarketPlugin(app, enabledPlugins, new SkiMapsPlugin(app)); - allPlugins.add(new AudioVideoNotesPlugin(app)); checkMarketPlugin(app, enabledPlugins, new ParkingPositionPlugin(app)); - allPlugins.add(new AccessibilityPlugin(app)); allPlugins.add(new OsmEditingPlugin(app)); - allPlugins.add(new OpenPlaceReviewsPlugin(app)); + enablePluginByDefault(app, enabledPlugins, new OpenPlaceReviewsPlugin(app)); + enablePluginByDefault(app, enabledPlugins, new MapillaryPlugin(app)); + allPlugins.add(new AccessibilityPlugin(app)); allPlugins.add(new OsmandDevelopmentPlugin(app)); loadCustomPlugins(app); @@ -388,7 +381,7 @@ public abstract class OsmandPlugin { } } - private static void enableHiddenPlugin(@NonNull OsmandApplication app, @NonNull Set enabledPlugins, @NonNull OsmandPlugin plugin) { + private static void enablePluginByDefault(@NonNull OsmandApplication app, @NonNull Set enabledPlugins, @NonNull OsmandPlugin plugin) { allPlugins.add(plugin); if (!enabledPlugins.contains(plugin.getId()) && !app.getSettings().getPlugins().contains("-" + plugin.getId())) { enabledPlugins.add(plugin.getId()); diff --git a/OsmAnd/src/net/osmand/plus/settings/backend/OsmandSettings.java b/OsmAnd/src/net/osmand/plus/settings/backend/OsmandSettings.java index 871fa40bb1..45cefd2723 100644 --- a/OsmAnd/src/net/osmand/plus/settings/backend/OsmandSettings.java +++ b/OsmAnd/src/net/osmand/plus/settings/backend/OsmandSettings.java @@ -654,7 +654,7 @@ public class OsmandSettings { public static final String NUMBER_OF_FREE_DOWNLOADS_ID = "free_downloads_v3"; // this value string is synchronized with settings_pref.xml preference name - private final OsmandPreference PLUGINS = new StringPreference(this, "enabled_plugins", MapillaryPlugin.ID + "," + OpenPlaceReviewsPlugin.ID).makeGlobal().makeShared(); + private final OsmandPreference PLUGINS = new StringPreference(this, "enabled_plugins", "").makeGlobal().makeShared(); public Set getEnabledPlugins() { String plugs = PLUGINS.get();