Limit popular tralev acticles to 30. Fix infinite loop.

This commit is contained in:
max-klaus 2021-01-26 10:52:43 +03:00
parent c01a4791b0
commit 7e29530f59
2 changed files with 6 additions and 3 deletions

View file

@ -13,6 +13,7 @@ import net.osmand.plus.OsmandApplication;
import net.osmand.plus.OsmandPlugin; import net.osmand.plus.OsmandPlugin;
import net.osmand.plus.download.DownloadOsmandIndexesHelper.AssetIndexItem; import net.osmand.plus.download.DownloadOsmandIndexesHelper.AssetIndexItem;
import net.osmand.plus.inapp.InAppPurchaseHelper; import net.osmand.plus.inapp.InAppPurchaseHelper;
import net.osmand.plus.wikivoyage.data.TravelDbHelper;
import net.osmand.util.Algorithms; import net.osmand.util.Algorithms;
import org.apache.commons.logging.Log; import org.apache.commons.logging.Log;
@ -358,7 +359,9 @@ public class DownloadResources extends DownloadResourceGroup {
continue; continue;
} }
if (ii.getType() == DownloadActivityType.WIKIVOYAGE_FILE) { if (ii.getType() == DownloadActivityType.WIKIVOYAGE_FILE) {
if (app.getTravelHelper() instanceof TravelDbHelper) {
wikivoyageMaps.addItem(ii); wikivoyageMaps.addItem(ii);
}
continue; continue;
} }
if (ii.getType() == DownloadActivityType.TRAVEL_FILE) { if (ii.getType() == DownloadActivityType.TRAVEL_FILE) {

View file

@ -56,7 +56,7 @@ public class TravelObfHelper implements TravelHelper {
public static final String ROUTE_ARTICLE_POINT = "route_article_point"; public static final String ROUTE_ARTICLE_POINT = "route_article_point";
public static final int POPULAR_ARTICLES_SEARCH_RADIUS = 100000; public static final int POPULAR_ARTICLES_SEARCH_RADIUS = 100000;
public static final int ARTICLE_SEARCH_RADIUS = 50000; 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 OsmandApplication app;
private final Collator collator; 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); article = findArticleById(articleId, lang);
} }
if (article != null && !article.gpxFileRead && forceReadPoints) { if (article != null && !article.gpxFileRead && forceReadPoints) {