Created
March 12, 2018 14:21
-
-
Save SergeyKharuk/87f3e4c6f4b46385893c5f3a679222f0 to your computer and use it in GitHub Desktop.
Request
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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