Package icyllis.modernui.text
Class SpannedString
java.lang.Object
icyllis.modernui.text.SpannedString
- All Implemented Interfaces:
GetChars,Spanned,CharSequence
This is the class for text whose content and markup are immutable.
For mutable markup, see
SpannableString.-
Field Summary
Fields inherited from interface icyllis.modernui.text.Spanned
SPAN_COMPOSING, SPAN_EXCLUSIVE_EXCLUSIVE, SPAN_EXCLUSIVE_INCLUSIVE, SPAN_INCLUSIVE_EXCLUSIVE, SPAN_INCLUSIVE_INCLUSIVE, SPAN_INTERMEDIATE, SPAN_MARK_MARK, SPAN_MARK_POINT, SPAN_PARAGRAPH, SPAN_POINT_MARK, SPAN_POINT_MARK_MASK, SPAN_POINT_POINT, SPAN_PRIORITY, SPAN_PRIORITY_SHIFT, SPAN_USER, SPAN_USER_SHIFT -
Constructor Summary
ConstructorsConstructorDescriptionSpannedString(CharSequence source) SpannedString(CharSequence source, boolean ignoreNoCopySpan) SpannedString(CharSequence source, int start, int end) SpannedString(CharSequence source, int start, int end, boolean ignoreNoCopySpan) -
Method Summary
Modifier and TypeMethodDescriptionfinal charcharAt(int index) chars()booleanfinal voidgetChars(int srcBegin, int srcEnd, char[] dst, int dstBegin) intgetSpanEnd(Object span) Return the end of the range of text to which the specified markup object is attached, or-1if the object is not attached.intgetSpanFlags(Object span) Return the flags that were specified whenSpannable.setSpan(java.lang.Object, int, int, int)was used to attach the specified markup object, or0if the specified object has not been attached.<T> List<T> Query a set of the markup objects attached to the specified slice of thisCharSequenceand whose type is the specified type or a subclass of it.intgetSpanStart(Object span) Return the beginning of the range of text to which the specified markup object is attached, or-1if the object is not attached.inthashCode()booleanisEmpty()final intlength()intnextSpanTransition(int start, int limit, Class<?> type) Return the first offset greater thanstartwhere a markup object of classtypebegins or ends, orlimitif there are no starts or ends greater thanstartbut less thanlimit.voidremoveSpan(Object span) voidremoveSpan(Object span, int flags) voidsubSequence(int start, int end) final StringtoString()static SpannedStringvalueOf(CharSequence source) Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, waitMethods inherited from interface java.lang.CharSequence
charAt, chars, codePoints, isEmpty, length, toStringMethods inherited from interface icyllis.modernui.text.Spanned
getSpanEnd, getSpanFlags, getSpans, getSpans, getSpanStart, nextSpanTransition
-
Constructor Details
-
SpannedString
- Parameters:
source- source object to copy fromignoreNoCopySpan- whether to copy NoCopySpans in thesource
-
SpannedString
- Parameters:
source- source object to copy fromignoreNoCopySpan- whether to copy NoCopySpans in thesource
-
SpannedString
-
SpannedString
-
-
Method Details
-
valueOf
-
subSequence
- Specified by:
subSequencein interfaceCharSequence
-
setSpan
-
removeSpan
-
removeSpan
-
getSpans
@NonNull public <T> List<T> getSpans(int start, int end, Class<? extends T> type, @Nullable List<T> dest) Description copied from interface:SpannedQuery a set of the markup objects attached to the specified slice of thisCharSequenceand whose type is the specified type or a subclass of it.
SpecifynullorObject.classfor the type if you want all the objects regardless of type.If
destlist is non-null, it will be filled with the method results and returned as-is. Otherwise, a new (and possibly- unmodifiable) list will be created with method results and returned. The return list can be empty if there is no match. -
getSpanStart
Description copied from interface:SpannedReturn the beginning of the range of text to which the specified markup object is attached, or-1if the object is not attached.- Specified by:
getSpanStartin interfaceSpanned- Parameters:
span- markup object- Returns:
- the start char index
-
getSpanEnd
Description copied from interface:SpannedReturn the end of the range of text to which the specified markup object is attached, or-1if the object is not attached.- Specified by:
getSpanEndin interfaceSpanned- Parameters:
span- markup object- Returns:
- the end char index
-
getSpanFlags
Description copied from interface:SpannedReturn the flags that were specified whenSpannable.setSpan(java.lang.Object, int, int, int)was used to attach the specified markup object, or0if the specified object has not been attached.- Specified by:
getSpanFlagsin interfaceSpanned- Parameters:
span- markup object- Returns:
- the flags
-
nextSpanTransition
Description copied from interface:SpannedReturn the first offset greater thanstartwhere a markup object of classtypebegins or ends, orlimitif there are no starts or ends greater thanstartbut less thanlimit. SpecifynullorObject.classfor the type if you want every transition regardless of type.- Specified by:
nextSpanTransitionin interfaceSpanned- Parameters:
start- start char index of the slicelimit- end char index of the slicetype- the markup type- Returns:
- transition point
-
toString
- Specified by:
toStringin interfaceCharSequence- Overrides:
toStringin classObject
-
length
public final int length()- Specified by:
lengthin interfaceCharSequence
-
charAt
public final char charAt(int index) - Specified by:
charAtin interfaceCharSequence
-
getChars
public final void getChars(int srcBegin, int srcEnd, char[] dst, int dstBegin) -
isEmpty
public boolean isEmpty()- Specified by:
isEmptyin interfaceCharSequence
-
chars
- Specified by:
charsin interfaceCharSequence
-
codePoints
- Specified by:
codePointsin interfaceCharSequence
-
equals
-
hashCode
public int hashCode()
-