AI 149203: Manual merge CL 149118: "Make URL which is in the head of body text be
clickable." BUG=1810716 Automated import of CL 149203
This commit is contained in:
parent
c2887cd81d
commit
fc9e1ce030
@ -950,7 +950,12 @@ public class MessageView extends Activity
|
|||||||
Matcher m = Regex.WEB_URL_PATTERN.matcher(text);
|
Matcher m = Regex.WEB_URL_PATTERN.matcher(text);
|
||||||
while (m.find()) {
|
while (m.find()) {
|
||||||
int start = m.start();
|
int start = m.start();
|
||||||
if (start != 0 && text.charAt(start - 1) != '@') {
|
/*
|
||||||
|
* WEB_URL_PATTERN may match domain part of email address. To detect
|
||||||
|
* this false match, the character just before the matched string
|
||||||
|
* should not be '@'.
|
||||||
|
*/
|
||||||
|
if (start == 0 || text.charAt(start - 1) != '@') {
|
||||||
m.appendReplacement(sb, "<a href=\"$0\">$0</a>");
|
m.appendReplacement(sb, "<a href=\"$0\">$0</a>");
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
|
Loading…
Reference in New Issue
Block a user