code: private void updateCountSpan() {
          //No count span with free form text
          if (!preventFreeFormText) { return; }
  
          Editable text = getText();
  
          int visibleCount = getText().getSpans(0, getText().length(), TokenImageSpan.class).length;
          countSpan.setCount(getObjects().size() - visibleCount);
  
          SpannableStringBuilder spannedCountText = new SpannableStringBuilder(countSpan.getCountText());
          spannedCountText.setSpan(countSpan, 0, spannedCountText.length(), Spanned.SPAN_EXCLUSIVE_EXCLUSIVE);
  
          internalEditInProgress = true;
          int countStart = text.getSpanStart(countSpan);
          if (countStart != -1) {
              //Span is in the text, replace existing text
              //This will also remove the span if the count is 0
              text.replace(countStart, text.getSpanEnd(countSpan), spannedCountText);
          } else {
              text.append(spannedCountText);
          }
  
          internalEditInProgress = false;
      }
docs: Set the count span the current number of hidden objects