Package icyllis.modernui.text

# Class SpannableString

java.lang.Object
icyllis.modernui.text.SpannableString

All Implemented Interfaces:
  `GetChars`, `Spannable`, `Spanned`, `CharSequence`

public class SpannableString extends Object implements Spannable, GetChars
This is the class for text whose content is immutable but to which markup objects can be attached and detached.

- ## Nested Class Summary

  ## Nested classes/interfaces inherited from interface icyllis.modernui.text.Spannable

  `Spannable.Factory`

- ## Field Summary

  ### Fields inherited from interface icyllis.modernui.text.Spannable

  `DEFAULT_FACTORY`

  ### 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

  Constructors
  Constructor
  Description
  `SpannableString(CharSequence source)`
  `SpannableString(CharSequence source, boolean ignoreNoCopySpan)`
  `SpannableString(CharSequence source, int start, int end)`
  `SpannableString(CharSequence source, int start, int end, boolean ignoreNoCopySpan)`

- ## Method Summary

  Modifier and Type
  Method
  Description
  `final char`
  `charAt(int index)`
  `IntStream`
  `chars()`
  `IntStream`
  `codePoints()`
  `boolean`
  `equals(Object o)`
  `final void`
  `getChars(int srcBegin, int srcEnd, char[] dst, int dstBegin)`
  `int`
  `getSpanEnd(Object span)`
  Return the end of the range of text to which the specified markup object is attached, or `-1` if the object is not attached.
  `int`
  `getSpanFlags(Object span)`
  Return the flags that were specified when `Spannable.setSpan(java.lang.Object, int, int, int)` was used to attach the specified markup object, or `0` if the specified object has not been attached.
  `<T> List<T>`
  `getSpans(int start, int end, Class<? extends T> type, List<T> dest)`
  Query a set of the markup objects attached to the specified slice of this `CharSequence` and whose type is the specified type or a subclass of it.
  `int`
  `getSpanStart(Object span)`
  Return the beginning of the range of text to which the specified markup object is attached, or `-1` if the object is not attached.
  `int`
  `hashCode()`
  `boolean`
  `isEmpty()`
  `final int`
  `length()`
  `int`
  `nextSpanTransition(int start, int limit, Class<?> type)`
  Return the first offset greater than `start` where a markup object of class `type` begins or ends, or `limit` if there are no starts or ends greater than `start` but less than `limit`.
  `void`
  `removeSpan(Object span)`
  `void`
  `removeSpan(Object span, int flags)`
  `void`
  `setSpan(Object span, int start, int end, int flags)`
  `CharSequence`
  `subSequence(int start, int end)`
  `final String`
  `toString()`
  `static SpannableString`
  `valueOf(CharSequence source)`

  ### Methods inherited from class java.lang.Object

  `clone, finalize, getClass, notify, notifyAll, wait, wait, wait`

  ### Methods inherited from interface java.lang.CharSequence

  `charAt, chars, codePoints, isEmpty, length, toString`

  ### Methods inherited from interface icyllis.modernui.text.GetChars

  `getChars`

  ### Methods inherited from interface icyllis.modernui.text.Spannable

  `removeSpan, removeSpan, setSpan`

  ### Methods inherited from interface icyllis.modernui.text.Spanned

  `getSpanEnd, getSpanFlags, getSpans, getSpans, getSpanStart, nextSpanTransition`

- ## Constructor Details

  - ### SpannableString

    public SpannableString(@NonNull CharSequence source, boolean ignoreNoCopySpan)
    Parameters:
      `source` - source object to copy from
      `ignoreNoCopySpan` - whether to copy NoCopySpans in the `source`

  - ### SpannableString

    public SpannableString(@NonNull CharSequence source, int start, int end, boolean ignoreNoCopySpan)

  - ### SpannableString

    public SpannableString(@NonNull CharSequence source)

  - ### SpannableString

    public SpannableString(@NonNull CharSequence source, int start, int end)

- ## Method Details

  - ### valueOf

    @NonNull public static SpannableString valueOf(@NonNull CharSequence source)

  - ### subSequence

    @NonNull public CharSequence subSequence(int start, int end)
    Specified by:
      `subSequence` in interface `CharSequence`

  - ### setSpan

    public void setSpan(@NonNull Object span, int start, int end, int flags)

  - ### removeSpan

    public void removeSpan(@NonNull Object span)

  - ### removeSpan

    public void removeSpan(@NonNull Object span, int flags)

  - ### getSpans

    @NonNull public <T> List<T> getSpans(int start, int end, Class<? extends T> type, @Nullable List<T> dest)
    Description copied from interface: `Spanned`
    Query a set of the markup objects attached to the specified slice of this `CharSequence` and whose type is the specified type or a subclass of it.
    Specify `null` or `Object.class` for the type if you want all the objects regardless of type.

    If `dest` list 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.

    Specified by:
      `getSpans` in interface `Spanned`
    Parameters:
      `start` - start char index of the slice
      `end` - end char index of the slice
      `type` - markup class
      `dest` - the list that receives method results
    Returns:
      the list of results

  - ### getSpanStart

    public int getSpanStart(@NonNull Object span)
    Description copied from interface: `Spanned`
    Return the beginning of the range of text to which the specified markup object is attached, or `-1` if the object is not attached.
    Specified by:
      `getSpanStart` in interface `Spanned`
    Parameters:
      `span` - markup object
    Returns:
      the start char index

  - ### getSpanEnd

    public int getSpanEnd(@NonNull Object span)
    Description copied from interface: `Spanned`
    Return the end of the range of text to which the specified markup object is attached, or `-1` if the object is not attached.
    Specified by:
      `getSpanEnd` in interface `Spanned`
    Parameters:
      `span` - markup object
    Returns:
      the end char index

  - ### getSpanFlags

    public int getSpanFlags(@NonNull Object span)
    Description copied from interface: `Spanned`
    Return the flags that were specified when `Spannable.setSpan(java.lang.Object, int, int, int)` was used to attach the specified markup object, or `0` if the specified object has not been attached.
    Specified by:
      `getSpanFlags` in interface `Spanned`
    Parameters:
      `span` - markup object
    Returns:
      the flags

  - ### nextSpanTransition

    public int nextSpanTransition(int start, int limit, @Nullable Class<?> type)
    Description copied from interface: `Spanned`
    Return the first offset greater than `start` where a markup object of class `type` begins or ends, or `limit` if there are no starts or ends greater than `start` but less than `limit`. Specify `null` or `Object.class` for the type if you want every transition regardless of type.
    Specified by:
      `nextSpanTransition` in interface `Spanned`
    Parameters:
      `start` - start char index of the slice
      `limit` - end char index of the slice
      `type` - the markup type
    Returns:
      transition point

  - ### toString

    @NonNull public final String toString()
    Specified by:
      `toString` in interface `CharSequence`
    Overrides:
      `toString` in class `Object`

  - ### length

    public final int length()
    Specified by:
      `length` in interface `CharSequence`

  - ### charAt

    public final char charAt(int index)
    Specified by:
      `charAt` in interface `CharSequence`

  - ### getChars

    public final void getChars(int srcBegin, int srcEnd, char[] dst, int dstBegin)
    Specified by:
      `getChars` in interface `GetChars`

  - ### isEmpty

    public boolean isEmpty()
    Specified by:
      `isEmpty` in interface `CharSequence`

  - ### chars

    @NonNull public IntStream chars()
    Specified by:
      `chars` in interface `CharSequence`

  - ### codePoints

    @NonNull public IntStream codePoints()
    Specified by:
      `codePoints` in interface `CharSequence`

  - ### equals

    public boolean equals(Object o)
    Overrides:
      `equals` in class `Object`

  - ### hashCode

    public int hashCode()
    Overrides:
      `hashCode` in class `Object`