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

Commit a0db63f6 authored by Siyamed Sinir's avatar Siyamed Sinir
Browse files

TextView.append() honors autoLink attribute

The append() method now checks if autoLink is set and adds the
URLSpans to given text before appending to the existing text.

Fixes https://code.google.com/p/android/issues/detail?id=1244
Fixes https://code.google.com/p/android/issues/detail?id=191353

Bug: 1404366
Bug: 25222125
Change-Id: I47a8beec9799e4f92ce266ceed41a634b7f7cc96
parent b39ca7fa
Loading
Loading
Loading
Loading
+9 −0
Original line number Diff line number Diff line
@@ -3975,6 +3975,15 @@ public class TextView extends View implements ViewTreeObserver.OnPreDrawListener
        }

        ((Editable) mText).append(text, start, end);

        if (mAutoLinkMask != 0) {
            boolean linksWereAdded = Linkify.addLinks((Spannable) mText, mAutoLinkMask);
            // Do not change the movement method for text that support text selection as it
            // would prevent an arbitrary cursor displacement.
            if (linksWereAdded && mLinksClickable && !textCanBeSelected()) {
                setMovementMethod(LinkMovementMethod.getInstance());
            }
        }
    }

    private void updateTextColors() {