Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit a334d184 authored by Justin Ghan's avatar Justin Ghan Committed by Android (Google) Code Review
Browse files

Merge "Don't trigger links for touches outside of line bounds"

parents 1e122a0b 22da5b3a
Loading
Loading
Loading
Loading
+13 −5
Original line number Diff line number Diff line
@@ -221,12 +221,20 @@ public class LinkMovementMethod extends ScrollingMovementMethod {
            y += widget.getScrollY();

            Layout layout = widget.getLayout();
            ClickableSpan[] links;
            if (y < 0 || y > layout.getHeight()) {
                links = null;
            } else {
                int line = layout.getLineForVertical(y);
                if (x < layout.getLineLeft(line) || x > layout.getLineRight(line)) {
                    links = null;
                } else {
                    int off = layout.getOffsetForHorizontal(line, x);
                    links = buffer.getSpans(off, off, ClickableSpan.class);
                }
            }

            ClickableSpan[] links = buffer.getSpans(off, off, ClickableSpan.class);

            if (links.length != 0) {
            if (links != null && links.length != 0) {
                ClickableSpan link = links[0];
                if (action == MotionEvent.ACTION_UP) {
                    if (link instanceof TextLinkSpan) {