diff --git a/app/src/main/java/eu/faircode/email/BoundaryCallbackMessages.java b/app/src/main/java/eu/faircode/email/BoundaryCallbackMessages.java index d6631e5d56..41fd13a049 100644 --- a/app/src/main/java/eu/faircode/email/BoundaryCallbackMessages.java +++ b/app/src/main/java/eu/faircode/email/BoundaryCallbackMessages.java @@ -885,7 +885,7 @@ public class BoundaryCallbackMessages extends PagedList.BoundaryCallbackAn example

when searching for "An example" if (contains(html, criteria.query, partial, true)) { - String text = HtmlHelper.getFullText(html); + String text = HtmlHelper.getFullText(html, false); if (contains(text, criteria.query, partial, false)) return true; } diff --git a/app/src/main/java/eu/faircode/email/Core.java b/app/src/main/java/eu/faircode/email/Core.java index c9a7d6f4be..372c40d0fd 100644 --- a/app/src/main/java/eu/faircode/email/Core.java +++ b/app/src/main/java/eu/faircode/email/Core.java @@ -2076,7 +2076,7 @@ class Core { String body = parts.getHtml(context, plain_text, charset); File file = message.getFile(context); Helper.writeText(file, body); - String text = HtmlHelper.getFullText(body); + String text = HtmlHelper.getFullText(body, true); message.preview = HtmlHelper.getPreview(text); message.language = HtmlHelper.getLanguage(context, message.subject, text); Integer plain_only = parts.isPlainOnly(); @@ -2249,7 +2249,7 @@ class Core { String body = parts.getHtml(context, download_plain); File file = message.getFile(context); Helper.writeText(file, body); - String text = HtmlHelper.getFullText(body); + String text = HtmlHelper.getFullText(body, true); message.preview = HtmlHelper.getPreview(text); message.language = HtmlHelper.getLanguage(context, message.subject, text); @@ -3611,7 +3611,7 @@ class Core { File file = message.getFile(context); Helper.writeText(file, body); - String text = HtmlHelper.getFullText(body); + String text = HtmlHelper.getFullText(body, true); message.preview = HtmlHelper.getPreview(text); message.language = HtmlHelper.getLanguage(context, message.subject, text); db.message().setMessageContent(message.id, @@ -4898,7 +4898,7 @@ class Core { body = parts.getHtml(context, download_plain); File file = message.getFile(context); Helper.writeText(file, body); - String text = HtmlHelper.getFullText(body); + String text = HtmlHelper.getFullText(body, true); message.content = true; message.preview = HtmlHelper.getPreview(text); message.language = HtmlHelper.getLanguage(context, message.subject, text); @@ -5418,7 +5418,7 @@ class Core { String body = parts.getHtml(context); File file = message.getFile(context); Helper.writeText(file, body); - String text = HtmlHelper.getFullText(body); + String text = HtmlHelper.getFullText(body, true); message.preview = HtmlHelper.getPreview(text); message.language = HtmlHelper.getLanguage(context, message.subject, text); db.message().setMessageContent(message.id, diff --git a/app/src/main/java/eu/faircode/email/EntityRule.java b/app/src/main/java/eu/faircode/email/EntityRule.java index 1db136a958..b157d11737 100644 --- a/app/src/main/java/eu/faircode/email/EntityRule.java +++ b/app/src/main/java/eu/faircode/email/EntityRule.java @@ -1180,7 +1180,7 @@ public class EntityRule { File file = reply.getFile(context); Helper.writeText(file, body); - String text = HtmlHelper.getFullText(body); + String text = HtmlHelper.getFullText(body, true); reply.preview = HtmlHelper.getPreview(text); reply.language = HtmlHelper.getLanguage(context, reply.subject, text); db.message().setMessageContent(reply.id, @@ -1292,7 +1292,7 @@ public class EntityRule { .append(' ').append(message.subject).append(". "); String body = Helper.readText(message.getFile(context)); - String text = HtmlHelper.getFullText(body); + String text = HtmlHelper.getFullText(body, false); String preview = HtmlHelper.getPreview(text); if (!TextUtils.isEmpty(preview)) diff --git a/app/src/main/java/eu/faircode/email/FragmentCompose.java b/app/src/main/java/eu/faircode/email/FragmentCompose.java index 81e5bf95c1..1f4f02c0e7 100644 --- a/app/src/main/java/eu/faircode/email/FragmentCompose.java +++ b/app/src/main/java/eu/faircode/email/FragmentCompose.java @@ -6140,7 +6140,7 @@ public class FragmentCompose extends FragmentBase { Helper.writeText(data.draft.getFile(context), html); Helper.writeText(data.draft.getFile(context, data.draft.revision), html); - String text = HtmlHelper.getFullText(html); + String text = HtmlHelper.getFullText(html, true); data.draft.preview = HtmlHelper.getPreview(text); data.draft.language = HtmlHelper.getLanguage(context, data.draft.subject, text); db.message().setMessageContent(data.draft.id, @@ -6327,7 +6327,7 @@ public class FragmentCompose extends FragmentBase { Helper.writeText(file, html); Helper.writeText(data.draft.getFile(context, data.draft.revision), html); - String text = HtmlHelper.getFullText(html); + String text = HtmlHelper.getFullText(html, true); data.draft.preview = HtmlHelper.getPreview(text); data.draft.language = HtmlHelper.getLanguage(context, data.draft.subject, text); db.message().setMessageContent(data.draft.id, @@ -7194,7 +7194,7 @@ public class FragmentCompose extends FragmentBase { if (f.length() > MAX_REASONABLE_SIZE) args.putBoolean("large", true); - String full = HtmlHelper.getFullText(body); + String full = HtmlHelper.getFullText(body, true); draft.preview = HtmlHelper.getPreview(full); draft.language = HtmlHelper.getLanguage(context, draft.subject, full); db.message().setMessageContent(draft.id, diff --git a/app/src/main/java/eu/faircode/email/FragmentFolders.java b/app/src/main/java/eu/faircode/email/FragmentFolders.java index 8389fa4f68..8d3ac1ecbf 100644 --- a/app/src/main/java/eu/faircode/email/FragmentFolders.java +++ b/app/src/main/java/eu/faircode/email/FragmentFolders.java @@ -1676,7 +1676,7 @@ public class FragmentFolders extends FragmentBase { File file = message.getFile(context); Helper.writeText(file, body); - String text = HtmlHelper.getFullText(body); + String text = HtmlHelper.getFullText(body, true); message.preview = HtmlHelper.getPreview(text); message.language = HtmlHelper.getLanguage(context, message.subject, text); db.message().setMessageContent(message.id, diff --git a/app/src/main/java/eu/faircode/email/FragmentMessages.java b/app/src/main/java/eu/faircode/email/FragmentMessages.java index e2d94586aa..437ee3716b 100644 --- a/app/src/main/java/eu/faircode/email/FragmentMessages.java +++ b/app/src/main/java/eu/faircode/email/FragmentMessages.java @@ -9290,7 +9290,7 @@ public class FragmentMessages extends FragmentBase Helper.writeText(message.getFile(context), html); Log.i("pgp html=" + (html == null ? null : html.length())); - String text = HtmlHelper.getFullText(html); + String text = HtmlHelper.getFullText(html, true); message.preview = HtmlHelper.getPreview(text); message.language = HtmlHelper.getLanguage(context, message.subject, text); @@ -10011,7 +10011,7 @@ public class FragmentMessages extends FragmentBase Helper.writeText(message.getFile(context), html); Log.i("s/mime html=" + (html == null ? null : html.length())); - String text = HtmlHelper.getFullText(html); + String text = HtmlHelper.getFullText(html, true); message.preview = HtmlHelper.getPreview(text); message.language = HtmlHelper.getLanguage(context, message.subject, text); diff --git a/app/src/main/java/eu/faircode/email/HtmlHelper.java b/app/src/main/java/eu/faircode/email/HtmlHelper.java index 86dfac79f7..f097a4abe4 100644 --- a/app/src/main/java/eu/faircode/email/HtmlHelper.java +++ b/app/src/main/java/eu/faircode/email/HtmlHelper.java @@ -2624,29 +2624,29 @@ public class HtmlHelper { return truncate(preview, PREVIEW_SIZE); } - static String getFullText(String body) { + static String getFullText(String body, boolean hidden) { try { if (body == null) return null; Document d = JsoupEx.parse(body); - return _getText(d); + return _getText(d, hidden); } catch (OutOfMemoryError ex) { Log.e(ex); return null; } } - static String getFullText(File file) throws IOException { + static String getFullText(File file, boolean hidden) throws IOException { try { Document d = JsoupEx.parse(file); - return _getText(d); + return _getText(d, hidden); } catch (OutOfMemoryError ex) { Log.e(ex); return null; } } - private static String _getText(Document d) { + private static String _getText(Document d, boolean hidden) { truncate(d, MAX_FULL_TEXT_SIZE); for (Element e : d.select("*")) { @@ -2667,7 +2667,7 @@ public class HtmlHelper { .trim() .toLowerCase(Locale.ROOT) .replaceAll("\\s+", " "); - if ("display".equals(key) && "none".equals(value)) { + if (!hidden && "display".equals(key) && "none".equals(value)) { e.remove(); break; } diff --git a/app/src/main/java/eu/faircode/email/MessageClassifier.java b/app/src/main/java/eu/faircode/email/MessageClassifier.java index f7346bd029..cedc8ba002 100644 --- a/app/src/main/java/eu/faircode/email/MessageClassifier.java +++ b/app/src/main/java/eu/faircode/email/MessageClassifier.java @@ -177,7 +177,7 @@ public class MessageClassifier { if (message.subject != null) texts.add(message.subject); - String text = HtmlHelper.getFullText(file); + String text = HtmlHelper.getFullText(file, false); if (text != null) texts.add(text); diff --git a/app/src/main/java/eu/faircode/email/NotificationHelper.java b/app/src/main/java/eu/faircode/email/NotificationHelper.java index 0ee2551acf..e8255b4854 100644 --- a/app/src/main/java/eu/faircode/email/NotificationHelper.java +++ b/app/src/main/java/eu/faircode/email/NotificationHelper.java @@ -1003,7 +1003,7 @@ class NotificationHelper { if (notify_preview_all) try { File file = message.getFile(context); - preview = HtmlHelper.getFullText(file); + preview = HtmlHelper.getFullText(file, true); if (preview != null && preview.length() > MAX_PREVIEW) preview = preview.substring(0, MAX_PREVIEW); } catch (Throwable ex) { diff --git a/app/src/main/java/eu/faircode/email/ServiceExternal.java b/app/src/main/java/eu/faircode/email/ServiceExternal.java index d5421f04a7..42c001d706 100644 --- a/app/src/main/java/eu/faircode/email/ServiceExternal.java +++ b/app/src/main/java/eu/faircode/email/ServiceExternal.java @@ -337,7 +337,7 @@ public class ServiceExternal extends ServiceBase { File file = msg.getFile(context); Helper.writeText(file, body); - String text = HtmlHelper.getFullText(body); + String text = HtmlHelper.getFullText(body, true); msg.preview = HtmlHelper.getPreview(text); msg.language = HtmlHelper.getLanguage(context, msg.subject, text); db.message().setMessageContent(msg.id, diff --git a/app/src/main/java/eu/faircode/email/ServiceSend.java b/app/src/main/java/eu/faircode/email/ServiceSend.java index dfbb83abd8..c830320650 100644 --- a/app/src/main/java/eu/faircode/email/ServiceSend.java +++ b/app/src/main/java/eu/faircode/email/ServiceSend.java @@ -722,7 +722,7 @@ public class ServiceSend extends ServiceBase implements SharedPreferences.OnShar if (plain != null && (plain & 1) != 0) body = body.replace("

", "
"); - String text = HtmlHelper.getFullText(body); + String text = HtmlHelper.getFullText(body, true); String language = HtmlHelper.getLanguage(this, message.subject, text); String preview = HtmlHelper.getPreview(text); diff --git a/app/src/main/java/eu/faircode/email/ServiceUI.java b/app/src/main/java/eu/faircode/email/ServiceUI.java index d4d96128b7..ddb0ae57fa 100644 --- a/app/src/main/java/eu/faircode/email/ServiceUI.java +++ b/app/src/main/java/eu/faircode/email/ServiceUI.java @@ -341,7 +341,7 @@ public class ServiceUI extends IntentService { Object obj = results.get("text"); String body = (obj == null ? null : "

" + obj.toString().replaceAll("\\r?\\n", "
") + "

"); - String text = HtmlHelper.getFullText(body); + String text = HtmlHelper.getFullText(body, true); String language = HtmlHelper.getLanguage(this, ref.subject, text); String preview = HtmlHelper.getPreview(text); diff --git a/app/src/main/java/eu/faircode/email/WorkerFts.java b/app/src/main/java/eu/faircode/email/WorkerFts.java index 559491d1a2..ace41b8a99 100644 --- a/app/src/main/java/eu/faircode/email/WorkerFts.java +++ b/app/src/main/java/eu/faircode/email/WorkerFts.java @@ -86,7 +86,7 @@ public class WorkerFts extends Worker { String text = null; if (message.content) { File file = message.getFile(context); - text = HtmlHelper.getFullText(file); + text = HtmlHelper.getFullText(file, false); } try {