/**
   * Set the text for the corresponding views.
   *
   * @param blocks list of all blocks to be set
   * @param subreddit
   */
  public void setViews(List<String> blocks, String subreddit) {
    removeAllViews();

    Context context = getContext();

    if (!blocks.isEmpty()) {
      setVisibility(View.VISIBLE);
    }

    for (String block : blocks) {
      if (block.startsWith("<table>")) {
        HorizontalScrollView scrollView = new HorizontalScrollView(context);
        scrollView.setScrollbarFadingEnabled(false);
        TableLayout table = formatTable(block, subreddit);
        scrollView.setLayoutParams(MARGIN_PARAMS);
        table.setPaddingRelative(0, 0, 0, Reddit.pxToDp(10, context));
        scrollView.addView(table);
        addView(scrollView);
      } else if (block.startsWith("<pre>")) {
        HorizontalScrollView scrollView = new HorizontalScrollView(context);
        scrollView.setScrollbarFadingEnabled(false);
        SpoilerRobotoTextView newTextView = new SpoilerRobotoTextView(context);
        newTextView.setTextHtml(block, subreddit);
        setStyle(newTextView, subreddit);
        scrollView.setLayoutParams(MARGIN_PARAMS);
        newTextView.setPaddingRelative(0, 0, 0, Reddit.pxToDp(10, context));
        scrollView.addView(newTextView);
        addView(scrollView);
      } else {
        SpoilerRobotoTextView newTextView = new SpoilerRobotoTextView(context);
        newTextView.setTextHtml(block, subreddit);
        setStyle(newTextView, subreddit);
        newTextView.setLayoutParams(MARGIN_PARAMS);
        addView(newTextView);
      }
    }
  }