Merge pull request #5283 from osmandapp/WikivoyageExploreCards

Wikivoyage explore cards fixes
This commit is contained in:
vshcherb 2018-04-25 23:44:30 +02:00 committed by GitHub
commit 391907fde0
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 4 additions and 5 deletions

View file

@ -210,7 +210,7 @@ public class TravelDbHelper {
TravelArticle travelArticle; TravelArticle travelArticle;
SQLiteCursor cursor = conn.rawQuery("SELECT * FROM " SQLiteCursor cursor = conn.rawQuery("SELECT * FROM "
+ ARTICLES_TABLE_NAME + ARTICLES_TABLE_NAME
+ " WHERE title IN (SELECT title FROM " + " WHERE article_id IN (SELECT article_id FROM "
+ ARTICLES_TABLE_NAME + ARTICLES_TABLE_NAME
+ " ORDER BY RANDOM() LIMIT 100) LIMIT 100", null); + " ORDER BY RANDOM() LIMIT 100) LIMIT 100", null);
if (cursor.moveToFirst()) { if (cursor.moveToFirst()) {

View file

@ -35,7 +35,6 @@ public class ExploreTabFragment extends BaseOsmAndFragment {
private static final int DOWNLOAD_UPDATE_CARD_POSITION = 0; private static final int DOWNLOAD_UPDATE_CARD_POSITION = 0;
private ExploreRvAdapter adapter = new ExploreRvAdapter(); private ExploreRvAdapter adapter = new ExploreRvAdapter();
private PopularDestinationsSearchTask popularDestinationsSearchTask;
private StartEditingTravelCard startEditingTravelCard; private StartEditingTravelCard startEditingTravelCard;
private ProgressBar progressBar; private ProgressBar progressBar;
@ -43,11 +42,11 @@ public class ExploreTabFragment extends BaseOsmAndFragment {
@Override @Override
public View onCreateView(@NonNull LayoutInflater inflater, @Nullable ViewGroup container, @Nullable Bundle savedInstanceState) { public View onCreateView(@NonNull LayoutInflater inflater, @Nullable ViewGroup container, @Nullable Bundle savedInstanceState) {
final View mainView = inflater.inflate(R.layout.fragment_explore_tab, container, false); final View mainView = inflater.inflate(R.layout.fragment_explore_tab, container, false);
progressBar = (ProgressBar) mainView.findViewById(R.id.progressBar);
final RecyclerView rv = (RecyclerView) mainView.findViewById(R.id.recycler_view);
adapter.setItems(generateItems()); adapter.setItems(generateItems());
final RecyclerView rv = (RecyclerView) mainView.findViewById(R.id.recycler_view);
progressBar = (ProgressBar) mainView.findViewById(R.id.progressBar);
rv.setLayoutManager(new LinearLayoutManager(getContext())); rv.setLayoutManager(new LinearLayoutManager(getContext()));
rv.setAdapter(adapter); rv.setAdapter(adapter);
@ -84,7 +83,7 @@ public class ExploreTabFragment extends BaseOsmAndFragment {
} }
private void addPopularDestinations(OsmandApplication app, boolean nightMode) { private void addPopularDestinations(OsmandApplication app, boolean nightMode) {
popularDestinationsSearchTask = new PopularDestinationsSearchTask(app.getTravelDbHelper(), getMyActivity(), adapter, nightMode, startEditingTravelCard, progressBar); PopularDestinationsSearchTask popularDestinationsSearchTask = new PopularDestinationsSearchTask(app.getTravelDbHelper(), getMyActivity(), adapter, nightMode, startEditingTravelCard, progressBar);
popularDestinationsSearchTask.execute(); popularDestinationsSearchTask.execute();
} }