diff --git a/OsmAnd/res/layout/fragment_explore_tab.xml b/OsmAnd/res/layout/fragment_explore_tab.xml
index 0d82ee83b9..97565b853f 100644
--- a/OsmAnd/res/layout/fragment_explore_tab.xml
+++ b/OsmAnd/res/layout/fragment_explore_tab.xml
@@ -6,6 +6,13 @@
android:gravity="center"
android:orientation="vertical">
+
+
0; i--) {
+ Object o = items.get(i);
+ if (o instanceof ArticleTravelCard) {
+ return i;
+ }
+ }
+ return 0;
+ }
+
private Object getItem(int position) {
return items.get(position);
}
diff --git a/OsmAnd/src/net/osmand/plus/wikivoyage/explore/ExploreTabFragment.java b/OsmAnd/src/net/osmand/plus/wikivoyage/explore/ExploreTabFragment.java
index 4be8b7a8c3..7df07075b9 100644
--- a/OsmAnd/src/net/osmand/plus/wikivoyage/explore/ExploreTabFragment.java
+++ b/OsmAnd/src/net/osmand/plus/wikivoyage/explore/ExploreTabFragment.java
@@ -9,20 +9,24 @@ import android.support.v7.widget.RecyclerView;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
+import android.widget.ProgressBar;
import net.osmand.plus.OsmandApplication;
import net.osmand.plus.R;
import net.osmand.plus.activities.LocalIndexHelper;
import net.osmand.plus.activities.LocalIndexInfo;
+import net.osmand.plus.activities.OsmandActionBarActivity;
import net.osmand.plus.base.BaseOsmAndFragment;
import net.osmand.plus.download.DownloadResources;
import net.osmand.plus.download.ui.AbstractLoadLocalIndexTask;
import net.osmand.plus.wikivoyage.data.TravelArticle;
+import net.osmand.plus.wikivoyage.data.TravelDbHelper;
import net.osmand.plus.wikivoyage.explore.travelcards.ArticleTravelCard;
import net.osmand.plus.wikivoyage.explore.travelcards.OpenBetaTravelCard;
import net.osmand.plus.wikivoyage.explore.travelcards.StartEditingTravelCard;
import net.osmand.plus.wikivoyage.explore.travelcards.TravelDownloadUpdateCard;
+import java.lang.ref.WeakReference;
import java.util.ArrayList;
import java.util.List;
@@ -31,6 +35,9 @@ public class ExploreTabFragment extends BaseOsmAndFragment {
private static final int DOWNLOAD_UPDATE_CARD_POSITION = 0;
private ExploreRvAdapter adapter = new ExploreRvAdapter();
+ private PopularDestinationsSearchTask popularDestinationsSearchTask;
+ private StartEditingTravelCard startEditingTravelCard;
+ private ProgressBar progressBar;
@Nullable
@Override
@@ -40,6 +47,7 @@ public class ExploreTabFragment extends BaseOsmAndFragment {
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.setAdapter(adapter);
@@ -52,9 +60,10 @@ public class ExploreTabFragment extends BaseOsmAndFragment {
final boolean nightMode = !getSettings().isLightContent();
addDownloadUpdateCard(nightMode);
+ startEditingTravelCard = new StartEditingTravelCard(app, nightMode);
items.add(new OpenBetaTravelCard(app, nightMode, getFragmentManager()));
- items.add(new StartEditingTravelCard(app, nightMode));
- addPopularDestinations(items, nightMode);
+ items.add(startEditingTravelCard);
+ addPopularDestinations(app, nightMode);
return items;
}
@@ -74,15 +83,9 @@ public class ExploreTabFragment extends BaseOsmAndFragment {
}).executeOnExecutor(AsyncTask.THREAD_POOL_EXECUTOR);
}
- private void addPopularDestinations(@NonNull List