spyglass/src/main/java/com/linkedin/android/spyglass/ui/MentionsEditText.java
private void replacePlaceholdersWithCorrespondingMentionSpans(@NonNull Editable text) {
        PlaceholderSpan[] tempSpans = text.getSpans(0, text.length(), PlaceholderSpan.class);
        for (PlaceholderSpan span : tempSpans) {
            int spanStart = text.getSpanStart(span);
            String mentionDisplayString = span.holder.getDisplayString();
            int end = Math.min(spanStart + mentionDisplayString.length(), text.length());
            text.replace(spanStart, end, mentionDisplayString);
            text.setSpan(span.holder, spanStart, spanStart + mentionDisplayString.length(), Spanned.SPAN_EXCLUSIVE_EXCLUSIVE);
            text.removeSpan(span);
        }
    }
private void replacePlaceholdersWithCorrespondingMentionSpans(@NonNull Editable text) {
        PlaceholderSpan[] tempSpans = text.getSpans(0, text.length(), PlaceholderSpan.class);
        for (PlaceholderSpan span : tempSpans) {
            int spanStart = text.getSpanStart(span);
            String mentionDisplayString = span.holder.getDisplayString();
            int end = Math.min(spanStart + mentionDisplayString.length(), text.length());
            text.replace(spanStart, end, mentionDisplayString);
            text.setSpan(span.holder, spanStart, spanStart + mentionDisplayString.length(), Spanned.SPAN_EXCLUSIVE_EXCLUSIVE);
            text.removeSpan(span);
        }
    }
private void replacePlaceholdersWithCorrespondingMentionSpans ( @ NonNull Editable text ) { PlaceholderSpan [ ] tempSpans = text . getSpans ( 0 , text . length ( ) , PlaceholderSpan . class ) ; for ( PlaceholderSpan span : tempSpans ) { int spanStart = text . getSpanStart ( span ) ; String mentionDisplayString = span . holder . getDisplayString ( ) ; int end = Math . min ( spanStart + mentionDisplayString . length ( ) , text . length ( ) ) ; text . replace ( spanStart , end , mentionDisplayString ) ; text . setSpan ( span . holder , spanStart , spanStart + mentionDisplayString . length ( ) , Spanned . SPAN_EXCLUSIVE_EXCLUSIVE ) ; text . removeSpan ( span ) ; } }
Replaces any {@link com.linkedin.android.spyglass.ui.MentionsEditText.PlaceholderSpan} within the given text with
the {@link MentionSpan} it contains.

Note: These PlaceholderSpans are added in {@link #replaceMentionSpansWithPlaceholdersAsNecessary(CharSequence)}

@param text the final version of the text after it was changed
Replaces any { @link com . linkedin . android . spyglass . ui . MentionsEditText . PlaceholderSpan } within the given text with the { @link MentionSpan } it contains .