mirror of https://github.com/M66B/FairEmail.git
Autolink HTML
This commit is contained in:
parent
aaf4187631
commit
26c9312c96
|
@ -2527,6 +2527,9 @@ public class AdapterMessage extends RecyclerView.Adapter<AdapterMessage.ViewHold
|
|||
.appendElement("em")
|
||||
.text(context.getString(R.string.title_truncated));
|
||||
|
||||
HtmlHelper.autoLink(document);
|
||||
HtmlHelper.guessSchemes(document);
|
||||
|
||||
boolean overview_mode = prefs.getBoolean("overview_mode", false);
|
||||
HtmlHelper.setViewport(document, overview_mode);
|
||||
if (inline || show_images)
|
||||
|
|
|
@ -1327,6 +1327,19 @@ public class HtmlHelper {
|
|||
}, document);
|
||||
}
|
||||
|
||||
static void guessSchemes(Document document) {
|
||||
for (Element a : document.select("a"))
|
||||
try {
|
||||
String href = a.attr("href");
|
||||
if (TextUtils.isEmpty(href))
|
||||
continue;
|
||||
Uri uri = UriHelper.guessScheme(Uri.parse(href));
|
||||
a.attr("href", uri.toString());
|
||||
} catch (Throwable ex) {
|
||||
Log.e(ex);
|
||||
}
|
||||
}
|
||||
|
||||
static void normalizeNamespaces(Document parsed, boolean display_hidden) {
|
||||
// <html xmlns:v="urn:schemas-microsoft-com:vml"
|
||||
// xmlns:o="urn:schemas-microsoft-com:office:office"
|
||||
|
|
Loading…
Reference in New Issue