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()) {
items.add(new HeaderTravelCard(app, nightMode, getString(R.string.popular_destinations)));
List<TravelArticle> popularArticles = app.getTravelHelper().getPopularArticles(); List<TravelArticle> popularArticles = app.getTravelHelper().getPopularArticles();
if (!popularArticles.isEmpty()) {
items.add(new HeaderTravelCard(app, nightMode, getString(R.string.popular_destinations)));
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,6 +185,7 @@ 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)); items.add(new StartEditingTravelCard(activity, nightMode));
adapter.setItems(items); adapter.setItems(items);
final DownloadIndexesThread downloadThread = app.getDownloadThread(); final DownloadIndexesThread downloadThread = app.getDownloadThread();
@ -197,7 +197,6 @@ public class ExploreTabFragment extends BaseOsmAndFragment implements DownloadEv
} }
} }
} }
}
private void removeRedundantCards() { private void removeRedundantCards() {
if (mainIndexItem != null && mainIndexItem.isDownloaded() && !mainIndexItem.isOutdated()) { if (mainIndexItem != null && mainIndexItem.isDownloaded() && !mainIndexItem.isOutdated()) {