You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
privateclassLinkMovementMethodTouchListener : View.OnTouchListener {
overridefunonTouch(
v:View,
event:MotionEvent
): Boolean {
val widget = v asTextViewval action = event.action
if (widget.text isSpannedString&& action ==MotionEvent.ACTION_UP) {
var x = event.x.toInt()
var y = event.y.toInt()
x -= widget.totalPaddingLeft
y -= widget.totalPaddingTop
x += widget.scrollX
y += widget.scrollY
val layout = widget.layout
val line = layout.getLineForVertical(y)
val off = layout.getOffsetForHorizontal(line, x.toFloat())
val links = (widget.text asSpannedString).getSpans(off, off, ClickableSpan::class.java)
if (links.isNotEmpty()) {
links[0].onClick(widget)
returntrue
}
}
returntrue
}
}
The text was updated successfully, but these errors were encountered:
The text was updated successfully, but these errors were encountered: