Fix travel cards when no book

This commit is contained in:
max-klaus 2021-01-28 19:53:34 +03:00
parent 8098f5d92c
commit 1b30f1f428

View file

@ -175,10 +175,9 @@ public class ExploreTabFragment extends BaseOsmAndFragment implements DownloadEv
if (!Version.isPaidVersion(app) && !OpenBetaTravelCard.isClosed()) { if (!Version.isPaidVersion(app) && !OpenBetaTravelCard.isClosed()) {
items.add(new OpenBetaTravelCard(activity, nightMode)); items.add(new OpenBetaTravelCard(activity, nightMode));
} }
if (app.getTravelHelper().isAnyTravelBookPresent()) { List<TravelArticle> popularArticles = app.getTravelHelper().getPopularArticles();
if (!popularArticles.isEmpty()) {
items.add(new HeaderTravelCard(app, nightMode, getString(R.string.popular_destinations))); items.add(new HeaderTravelCard(app, nightMode, getString(R.string.popular_destinations)));
List<TravelArticle> popularArticles = app.getTravelHelper().getPopularArticles();
for (TravelArticle article : popularArticles) { for (TravelArticle article : popularArticles) {
if (article instanceof TravelGpx) { if (article instanceof TravelGpx) {
items.add(new TravelGpxCard(app, nightMode, (TravelGpx) article, getActivity())); 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 ArticleTravelCard(app, nightMode, article, activity.getSupportFragmentManager()));
} }
} }
items.add(new StartEditingTravelCard(activity, nightMode)); }
adapter.setItems(items); items.add(new StartEditingTravelCard(activity, nightMode));
final DownloadIndexesThread downloadThread = app.getDownloadThread(); adapter.setItems(items);
if (!downloadThread.getIndexes().isDownloadedFromInternet) { final DownloadIndexesThread downloadThread = app.getDownloadThread();
waitForIndexes = true; if (!downloadThread.getIndexes().isDownloadedFromInternet) {
downloadThread.runReloadIndexFilesSilent(); waitForIndexes = true;
} else { downloadThread.runReloadIndexFilesSilent();
checkDownloadIndexes(); } else {
} checkDownloadIndexes();
} }
} }
} }