Try to enable plugin by default

This commit is contained in:
Victor Shcherb 2021-02-03 17:14:45 +01:00
parent 5c79c6aaef
commit 1027493abb
2 changed files with 6 additions and 13 deletions

View file

@ -277,26 +277,19 @@ public abstract class OsmandPlugin {
public static void initPlugins(@NonNull OsmandApplication app) { public static void initPlugins(@NonNull OsmandApplication app) {
Set<String> enabledPlugins = app.getSettings().getEnabledPlugins(); Set<String> enabledPlugins = app.getSettings().getEnabledPlugins();
allPlugins.clear(); allPlugins.clear();
enablePluginByDefault(app, enabledPlugins, new WikipediaPlugin(app));
enableHiddenPlugin(app, enabledPlugins, new WikipediaPlugin(app));
allPlugins.add(new MapillaryPlugin(app));
allPlugins.add(new OsmandRasterMapsPlugin(app)); allPlugins.add(new OsmandRasterMapsPlugin(app));
allPlugins.add(new OsmandMonitoringPlugin(app)); allPlugins.add(new OsmandMonitoringPlugin(app));
checkMarketPlugin(app, enabledPlugins, new SRTMPlugin(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 NauticalMapsPlugin(app));
checkMarketPlugin(app, enabledPlugins, new SkiMapsPlugin(app)); checkMarketPlugin(app, enabledPlugins, new SkiMapsPlugin(app));
allPlugins.add(new AudioVideoNotesPlugin(app)); allPlugins.add(new AudioVideoNotesPlugin(app));
checkMarketPlugin(app, enabledPlugins, new ParkingPositionPlugin(app)); checkMarketPlugin(app, enabledPlugins, new ParkingPositionPlugin(app));
allPlugins.add(new AccessibilityPlugin(app));
allPlugins.add(new OsmEditingPlugin(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)); allPlugins.add(new OsmandDevelopmentPlugin(app));
loadCustomPlugins(app); loadCustomPlugins(app);
@ -388,7 +381,7 @@ public abstract class OsmandPlugin {
} }
} }
private static void enableHiddenPlugin(@NonNull OsmandApplication app, @NonNull Set<String> enabledPlugins, @NonNull OsmandPlugin plugin) { private static void enablePluginByDefault(@NonNull OsmandApplication app, @NonNull Set<String> enabledPlugins, @NonNull OsmandPlugin plugin) {
allPlugins.add(plugin); allPlugins.add(plugin);
if (!enabledPlugins.contains(plugin.getId()) && !app.getSettings().getPlugins().contains("-" + plugin.getId())) { if (!enabledPlugins.contains(plugin.getId()) && !app.getSettings().getPlugins().contains("-" + plugin.getId())) {
enabledPlugins.add(plugin.getId()); enabledPlugins.add(plugin.getId());

View file

@ -654,7 +654,7 @@ public class OsmandSettings {
public static final String NUMBER_OF_FREE_DOWNLOADS_ID = "free_downloads_v3"; public static final String NUMBER_OF_FREE_DOWNLOADS_ID = "free_downloads_v3";
// this value string is synchronized with settings_pref.xml preference name // this value string is synchronized with settings_pref.xml preference name
private final OsmandPreference<String> PLUGINS = new StringPreference(this, "enabled_plugins", MapillaryPlugin.ID + "," + OpenPlaceReviewsPlugin.ID).makeGlobal().makeShared(); private final OsmandPreference<String> PLUGINS = new StringPreference(this, "enabled_plugins", "").makeGlobal().makeShared();
public Set<String> getEnabledPlugins() { public Set<String> getEnabledPlugins() {
String plugs = PLUGINS.get(); String plugs = PLUGINS.get();