From 7e29530f59d45c9b9800fca28e67b09772676688 Mon Sep 17 00:00:00 2001 From: max-klaus Date: Tue, 26 Jan 2021 10:52:43 +0300 Subject: [PATCH] Limit popular tralev acticles to 30. Fix infinite loop. --- OsmAnd/src/net/osmand/plus/download/DownloadResources.java | 5 ++++- .../src/net/osmand/plus/wikivoyage/data/TravelObfHelper.java | 4 ++-- 2 files changed, 6 insertions(+), 3 deletions(-) diff --git a/OsmAnd/src/net/osmand/plus/download/DownloadResources.java b/OsmAnd/src/net/osmand/plus/download/DownloadResources.java index 4f820bac2a..56d137a696 100644 --- a/OsmAnd/src/net/osmand/plus/download/DownloadResources.java +++ b/OsmAnd/src/net/osmand/plus/download/DownloadResources.java @@ -13,6 +13,7 @@ import net.osmand.plus.OsmandApplication; import net.osmand.plus.OsmandPlugin; import net.osmand.plus.download.DownloadOsmandIndexesHelper.AssetIndexItem; import net.osmand.plus.inapp.InAppPurchaseHelper; +import net.osmand.plus.wikivoyage.data.TravelDbHelper; import net.osmand.util.Algorithms; import org.apache.commons.logging.Log; @@ -358,7 +359,9 @@ public class DownloadResources extends DownloadResourceGroup { continue; } if (ii.getType() == DownloadActivityType.WIKIVOYAGE_FILE) { - wikivoyageMaps.addItem(ii); + if (app.getTravelHelper() instanceof TravelDbHelper) { + wikivoyageMaps.addItem(ii); + } continue; } if (ii.getType() == DownloadActivityType.TRAVEL_FILE) { diff --git a/OsmAnd/src/net/osmand/plus/wikivoyage/data/TravelObfHelper.java b/OsmAnd/src/net/osmand/plus/wikivoyage/data/TravelObfHelper.java index 65f2da58a8..237e8174d1 100644 --- a/OsmAnd/src/net/osmand/plus/wikivoyage/data/TravelObfHelper.java +++ b/OsmAnd/src/net/osmand/plus/wikivoyage/data/TravelObfHelper.java @@ -56,7 +56,7 @@ public class TravelObfHelper implements TravelHelper { public static final String ROUTE_ARTICLE_POINT = "route_article_point"; public static final int POPULAR_ARTICLES_SEARCH_RADIUS = 100000; public static final int ARTICLE_SEARCH_RADIUS = 50000; - public static final int MAX_POPULAR_ARTICLES_COUNT = 100; + public static final int MAX_POPULAR_ARTICLES_COUNT = 30; private final OsmandApplication app; private final Collator collator; @@ -510,7 +510,7 @@ public class TravelObfHelper implements TravelHelper { } } } - if (article == null) { + if (article == null && articles == null) { article = findArticleById(articleId, lang); } if (article != null && !article.gpxFileRead && forceReadPoints) {