use of com.meisolsson.githubsdk.service.issues.IssueMilestoneService in project gh4a by slapperwan.
the class IssueListActivity method filterMilestone.
private void filterMilestone() {
if (mMilestones != null) {
showMilestonesDialog();
} else {
final IssueMilestoneService service = ServiceFactory.get(IssueMilestoneService.class, false);
registerTemporarySubscription(ApiHelpers.PageIterator.toSingle(page -> service.getRepositoryMilestones(mRepoOwner, mRepoName, "open", page)).compose(RxUtils::doInBackground).compose(RxUtils.wrapWithProgressDialog(this, R.string.loading_msg)).subscribe(milestones -> {
mMilestones = milestones;
showMilestonesDialog();
}, this::handleLoadFailure));
}
}
use of com.meisolsson.githubsdk.service.issues.IssueMilestoneService in project gh4a by slapperwan.
the class IssueMilestoneEditActivity method deleteMilestone.
private void deleteMilestone() {
IssueMilestoneService service = ServiceFactory.get(IssueMilestoneService.class, false);
service.deleteMilestone(mRepoOwner, mRepoName, mMilestone.number()).map(ApiHelpers::throwOnFailure).compose(RxUtils.wrapForBackgroundTask(this, R.string.deleting_msg, R.string.issue_error_delete_milestone)).subscribe(result -> {
setResult(RESULT_OK);
finish();
}, error -> handleActionFailure("Deleting milestone failed", error));
}
use of com.meisolsson.githubsdk.service.issues.IssueMilestoneService in project gh4a by slapperwan.
the class IssueEditActivity method loadMilestones.
private void loadMilestones() {
final IssueMilestoneService service = ServiceFactory.get(IssueMilestoneService.class, false);
registerTemporarySubscription(ApiHelpers.PageIterator.toSingle(page -> service.getRepositoryMilestones(mRepoOwner, mRepoName, "open", page)).compose(RxUtils::doInBackground).compose(RxUtils.wrapWithProgressDialog(this, R.string.loading_msg)).subscribe(result -> {
mAllMilestone = result;
showMilestonesDialog();
}, this::handleLoadFailure));
}
use of com.meisolsson.githubsdk.service.issues.IssueMilestoneService in project gh4a by slapperwan.
the class IssueMilestoneListFragment method onCreateDataSingle.
@Override
protected Single<List<Milestone>> onCreateDataSingle(boolean bypassCache) {
final IssueMilestoneService service = ServiceFactory.get(IssueMilestoneService.class, bypassCache);
String targetState = mShowClosed ? "closed" : "open";
return ApiHelpers.PageIterator.toSingle(page -> service.getRepositoryMilestones(mRepoOwner, mRepoName, targetState, page));
}
use of com.meisolsson.githubsdk.service.issues.IssueMilestoneService in project gh4a by slapperwan.
the class IssueMilestoneEditActivity method setMilestoneState.
private void setMilestoneState(boolean open) {
@StringRes int dialogMessageResId = open ? R.string.opening_msg : R.string.closing_msg;
String errorMessage = getString(open ? R.string.issue_milestone_reopen_error : R.string.issue_milestone_close_error, mMilestone.title());
IssueMilestoneService service = ServiceFactory.get(IssueMilestoneService.class, false);
CreateMilestone request = CreateMilestone.builder().state(open ? IssueState.Open : IssueState.Closed).build();
service.editMilestone(mRepoOwner, mRepoName, mMilestone.id(), request).map(ApiHelpers::throwOnFailure).compose(RxUtils.wrapForBackgroundTask(this, dialogMessageResId, errorMessage)).subscribe(result -> {
mMilestone = result;
updateHighlightColor();
supportInvalidateOptionsMenu();
setResult(RESULT_OK);
}, error -> handleActionFailure("Updating milestone failed", error));
}
Aggregations