use of oscar.riksdagskollen.Utilities.Callbacks.PartyDocumentCallback in project Riksdagskollen by OAndell.
the class PartyListFragment method loadNextPage.
/**
* Load the next page and add it to the adapter when downloaded and parsed.
* Hides the loading view.
*/
private void loadNextPage() {
setLoading(true);
RikdagskollenApp.getInstance().getRiksdagenAPIManager().getDocumentsForParty(party, pageToLoad, new PartyDocumentCallback() {
@Override
public void onDocumentsFetched(List<PartyDocument> documents) {
loadingView.setVisibility(View.GONE);
documentList.addAll(documents);
partyListAdapter.notifyDataSetChanged();
setLoading(false);
}
@Override
public void onFail(VolleyError error) {
setLoading(false);
pageToLoad--;
}
});
pageToLoad++;
}
Aggregations