mirror of
https://github.com/M66B/FairEmail.git
synced 2025-02-25 07:23:03 +00:00
Auto link ftp, fish, telnet, xmpp, geo and tel
This commit is contained in:
parent
5b2dbea130
commit
9052760439
1 changed files with 13 additions and 1 deletions
|
@ -52,6 +52,7 @@ import android.text.style.TypefaceSpan;
|
|||
import android.text.style.URLSpan;
|
||||
import android.text.style.UnderlineSpan;
|
||||
import android.util.Base64;
|
||||
import android.util.Patterns;
|
||||
import android.view.View;
|
||||
import android.view.textclassifier.TextClassificationManager;
|
||||
import android.view.textclassifier.TextLanguage;
|
||||
|
@ -881,9 +882,20 @@ public class HtmlHelper {
|
|||
|
||||
// Autolink
|
||||
if (view) {
|
||||
// https://en.wikipedia.org/wiki/List_of_URI_schemes
|
||||
// ftp (generic syntax)
|
||||
// fish://[<username>[:<password>]@]<hostname>[:<port>]
|
||||
// telnet://<user>:<password>@<host>[:<port>/]
|
||||
// geo:<lat>,<lon>[,<alt>][;u=<uncertainty>]
|
||||
// tel:<phonenumber>
|
||||
// xmpp:[<user>]@<host>[:<port>]/[<resource>][?<query>]
|
||||
final Pattern pattern = Pattern.compile(
|
||||
PatternsCompat.AUTOLINK_EMAIL_ADDRESS.pattern() + "|" +
|
||||
PatternsCompat.AUTOLINK_WEB_URL.pattern());
|
||||
PatternsCompat.AUTOLINK_WEB_URL.pattern()
|
||||
.replace("(?i:http|https|rtsp)://",
|
||||
"(((?i:http|https|rtsp|ftp|fish|telnet)://)|((?i:xmpp):))") + "|" +
|
||||
"(?i:geo:\\d+,\\d+(,\\d+)?(;u=\\d+)?)|" +
|
||||
"(?i:tel:" + Patterns.PHONE.pattern() + ")");
|
||||
|
||||
NodeTraversor.traverse(new NodeVisitor() {
|
||||
private int links = 0;
|
||||
|
|
Loading…
Reference in a new issue