Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit ca7b0277 authored by Niels Egberts's avatar Niels Egberts
Browse files

New convenience method that takes a CharSequence and an Object as the

span that is applied to the appended text.

Change-Id: Ibdc4a71346e5691bcfe6af23f34beff69d642908
parent a9f10629
Loading
Loading
Loading
Loading
+1 −0
Original line number Diff line number Diff line
@@ -29465,6 +29465,7 @@ package android.text {
    ctor public SpannableStringBuilder(java.lang.CharSequence);
    ctor public SpannableStringBuilder(java.lang.CharSequence, int, int);
    method public android.text.SpannableStringBuilder append(java.lang.CharSequence);
    method public android.text.SpannableStringBuilder append(java.lang.CharSequence, java.lang.Object, int);
    method public android.text.SpannableStringBuilder append(java.lang.CharSequence, int, int);
    method public android.text.SpannableStringBuilder append(char);
    method public char charAt(int);
+15 −0
Original line number Diff line number Diff line
@@ -251,6 +251,21 @@ public class SpannableStringBuilder implements CharSequence, GetChars, Spannable
        return replace(length, length, text, 0, text.length());
    }

    /**
     * Appends the character sequence {@code text} and spans {@code what} over the appended part.
     * See {@link Spanned} for an explanation of what the flags mean.
     * @param text the character sequence to append.
     * @param what the object to be spanned over the appended text.
     * @param flags see {@link Spanned}.
     * @return this {@code SpannableStringBuilder}.
     */
    public SpannableStringBuilder append(CharSequence text, Object what, int flags) {
        int start = length();
        append(text);
        setSpan(what, start, length(), flags);
        return this;
    }

    // Documentation from interface
    public SpannableStringBuilder append(CharSequence text, int start, int end) {
        int length = length();