From 1b30f1f428b3fbc7ea54693b389e41f5cc02d040 Mon Sep 17 00:00:00 2001 From: max-klaus Date: Thu, 28 Jan 2021 19:53:34 +0300 Subject: [PATCH] Fix travel cards when no book --- .../explore/ExploreTabFragment.java | 23 +++++++++---------- 1 file changed, 11 insertions(+), 12 deletions(-) diff --git a/OsmAnd/src/net/osmand/plus/wikivoyage/explore/ExploreTabFragment.java b/OsmAnd/src/net/osmand/plus/wikivoyage/explore/ExploreTabFragment.java index 9055acd4ed..c13c7fb22f 100644 --- a/OsmAnd/src/net/osmand/plus/wikivoyage/explore/ExploreTabFragment.java +++ b/OsmAnd/src/net/osmand/plus/wikivoyage/explore/ExploreTabFragment.java @@ -175,10 +175,9 @@ public class ExploreTabFragment extends BaseOsmAndFragment implements DownloadEv if (!Version.isPaidVersion(app) && !OpenBetaTravelCard.isClosed()) { items.add(new OpenBetaTravelCard(activity, nightMode)); } - if (app.getTravelHelper().isAnyTravelBookPresent()) { + List popularArticles = app.getTravelHelper().getPopularArticles(); + if (!popularArticles.isEmpty()) { items.add(new HeaderTravelCard(app, nightMode, getString(R.string.popular_destinations))); - - List popularArticles = app.getTravelHelper().getPopularArticles(); for (TravelArticle article : popularArticles) { if (article instanceof TravelGpx) { items.add(new TravelGpxCard(app, nightMode, (TravelGpx) article, getActivity())); @@ -186,15 +185,15 @@ public class ExploreTabFragment extends BaseOsmAndFragment implements DownloadEv items.add(new ArticleTravelCard(app, nightMode, article, activity.getSupportFragmentManager())); } } - items.add(new StartEditingTravelCard(activity, nightMode)); - adapter.setItems(items); - final DownloadIndexesThread downloadThread = app.getDownloadThread(); - if (!downloadThread.getIndexes().isDownloadedFromInternet) { - waitForIndexes = true; - downloadThread.runReloadIndexFilesSilent(); - } else { - checkDownloadIndexes(); - } + } + items.add(new StartEditingTravelCard(activity, nightMode)); + adapter.setItems(items); + final DownloadIndexesThread downloadThread = app.getDownloadThread(); + if (!downloadThread.getIndexes().isDownloadedFromInternet) { + waitForIndexes = true; + downloadThread.runReloadIndexFilesSilent(); + } else { + checkDownloadIndexes(); } } }