From 0881c3f9d1e6209beb72c7e37db61c773e8e94bc Mon Sep 17 00:00:00 2001 From: M66B Date: Tue, 8 Oct 2019 19:54:52 +0200 Subject: [PATCH] Fit html message to width --- .../eu/faircode/email/AdapterMessage.java | 7 +++-- .../java/eu/faircode/email/HtmlHelper.java | 26 +++++++------------ 2 files changed, 12 insertions(+), 21 deletions(-) diff --git a/app/src/main/java/eu/faircode/email/AdapterMessage.java b/app/src/main/java/eu/faircode/email/AdapterMessage.java index 00d8aaa0ed..a95ea087f8 100644 --- a/app/src/main/java/eu/faircode/email/AdapterMessage.java +++ b/app/src/main/java/eu/faircode/email/AdapterMessage.java @@ -1377,7 +1377,7 @@ public class AdapterMessage extends RecyclerView.Adapter 0) { - List viewport = new ArrayList<>(); - for (String param : params) - if (!param.toLowerCase(Locale.ROOT).contains("maximum-scale") && - !param.toLowerCase(Locale.ROOT).contains("user-scalable")) - viewport.add(param.trim()); - - if (viewport.size() == 0) - meta.attr("content", ""); - else - meta.attr("content", TextUtils.join(" ;", viewport) + ";"); - } - } + static void setViewport(Document document) { + // https://developer.mozilla.org/en-US/docs/Mozilla/Mobile/Viewport_meta_tag + document.head().select("meta").select("[name=viewport]").remove(); + + document.head().prependChild(document.createElement("meta") + .attr("name", "viewport") + .attr("content", "width=device-width, initial-scale=1.0")); + + Log.i(document.head().html()); } static String getPreview(String body) {