public class RongLinkify
extends java.lang.Object
Alone with the pattern that is to be matched, a url scheme prefix is also
required. Any pattern match that does not begin with the supplied scheme
will have the scheme prepended to the matched text when the clickable url
is created. For instance, if you are matching web urls you would supply
the scheme http://
. If the pattern matches example.com, which
does not have a url scheme prefix, the supplied scheme will be prepended to
create http://example.com
when the clickable url link is
created.
限定符和类型 | 类和说明 |
---|---|
static interface |
RongLinkify.MatchFilter
MatchFilter enables client code to have more control over
what is allowed to match and become a link, and what is not.
|
static interface |
RongLinkify.TransformFilter
TransformFilter enables client code to have more control over
how matched patterns are represented as URLs.
|
限定符和类型 | 字段和说明 |
---|---|
static int |
ALL
Bit mask indicating that all available patterns should be matched in
methods that take an options mask
|
static int |
EMAIL_ADDRESSES
Bit field indicating that email addresses should be matched in methods
that take an options mask
|
static int |
MAP_ADDRESSES
Bit field indicating that street addresses should be matched in methods that
take an options mask.
|
static int |
PHONE_NUMBERS
Bit field indicating that phone numbers should be matched in methods that
take an options mask
|
static android.text.util.Linkify.MatchFilter |
sPhoneNumberMatchFilter
Filters out URL matches that don't have enough digits to be a
phone number.
|
static android.text.util.Linkify.TransformFilter |
sPhoneNumberTransformFilter
Transforms matched phone number text into something suitable
to be used in a tel: URL.
|
static android.text.util.Linkify.MatchFilter |
sUrlMatchFilter
Filters out web URL matches that occur after an at-sign (@).
|
static java.util.regex.Pattern |
WEB_URL |
static int |
WEB_URLS
Bit field indicating that web URLs should be matched in methods that
take an options mask
|
构造器和说明 |
---|
RongLinkify() |
限定符和类型 | 方法和说明 |
---|---|
static boolean |
addLinks(android.text.Spannable text,
int mask)
Scans the text of the provided Spannable and turns all occurrences
of the link types indicated in the mask into clickable links.
|
static boolean |
addLinks(android.text.Spannable text,
java.util.regex.Pattern pattern,
java.lang.String scheme)
Applies a regex to a Spannable turning the matches into
links.
|
static boolean |
addLinks(android.text.Spannable s,
java.util.regex.Pattern p,
java.lang.String scheme,
android.text.util.Linkify.MatchFilter matchFilter,
android.text.util.Linkify.TransformFilter transformFilter)
Applies a regex to a Spannable turning the matches into
links.
|
static boolean |
addLinks(android.widget.TextView text,
int mask)
Scans the text of the provided TextView and turns all occurrences of
the link types indicated in the mask into clickable links.
|
static void |
addLinks(android.widget.TextView text,
java.util.regex.Pattern pattern,
java.lang.String scheme)
Applies a regex to the text of a TextView turning the matches into
links.
|
static void |
addLinks(android.widget.TextView text,
java.util.regex.Pattern p,
java.lang.String scheme,
android.text.util.Linkify.MatchFilter matchFilter,
android.text.util.Linkify.TransformFilter transformFilter)
Applies a regex to the text of a TextView turning the matches into
links.
|
public static final int WEB_URLS
public static final int EMAIL_ADDRESSES
public static final int PHONE_NUMBERS
public static final int MAP_ADDRESSES
findAddress()
method in
WebView
for finding addresses, which has various
limitations.public static final int ALL
public static final java.util.regex.Pattern WEB_URL
public static final android.text.util.Linkify.MatchFilter sUrlMatchFilter
public static final android.text.util.Linkify.MatchFilter sPhoneNumberMatchFilter
public static final android.text.util.Linkify.TransformFilter sPhoneNumberTransformFilter
public static boolean addLinks(android.text.Spannable text, int mask)
public static boolean addLinks(android.widget.TextView text, int mask)
public static void addLinks(android.widget.TextView text, java.util.regex.Pattern pattern, java.lang.String scheme)
text
- TextView whose text is to be marked-up with linkspattern
- Regex pattern to be used for finding linksscheme
- Url scheme string (eg http://
to be
prepended to the url of links that do not have
a scheme specified in the link textpublic static void addLinks(android.widget.TextView text, java.util.regex.Pattern p, java.lang.String scheme, android.text.util.Linkify.MatchFilter matchFilter, android.text.util.Linkify.TransformFilter transformFilter)
text
- TextView whose text is to be marked-up with linksp
- Regex pattern to be used for finding linksscheme
- Url scheme string (eg http://
to be
prepended to the url of links that do not have
a scheme specified in the link textmatchFilter
- The filter that is used to allow the client code
additional control over which pattern matches are
to be converted into links.public static boolean addLinks(android.text.Spannable text, java.util.regex.Pattern pattern, java.lang.String scheme)
text
- Spannable whose text is to be marked-up with
linkspattern
- Regex pattern to be used for finding linksscheme
- Url scheme string (eg http://
to be
prepended to the url of links that do not have
a scheme specified in the link textpublic static boolean addLinks(android.text.Spannable s, java.util.regex.Pattern p, java.lang.String scheme, android.text.util.Linkify.MatchFilter matchFilter, android.text.util.Linkify.TransformFilter transformFilter)
s
- Spannable whose text is to be marked-up with
linksp
- Regex pattern to be used for finding linksscheme
- Url scheme string (eg http://
to be
prepended to the url of links that do not have
a scheme specified in the link textmatchFilter
- The filter that is used to allow the client code
additional control over which pattern matches are
to be converted into links.