public final class LinkifyCompat extends Object
Linkify
improvements for URLs and email addresses to older API
levels.Modifier and Type | Class and Description |
---|---|
static interface |
LinkifyCompat.LinkifyMask |
Modifier and Type | Method and Description |
---|---|
static boolean |
addLinks(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(Spannable text,
Pattern pattern,
String scheme)
Applies a regex to a Spannable turning the matches into
links.
|
static boolean |
addLinks(Spannable spannable,
Pattern pattern,
String scheme,
Linkify.MatchFilter matchFilter,
Linkify.TransformFilter transformFilter)
Applies a regex to a Spannable turning the matches into
links.
|
static boolean |
addLinks(Spannable spannable,
Pattern pattern,
String defaultScheme,
String[] schemes,
Linkify.MatchFilter matchFilter,
Linkify.TransformFilter transformFilter)
Applies a regex to a Spannable turning the matches into links.
|
static boolean |
addLinks(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(TextView text,
Pattern pattern,
String scheme)
Applies a regex to the text of a TextView turning the matches into
links.
|
static void |
addLinks(TextView text,
Pattern pattern,
String scheme,
Linkify.MatchFilter matchFilter,
Linkify.TransformFilter transformFilter)
Applies a regex to the text of a TextView turning the matches into
links.
|
static void |
addLinks(TextView text,
Pattern pattern,
String defaultScheme,
String[] schemes,
Linkify.MatchFilter matchFilter,
Linkify.TransformFilter transformFilter)
Applies a regex to the text of a TextView turning the matches into
links.
|
public static final boolean addLinks(@NonNull Spannable text, int mask)
text
- Spannable whose text is to be marked-up with linksmask
- Mask to define which kinds of links will be searched.public static final boolean addLinks(@NonNull TextView text, int mask)
text
- TextView whose text is to be marked-up with linksmask
- Mask to define which kinds of links will be searched.public static final void addLinks(@NonNull TextView text, @NonNull Pattern pattern, @Nullable 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 links that do not start with this scheme.public static final void addLinks(@NonNull TextView text, @NonNull Pattern pattern, @Nullable String scheme, @Nullable Linkify.MatchFilter matchFilter, @Nullable Linkify.TransformFilter transformFilter)
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 links that do not start with this scheme.matchFilter
- The filter that is used to allow the client code
additional control over which pattern matches are
to be converted into links.public static final void addLinks(@NonNull TextView text, @NonNull Pattern pattern, @Nullable String defaultScheme, @Nullable String[] schemes, @Nullable Linkify.MatchFilter matchFilter, @Nullable Linkify.TransformFilter transformFilter)
text
- TextView whose text is to be marked-up with links.pattern
- Regex pattern to be used for finding links.defaultScheme
- The default scheme to be prepended to links if the link does not
start with one of the schemes
given.schemes
- Array of schemes (eg http://
) to check if the link found
contains a scheme. Passing a null or empty value means prepend defaultScheme
to all links.matchFilter
- The filter that is used to allow the client code additional control
over which pattern matches are to be converted into links.transformFilter
- Filter to allow the client code to update the link found.public static final boolean addLinks(@NonNull Spannable text, @NonNull Pattern pattern, @Nullable 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 links that do not start with this scheme.public static final boolean addLinks(@NonNull Spannable spannable, @NonNull Pattern pattern, @Nullable String scheme, @Nullable Linkify.MatchFilter matchFilter, @Nullable Linkify.TransformFilter transformFilter)
spannable
- 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 links that do not start with this scheme.matchFilter
- The filter that is used to allow the client code
additional control over which pattern matches are
to be converted into links.transformFilter
- Filter to allow the client code to update the link found.public static final boolean addLinks(@NonNull Spannable spannable, @NonNull Pattern pattern, @Nullable String defaultScheme, @Nullable String[] schemes, @Nullable Linkify.MatchFilter matchFilter, @Nullable Linkify.TransformFilter transformFilter)
spannable
- Spannable whose text is to be marked-up with links.pattern
- Regex pattern to be used for finding links.defaultScheme
- The default scheme to be prepended to links if the link does not
start with one of the schemes
given.schemes
- Array of schemes (eg http://
) to check if the link found
contains a scheme. Passing a null or empty value means prepend defaultScheme
to all links.matchFilter
- The filter that is used to allow the client code additional control
over which pattern matches are to be converted into links.transformFilter
- Filter to allow the client code to update the link found.