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

span that is applied to the appended text.

Change-Id: Ibdc4a71346e5691bcfe6af23f34beff69d642908
This commit is contained in:
Niels Egberts
2014-07-10 14:16:04 +01:00
parent a9f10629f4
commit ca7b0277d7
2 changed files with 16 additions and 0 deletions

View File

@@ -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);

View File

@@ -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();