Use invisible text for preview text

Like Gmail, Outlook and Apple do
This commit is contained in:
M66B
2024-05-09 17:58:33 +02:00
parent bfa347aa71
commit 12e79ce7e9
13 changed files with 26 additions and 26 deletions

View File

@@ -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;
}