private void addApprovalRow()

in app/src/main/java/com/google/reviewit/widget/ApprovalsView.java [117:166]


  private void addApprovalRow(
      ReviewItApp app, AccountInfo account, ApprovalData approvalData) {
    TableRow tr = new TableRow(getContext());
    tr.setLayoutParams(matchAndWrapTableRowLayout());
    int textSizeSp = 14;

    tr.addView(bottomMargin(widgetUtil.tableRowRightMargin(
        createAvatar(app, account), 4), 5));
    tr.addView(bottomMargin(widgetUtil.tableRowRightMargin(
        widgetUtil.createTextView(
            FormatUtil.format(account), textSizeSp), 4), 5));

    for (Map.Entry<String, Map<Integer, ApprovalInfo>> e
        : approvalData.approvalsByLabel.entrySet()) {
      String labelName = e.getKey();
      LabelInfo label = approvalData.labels.get(labelName);

      if (label.approved != null
          && label.approved._accountId.equals(account._accountId)) {
        tr.addView(createPositiveVoteIcon());
      } else if (label.rejected != null
          && label.rejected._accountId.equals(account._accountId)) {
        tr.addView(createNegativeVoteIcon());
      } else {
        ApprovalInfo approval = e.getValue().get(account._accountId);
        if (approval != null && approval.value != null) {
          if (approvalData.isMax(label, approval.value)) {
            tr.addView(createPositiveVoteIcon());
          } else if (approvalData.isMin(label, approval.value)) {
            tr.addView(createNegativeVoteIcon());
          } else {
            TextView text = widgetUtil.createTextView(
                FormatUtil.formatLabelValue(approval.value), textSizeSp);
            tr.addView(bottomMargin(center(text), 5));
            if (approval.value > 0) {
              text.setTextColor(widgetUtil.color(R.color.votePositive));
            } else if (approval.value < 0) {
              text.setTextColor(widgetUtil.color(R.color.voteNegative));
            } else {
              text.setText("0");
            }
          }
        } else {
          tr.addView(bottomMargin(center(
              widgetUtil.createTextView("0", textSizeSp)), 5));
        }
      }
    }
    addView(tr, matchAndWrapTableLayout());
  }