Package icyllis.modernui.text.style

# Class URLSpan

java.lang.Object
icyllis.modernui.text.style.CharacterStyle
icyllis.modernui.text.style.ClickableSpan
icyllis.modernui.text.style.URLSpan

All Implemented Interfaces:
  `ParcelableSpan`, `UpdateAppearance`, `Parcelable`

public class URLSpan extends ClickableSpan implements ParcelableSpan
Implementation of the `ClickableSpan` that allows setting a url string. When selecting and clicking on the text to which the span is attached, the `URLSpan` will try to open the url, by calling `Core.openURI(String)`.

For example, a `URLSpan` can be used like this:

     SpannableString string = new SpannableString("Text with a url span");
     string.setSpan(new URLSpan("https://google.com"), 12, 15, Spanned.SPAN_EXCLUSIVE_EXCLUSIVE);

Text with `URLSpan`.

- ## Nested Class Summary

  ## Nested classes/interfaces inherited from interface icyllis.modernui.util.Parcelable

  `Parcelable.ClassLoaderCreator<T>, Parcelable.Creator<T>, Parcelable.WriteFlags`

- ## Constructor Summary

  Constructors
  Constructor
  Description
  `URLSpan(Parcel src)`
  Constructs a `URLSpan` from a parcel.
  `URLSpan(String url)`
  Constructs a `URLSpan` from an url string.

- ## Method Summary

  Modifier and Type
  Method
  Description
  `int`
  `getSpanTypeId()`
  Return a special type identifier for this span class.
  `String`
  `getURL()`
  Get the url string for this span.
  `void`
  `onClick(View widget)`
  Performs the click action associated with this span.
  `void`
  `writeToParcel(Parcel dest, int flags)`
  The subclass implements the method to flatten its contents by calling the methods of `Parcel` for its primitive values.

  ### Methods inherited from class icyllis.modernui.text.style.ClickableSpan

  `getId, updateDrawState`

  ### Methods inherited from class icyllis.modernui.text.style.CharacterStyle

  `getUnderlying, wrap`

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

  `clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

- ## Constructor Details

  - ### URLSpan

    public URLSpan(String url)
    Constructs a `URLSpan` from an url string.
    Parameters:
      `url` - the url string

  - ### URLSpan

    public URLSpan(@NonNull Parcel src)
    Constructs a `URLSpan` from a parcel.

- ## Method Details

  - ### getSpanTypeId

    public int getSpanTypeId()
    Description copied from interface: `ParcelableSpan`
    Return a special type identifier for this span class.
    Specified by:
      `getSpanTypeId` in interface `ParcelableSpan`

  - ### writeToParcel

    public void writeToParcel(@NonNull Parcel dest, int flags)
    Description copied from interface: `Parcelable`
    The subclass implements the method to flatten its contents by calling the methods of `Parcel` for its primitive values.
    Specified by:
      `writeToParcel` in interface `Parcelable`
    Parameters:
      `dest` - the parcel to write the object's data to
      `flags` - the flags about how the object should be written

  - ### getURL

    public String getURL()
    Get the url string for this span.
    Returns:
      the url string.

  - ### onClick

    public void onClick(@NonNull View widget)
    Description copied from class: `ClickableSpan`
    Performs the click action associated with this span.
    Specified by:
      `onClick` in class `ClickableSpan`