Exemplo n.º 1
0
  protected void updateComment(final Comment comment) {
    imageGetter.bind(textView(0), comment.getBodyHtml(), comment.getId());
    avatars.bind(imageView(3), comment.getUser());

    setText(1, comment.getUser().getLogin());
    setText(2, TimeUtils.getRelativeTime(comment.getUpdatedAt()));

    final boolean canEdit =
        (isOwner || comment.getUser().getLogin().equals(userName)) && editCommentListener != null;

    final boolean canDelete =
        (isOwner || comment.getUser().getLogin().equals(userName)) && deleteCommentListener != null;

    final ImageView ivMore = view(4);

    if (!canEdit && !canDelete) ivMore.setVisibility(View.INVISIBLE);
    else
      ivMore.setOnClickListener(
          new OnClickListener() {
            @Override
            public void onClick(View v) {
              showMorePopup(ivMore, comment, canEdit, canDelete);
            }
          });
  }
Exemplo n.º 2
0
 @Override
 protected FullCommit run(Account account) throws Exception {
   Commit commit = store.refreshCommit(repository, id);
   GitCommit rawCommit = commit.commit;
   if (rawCommit != null && rawCommit.comment_count > 0) {
     List<CommitComment> comments =
         new GetCommitCommentsClient(context, InfoUtils.createCommitInfo(repository, commit.sha))
             .executeSync();
     for (CommitComment comment : comments) {
       String formatted = HtmlUtils.format(comment.body_html).toString();
       comment.body_html = formatted;
       imageGetter.encode(comment, formatted);
     }
     return new FullCommit(commit, comments);
   } else return new FullCommit(commit);
 }