Merge pull request #11179 from osmandapp/Travel-cards
Travel: Maps you need card, popular articles jumping
This commit is contained in:
commit
4117295fe8
3 changed files with 22 additions and 5 deletions
|
@ -159,7 +159,7 @@ public class ExploreRvAdapter extends RecyclerView.Adapter<RecyclerView.ViewHold
|
|||
if (isCardExists(getNeededMapsCardPosition(), TravelNeededMapsCard.TYPE)) {
|
||||
updateNeededMapsCard(false);
|
||||
} else if (addItem(getNeededMapsCardPosition(), card)) {
|
||||
notifyDataSetChanged();
|
||||
notifyItemInserted(getNeededMapsCardPosition());
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -147,8 +147,15 @@ public class ExploreTabFragment extends BaseOsmAndFragment implements DownloadEv
|
|||
|
||||
@Override
|
||||
public void savedArticlesUpdated() {
|
||||
if (isAdded()) {
|
||||
adapter.notifyDataSetChanged();
|
||||
OsmandApplication app = getMyApplication();
|
||||
if (app != null) {
|
||||
DownloadIndexesThread downloadThread = app.getDownloadThread();
|
||||
if (!downloadThread.getIndexes().isDownloadedFromInternet) {
|
||||
waitForIndexes = true;
|
||||
downloadThread.runReloadIndexFilesSilent();
|
||||
} else {
|
||||
checkDownloadIndexes();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -443,8 +450,12 @@ public class ExploreTabFragment extends BaseOsmAndFragment implements DownloadEv
|
|||
@Override
|
||||
protected void onPostExecute(Pair<List<IndexItem>, List<IndexItem>> res) {
|
||||
ExploreTabFragment fragment = weakFragment.get();
|
||||
if (res != null && fragment != null && fragment.isResumed()) {
|
||||
if (res != null && fragment != null && fragment.isAdded()) {
|
||||
fragment.addIndexItemCards(res.first, res.second);
|
||||
fragment.removeRedundantCards();
|
||||
if (!fragment.isResumed()) {
|
||||
fragment.invalidateAdapter();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -373,7 +373,13 @@ public class WikivoyageExploreActivity extends TabActivity implements DownloadEv
|
|||
|
||||
@Override
|
||||
public void savedArticlesUpdated() {
|
||||
updateFragments();
|
||||
ExploreTabFragment exploreTabFragment = getExploreTabFragment();
|
||||
SavedArticlesTabFragment savedArticlesTabFragment = getSavedArticlesTabFragment();
|
||||
if (exploreTabFragment != null && savedArticlesTabFragment != null
|
||||
&& exploreTabFragment.isAdded() && savedArticlesTabFragment.isAdded()) {
|
||||
exploreTabFragment.savedArticlesUpdated();
|
||||
savedArticlesTabFragment.savedArticlesUpdated();
|
||||
}
|
||||
}
|
||||
|
||||
public static class LoadWikivoyageData extends AsyncTask<Void, Void, Void> {
|
||||
|
|
Loading…
Reference in a new issue