use of com.meisolsson.githubsdk.service.search.SearchService in project PocketHub by pockethub.
the class SearchIssueListFragment method onCreateLoader.
@Override
public Loader<List<Issue>> onCreateLoader(int id, Bundle args) {
return new ThrowableLoader<List<Issue>>(getActivity(), items) {
@Override
public List<Issue> loadData() throws Exception {
if (repository == null) {
return Collections.emptyList();
}
List<Issue> matches = new ArrayList<>();
SearchService service = ServiceGenerator.createService(getActivity(), SearchService.class);
int current = 1;
int last = 0;
while (current != last) {
SearchPage<Issue> page = service.searchIssues(query, null, null, current).blockingGet();
matches.addAll(page.items());
last = page.last() != null ? page.last() : -1;
current = page.next() != null ? page.next() : -1;
}
Collections.sort(matches, SearchIssueListFragment.this);
return matches;
}
};
}
Aggregations