use of com.meisolsson.githubsdk.service.issues.IssueLabelService in project gh4a by slapperwan.
the class IssueLabelListActivity method addLabel.
private void addLabel(IssueLabelAdapter.EditableLabel label) {
String errorMessage = getString(R.string.issue_error_create_label, label.name());
IssueLabelService service = ServiceFactory.get(IssueLabelService.class, false);
Label newLabel = Label.builder().name(label.name()).color(label.color()).build();
service.createLabel(mRepoOwner, mRepoName, newLabel).map(ApiHelpers::throwOnFailure).compose(RxUtils.wrapForBackgroundTask(this, R.string.saving_msg, errorMessage)).subscribe(result -> {
mAddedLabel = null;
loadLabels(true);
setResult(RESULT_OK);
}, error -> handleActionFailure("Adding label failed", error));
}
use of com.meisolsson.githubsdk.service.issues.IssueLabelService in project gh4a by slapperwan.
the class IssueLabelListActivity method deleteLabel.
private void deleteLabel(IssueLabelAdapter.EditableLabel label) {
String errorMessage = getString(R.string.issue_error_delete_label, label.base().name());
IssueLabelService service = ServiceFactory.get(IssueLabelService.class, false);
service.deleteLabel(mRepoOwner, mRepoName, label.base().name()).map(ApiHelpers::throwOnFailure).compose(RxUtils.wrapForBackgroundTask(this, R.string.deleting_msg, errorMessage)).subscribe(result -> {
loadLabels(true);
setResult(RESULT_OK);
}, error -> handleActionFailure("Deleting label failed", error));
}
use of com.meisolsson.githubsdk.service.issues.IssueLabelService in project gh4a by slapperwan.
the class IssueListActivity method filterLabel.
private void filterLabel() {
if (mLabels != null) {
showLabelsDialog();
} else {
final IssueLabelService service = ServiceFactory.get(IssueLabelService.class, false);
registerTemporarySubscription(ApiHelpers.PageIterator.toSingle(page -> service.getRepositoryLabels(mRepoOwner, mRepoName, page)).compose(RxUtils::doInBackground).compose(RxUtils.wrapWithProgressDialog(this, R.string.loading_msg)).subscribe(labels -> {
mLabels = labels;
showLabelsDialog();
}, this::handleLoadFailure));
}
}
use of com.meisolsson.githubsdk.service.issues.IssueLabelService in project gh4a by slapperwan.
the class IssueEditActivity method loadLabels.
private void loadLabels() {
final IssueLabelService service = ServiceFactory.get(IssueLabelService.class, false);
registerTemporarySubscription(ApiHelpers.PageIterator.toSingle(page -> service.getRepositoryLabels(mRepoOwner, mRepoName, page)).compose(RxUtils::doInBackground).compose(RxUtils.wrapWithProgressDialog(this, R.string.loading_msg)).subscribe(result -> {
mAllLabels = result;
showLabelDialog();
}, this::handleLoadFailure));
}
use of com.meisolsson.githubsdk.service.issues.IssueLabelService in project gh4a by slapperwan.
the class IssueLabelListActivity method loadLabels.
private void loadLabels(boolean force) {
final IssueLabelService service = ServiceFactory.get(IssueLabelService.class, false);
ApiHelpers.PageIterator.toSingle(page -> service.getRepositoryLabels(mRepoOwner, mRepoName, page)).compose(RxUtils.mapList(IssueLabelAdapter.EditableLabel::new)).compose(makeLoaderSingle(ID_LOADER_LABELS, force)).subscribe(result -> {
UiUtils.hideImeForView(getCurrentFocus());
mAdapter.clear();
mAdapter.addAll(result);
setContentShown(true);
}, this::handleLoadFailure);
}
Aggregations