use of com.meisolsson.githubsdk.service.repositories.RepositoryService in project PocketHub by pockethub.
the class RepositoryContributorsFragment method onCreateLoader.
@Override
public Loader<List<User>> onCreateLoader(int id, Bundle args) {
return new ThrowableLoader<List<User>>(getActivity(), items) {
@Override
public List<User> loadData() throws Exception {
RepositoryService service = ServiceGenerator.createService(getActivity(), RepositoryService.class);
int current = 1;
int last = 0;
List<User> users = new ArrayList<>();
while (current != last) {
Page<User> page = service.getContributors(repo.owner().login(), repo.name(), current).blockingGet();
users.addAll(page.items());
last = page.last() != null ? page.last() : -1;
current = page.next() != null ? page.next() : -1;
}
return users;
}
};
}
Aggregations