use of com.meisolsson.githubsdk.service.organizations.OrganizationMemberService in project PocketHub by pockethub.
the class MembersFragment 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 {
OrganizationMemberService service = ServiceGenerator.createService(getContext(), OrganizationMemberService.class);
int current = 1;
int last = -1;
List<User> users = new ArrayList<>();
while (current != last) {
Page<User> page = service.getMembers(org.login(), current).blockingGet();
users.addAll(page.items());
last = page.last() != null ? page.last() : -1;
current = page.next() != null ? page.next() : -1;
}
return users;
}
};
}
Aggregations