/** * Updates the TextView counting the number of characters in the editor. Sets not only the content * of the TextView, but also the color of the text depending if the limit has been reached. */ private void updateEditorTextCount() { if (mMentionsEditText != null && mTextCounterView != null) { int textCount = mMentionsEditText.getMentionsText().length(); mTextCounterView.setText(String.valueOf(textCount)); if (mTextCountLimit > 0 && textCount > mTextCountLimit) { mTextCounterView.setTextColor(mBeyondCountLimitTextColor); } else { mTextCounterView.setTextColor(mWithinCountLimitTextColor); } } }
/** @return a list of {@link MentionSpan} objects currently in the editor */ @NonNull public List<MentionSpan> getMentionSpans() { return (mMentionsEditText != null) ? mMentionsEditText.getMentionsText().getMentionSpans() : new ArrayList<MentionSpan>(); }