Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Save SergeyKharuk/87f3e4c6f4b46385893c5f3a679222f0 to your computer and use it in GitHub Desktop.
Save SergeyKharuk/87f3e4c6f4b46385893c5f3a679222f0 to your computer and use it in GitHub Desktop.
Request
private void getTopics(){
currentPage = PAGE_START;
progressDialog.show();
Connector.getInstance(mMainActivity)
.getForumManager()
.getTopics("Bearer " + storeDataManager.getCurrentUser().token, String.valueOf(currentPage), String.valueOf(AMOUNT_TOPICS_I_GET))
.subscribeOn(Schedulers.io())
.observeOn(AndroidSchedulers.mainThread())
.subscribe(rTopics -> {
mySwipeRefreshLayout.setRefreshing(false);
if(rTopics != null && rTopics.data != null && rTopics.data.size() != 0){
currentPage++;
totalPages = rTopics.meta.getTotalPages();
}
if (rTopics.data.size()==0) {
cvPlaceholder.setVisibility(rTopics.data.size() == 0 ? View.VISIBLE : View.GONE);
itemTopTopic.setVisibility(View.GONE);
progressDialog.dismiss();
} else
getTopTopic(rTopics.data);
}, e -> {
progressDialog.dismiss();
});
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment