Search in sources :

Example 1 with CommentRequest

use of com.meisolsson.githubsdk.model.request.CommentRequest in project PocketHub by pockethub.

the class CreateCommentActivity method createComment.

@Override
protected void createComment(String comment) {
    CommentRequest commentRequest = CommentRequest.builder().body(comment).build();
    ServiceGenerator.createService(this, IssueCommentService.class).createIssueComment(repositoryId.owner().login(), repositoryId.name(), issueNumber, commentRequest).subscribeOn(Schedulers.io()).observeOn(AndroidSchedulers.mainThread()).compose(this.<GitHubComment>bindToLifecycle()).subscribe(new ObserverAdapter<GitHubComment>() {

        @Override
        public void onSuccess(GitHubComment githubComment) {
            finish(githubComment);
        }
    });
}
Also used : CommentRequest(com.meisolsson.githubsdk.model.request.CommentRequest) IssueCommentService(com.meisolsson.githubsdk.service.issues.IssueCommentService) GitHubComment(com.meisolsson.githubsdk.model.GitHubComment)

Example 2 with CommentRequest

use of com.meisolsson.githubsdk.model.request.CommentRequest in project PocketHub by pockethub.

the class EditCommentActivity method editComment.

/**
     * Edit comment.
     *
     * @param commentText
     */
protected void editComment(String commentText) {
    CommentRequest commentRequest = CommentRequest.builder().body(commentText).build();
    ServiceGenerator.createService(this, IssueCommentService.class).editIssueComment(repositoryId.owner().login(), repositoryId.name(), comment.id(), commentRequest).subscribeOn(Schedulers.io()).observeOn(AndroidSchedulers.mainThread()).compose(this.<GitHubComment>bindToLifecycle()).subscribe(new ProgressObserverAdapter<GitHubComment>(this, R.string.editing_comment) {

        @Override
        public void onSuccess(GitHubComment edited) {
            super.onSuccess(edited);
            dismissProgress();
            finish(edited);
        }

        @Override
        public void onError(Throwable e) {
            super.onError(e);
            Log.d(TAG, "Exception editing comment on issue", e);
            ToastUtils.show(EditCommentActivity.this, e.getMessage());
        }
    }.start());
}
Also used : CommentRequest(com.meisolsson.githubsdk.model.request.CommentRequest) IssueCommentService(com.meisolsson.githubsdk.service.issues.IssueCommentService) ProgressObserverAdapter(com.github.pockethub.android.rx.ProgressObserverAdapter) GitHubComment(com.meisolsson.githubsdk.model.GitHubComment)

Example 3 with CommentRequest

use of com.meisolsson.githubsdk.model.request.CommentRequest in project PocketHub by pockethub.

the class CreateCommentActivity method createComment.

@Override
protected void createComment(final String comment) {
    CommentRequest commentRequest = CommentRequest.builder().body(comment).build();
    ServiceGenerator.createService(this, GistCommentService.class).createGistComment(gist.id(), commentRequest).subscribeOn(Schedulers.io()).observeOn(AndroidSchedulers.mainThread()).compose(this.<GitHubComment>bindToLifecycle()).subscribe(new ObserverAdapter<GitHubComment>() {

        @Override
        public void onSuccess(GitHubComment githubComment) {
            finish(githubComment);
        }

        @Override
        public void onError(Throwable error) {
            Log.e(TAG, "Exception creating comment on gist", error);
            ToastUtils.show(CreateCommentActivity.this, error.getMessage());
        }
    });
}
Also used : CommentRequest(com.meisolsson.githubsdk.model.request.CommentRequest) GistCommentService(com.meisolsson.githubsdk.service.gists.GistCommentService) GitHubComment(com.meisolsson.githubsdk.model.GitHubComment)

Example 4 with CommentRequest

use of com.meisolsson.githubsdk.model.request.CommentRequest in project PocketHub by pockethub.

the class EditCommentActivity method createComment.

@Override
protected void createComment(String comment) {
    CommentRequest commentRequest = CommentRequest.builder().body(comment).build();
    editComment(commentRequest);
}
Also used : CommentRequest(com.meisolsson.githubsdk.model.request.CommentRequest)

Aggregations

CommentRequest (com.meisolsson.githubsdk.model.request.CommentRequest)4 GitHubComment (com.meisolsson.githubsdk.model.GitHubComment)3 IssueCommentService (com.meisolsson.githubsdk.service.issues.IssueCommentService)2 ProgressObserverAdapter (com.github.pockethub.android.rx.ProgressObserverAdapter)1 GistCommentService (com.meisolsson.githubsdk.service.gists.GistCommentService)1