Search in sources :

Example 1 with SearchPage

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);
}
Also used : SearchPage(com.meisolsson.githubsdk.model.SearchPage) SearchService(com.meisolsson.githubsdk.service.search.SearchService) TextView(android.widget.TextView) View(android.view.View) TextView(android.widget.TextView)

Aggregations

View (android.view.View)1 TextView (android.widget.TextView)1 SearchPage (com.meisolsson.githubsdk.model.SearchPage)1 SearchService (com.meisolsson.githubsdk.service.search.SearchService)1