Beispiel #1
0
  /**
   * Scroll the th given comment
   *
   * @param commentId The comment id to scroll to
   */
  private void scrollToComment(long commentId) {
    Optional<Integer> offset = adapter.getOffset(commentsAdapter);
    if (!offset.isPresent()) return;

    for (int idx = 0; idx < commentsAdapter.getItemCount(); idx++) {
      if (commentsAdapter.getItemId(idx) == commentId) {
        content.scrollToPosition(offset.get() + idx);
        break;
      }
    }

    commentsAdapter.setSelectedCommentId(commentId);
  }