Search in sources :

Example 1 with CommitLinesModel

use of com.fastaccess.data.dao.CommitLinesModel in project FastHub by k0shk0sh.

the class PullRequestFilesFragment method onCommentAdded.

@Override
public void onCommentAdded(@NonNull String comment, @NonNull CommitLinesModel item, Bundle bundle) {
    if (bundle != null) {
        String path = bundle.getString(BundleConstant.ITEM);
        if (path == null)
            return;
        CommentRequestModel commentRequestModel = new CommentRequestModel();
        commentRequestModel.setBody(comment);
        commentRequestModel.setPath(path);
        commentRequestModel.setPosition(item.getPosition());
        if (viewCallback != null)
            viewCallback.onAddComment(commentRequestModel);
        int groupPosition = bundle.getInt(BundleConstant.EXTRA_TWO);
        int childPosition = bundle.getInt(BundleConstant.EXTRA_THREE);
        CommitFileChanges commitFileChanges = adapter.getItem(groupPosition);
        List<CommitLinesModel> models = commitFileChanges.getLinesModel();
        if (models != null && !models.isEmpty()) {
            CommitLinesModel current = models.get(childPosition);
            if (current != null) {
                current.setHasCommentedOn(true);
            }
            models.set(childPosition, current);
            adapter.notifyItemChanged(groupPosition);
        }
    }
}
Also used : CommentRequestModel(com.fastaccess.data.dao.CommentRequestModel) CommitLinesModel(com.fastaccess.data.dao.CommitLinesModel) CommitFileChanges(com.fastaccess.data.dao.CommitFileChanges)

Aggregations

CommentRequestModel (com.fastaccess.data.dao.CommentRequestModel)1 CommitFileChanges (com.fastaccess.data.dao.CommitFileChanges)1 CommitLinesModel (com.fastaccess.data.dao.CommitLinesModel)1