use of com.meisolsson.githubsdk.model.Page in project PocketHub by pockethub.
the class AssigneeDialog method load.
private void load(final User selectedAssignee) {
getPageAndNext(1).subscribe(new ProgressObserverAdapter<Page<User>>(activity, R.string.loading_collaborators) {
List<User> users = new ArrayList<>();
@Override
public void onError(Throwable error) {
dismissProgress();
Log.d(TAG, "Exception loading collaborators", error);
ToastUtils.show(activity, error, R.string.error_collaborators_load);
}
@Override
public void onComplete() {
super.onComplete();
Map<String, User> loadedCollaborators = new TreeMap<>(CASE_INSENSITIVE_ORDER);
for (User user : users) {
loadedCollaborators.put(user.login(), user);
}
collaborators = loadedCollaborators;
dismissProgress();
show(selectedAssignee);
}
@Override
public void onNext(Page<User> page) {
users.addAll(page.items());
}
}.start());
}
use of com.meisolsson.githubsdk.model.Page in project PocketHub by pockethub.
the class RefDialog method load.
private void load(final GitReference selectedRef) {
getPageAndNext(1).subscribe(new ProgressObserverAdapter<Page<GitReference>>(activity, R.string.loading_refs) {
List<GitReference> allRefs = new ArrayList<>();
@Override
public void onNext(Page<GitReference> page) {
super.onNext(page);
allRefs.addAll(page.items());
}
@Override
public void onComplete() {
super.onComplete();
Map<String, GitReference> loadedRefs = new TreeMap<>(CASE_INSENSITIVE_ORDER);
for (GitReference ref : allRefs) {
if (RefUtils.isValid(ref)) {
loadedRefs.put(ref.ref(), ref);
}
}
refs = loadedRefs;
show(selectedRef);
}
@Override
public void onError(Throwable e) {
super.onError(e);
Log.d(TAG, "Exception loading references", e);
ToastUtils.show(activity, e, R.string.error_refs_load);
}
}.start());
}
use of com.meisolsson.githubsdk.model.Page in project PocketHub by pockethub.
the class LabelsDialog method load.
private void load(final Collection<Label> selectedLabels) {
getPageAndNext(1).subscribe(new ProgressObserverAdapter<Page<Label>>(activity, R.string.loading_labels) {
List<Label> repositoryLabels = new ArrayList<>();
@Override
public void onNext(Page<Label> page) {
repositoryLabels.addAll(page.items());
}
@Override
public void onComplete() {
super.onComplete();
Map<String, Label> loadedLabels = new TreeMap<>(CASE_INSENSITIVE_ORDER);
for (Label label : repositoryLabels) {
loadedLabels.put(label.name(), label);
}
labels = loadedLabels;
dismissProgress();
show(selectedLabels);
}
@Override
public void onError(Throwable error) {
dismissProgress();
Log.e(TAG, "Exception loading labels", error);
ToastUtils.show(activity, error, R.string.error_labels_load);
}
}.start());
}
Aggregations