use of com.meisolsson.githubsdk.model.SearchPage in project gh4a by slapperwan.
the class RepositoryFragment method loadPullRequestCount.
private void loadPullRequestCount(boolean force) {
SearchService service = ServiceFactory.get(SearchService.class, force, null, null, 1);
String query = String.format(Locale.US, "type:pr repo:%s/%s state:open", mRepository.owner().login(), mRepository.name());
service.searchIssues(query, null, null, 0).map(ApiHelpers::throwOnFailure).map(SearchPage::totalCount).compose(makeLoaderSingle(ID_LOADER_PULL_REQUEST_COUNT, force)).subscribe(count -> {
View v = getView();
v.findViewById(R.id.issues_progress).setVisibility(View.GONE);
v.findViewById(R.id.pull_requests_progress).setVisibility(View.GONE);
TextView tvIssuesCount = mContentView.findViewById(R.id.tv_issues_count);
tvIssuesCount.setText(String.valueOf(mRepository.openIssuesCount() - count));
TextView tvPullRequestsCountView = v.findViewById(R.id.tv_pull_requests_count);
tvPullRequestsCountView.setText(String.valueOf(count));
}, this::handleLoadFailure);
}
Aggregations