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)) {
|
if (isCardExists(getNeededMapsCardPosition(), TravelNeededMapsCard.TYPE)) {
|
||||||
updateNeededMapsCard(false);
|
updateNeededMapsCard(false);
|
||||||
} else if (addItem(getNeededMapsCardPosition(), card)) {
|
} else if (addItem(getNeededMapsCardPosition(), card)) {
|
||||||
notifyDataSetChanged();
|
notifyItemInserted(getNeededMapsCardPosition());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -147,8 +147,15 @@ public class ExploreTabFragment extends BaseOsmAndFragment implements DownloadEv
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void savedArticlesUpdated() {
|
public void savedArticlesUpdated() {
|
||||||
if (isAdded()) {
|
OsmandApplication app = getMyApplication();
|
||||||
adapter.notifyDataSetChanged();
|
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
|
@Override
|
||||||
protected void onPostExecute(Pair<List<IndexItem>, List<IndexItem>> res) {
|
protected void onPostExecute(Pair<List<IndexItem>, List<IndexItem>> res) {
|
||||||
ExploreTabFragment fragment = weakFragment.get();
|
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.addIndexItemCards(res.first, res.second);
|
||||||
|
fragment.removeRedundantCards();
|
||||||
|
if (!fragment.isResumed()) {
|
||||||
|
fragment.invalidateAdapter();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -373,7 +373,13 @@ public class WikivoyageExploreActivity extends TabActivity implements DownloadEv
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void savedArticlesUpdated() {
|
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> {
|
public static class LoadWikivoyageData extends AsyncTask<Void, Void, Void> {
|
||||||
|
|
Loading…
Reference in a new issue