Some context

This commit is contained in:
M66B 2023-11-27 17:56:30 +01:00
parent cb9ff03584
commit 1387e16366
2 changed files with 5 additions and 2 deletions

View File

@ -3169,7 +3169,7 @@ public class AdapterMessage extends RecyclerView.Adapter<AdapterMessage.ViewHold
if (BuildConfig.DEBUG)
for (Element struct : document.select("script[type=application/ld+json]"))
try {
document.body().append(new StructuredEmail(struct.html()).getHtml());
document.body().append(new StructuredEmail(struct.html()).getHtml(context));
} catch (Throwable ex) {
Log.w(ex);
}

View File

@ -19,6 +19,8 @@ package eu.faircode.email;
Copyright 2018-2023 by Marcel Bokhorst (M66B)
*/
import android.content.Context;
import org.json.JSONArray;
import org.json.JSONException;
import org.json.JSONObject;
@ -36,9 +38,10 @@ public class StructuredEmail {
jroot = new JSONObject(json);
}
public String getHtml() throws JSONException {
public String getHtml(Context context) throws JSONException {
StringBuilder sb = new StringBuilder();
getHtml(jroot, 0, sb);
Document d = Document.createShell("");
d.appendElement("pre")
.attr("style", "font-size: smaller !important;")