From 9a19cbeca4fee41db2fc44f5512ba3b20afd3993 Mon Sep 17 00:00:00 2001 From: M66B Date: Mon, 15 May 2023 09:26:32 +0200 Subject: [PATCH] Auto-link shared links --- app/src/main/java/eu/faircode/email/ActivityCompose.java | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/app/src/main/java/eu/faircode/email/ActivityCompose.java b/app/src/main/java/eu/faircode/email/ActivityCompose.java index ac7656ebf3..7c48ca759f 100644 --- a/app/src/main/java/eu/faircode/email/ActivityCompose.java +++ b/app/src/main/java/eu/faircode/email/ActivityCompose.java @@ -39,6 +39,8 @@ import androidx.lifecycle.Lifecycle; import androidx.lifecycle.LifecycleOwner; import androidx.preference.PreferenceManager; +import org.jsoup.nodes.Document; + import java.io.File; import java.util.ArrayList; import java.util.Arrays; @@ -220,8 +222,12 @@ public class ActivityCompose extends ActivityBase implements FragmentManager.OnB html = HtmlHelper.toHtml((Spanned) body, this); else { String text = body.toString(); - if (!TextUtils.isEmpty(text)) + if (!TextUtils.isEmpty(text)) { html = "" + text.replaceAll("\\r?\\n", "
") + "
"; + Document d = JsoupEx.parse(html); + HtmlHelper.autoLink(d, true); + html = d.body().html(); + } } }