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
Implementation of the Text with
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);
URLSpan
.-
Nested Class Summary
Nested classes/interfaces inherited from interface icyllis.modernui.util.Parcelable
Parcelable.ClassLoaderCreator<T>, Parcelable.Creator<T>, Parcelable.WriteFlags
-
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionint
Return a special type identifier for this span class.getURL()
Get the url string for this span.void
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 ofParcel
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
-
Constructor Details
-
Method Details
-
getSpanTypeId
public int getSpanTypeId()Description copied from interface:ParcelableSpan
Return a special type identifier for this span class.- Specified by:
getSpanTypeId
in interfaceParcelableSpan
-
writeToParcel
Description copied from interface:Parcelable
The subclass implements the method to flatten its contents by calling the methods ofParcel
for its primitive values.- Specified by:
writeToParcel
in interfaceParcelable
- Parameters:
dest
- the parcel to write the object's data toflags
- the flags about how the object should be written
-
getURL
Get the url string for this span.- Returns:
- the url string.
-
onClick
Description copied from class:ClickableSpan
Performs the click action associated with this span.- Specified by:
onClick
in classClickableSpan
-