linkify-text
linkify-text copied to clipboard
Handle normal click event
You can't handle non-link taps currently. This change will make this possible. Sorry, don't have time for PR.
Basically, you need to add an additional callback along with onLinkClick, and onClick block should be changed to this:
val annotation = annotatedString.getStringAnnotations(
start = offset,
end = offset,
).firstOrNull()
if (annotation != null) {
if (linkEntire) {
onClickLink?.invoke(annotatedString.substring(annotation.start, annotation.end))
} else {
uriHandler.openUri(annotation.item)
onClickLink?.invoke(annotatedString.substring(annotation.start, annotation.end))
}
} else {
onClick?.invoke()
}