|
|
@ -20,6 +20,8 @@ package eu.faircode.email;
|
|
|
|
*/
|
|
|
|
*/
|
|
|
|
|
|
|
|
|
|
|
|
import android.content.Context;
|
|
|
|
import android.content.Context;
|
|
|
|
|
|
|
|
import android.net.Uri;
|
|
|
|
|
|
|
|
import android.text.TextUtils;
|
|
|
|
|
|
|
|
|
|
|
|
import org.json.JSONArray;
|
|
|
|
import org.json.JSONArray;
|
|
|
|
import org.json.JSONException;
|
|
|
|
import org.json.JSONException;
|
|
|
@ -43,9 +45,11 @@ public class StructuredEmail {
|
|
|
|
getHtml(jroot, 0, sb);
|
|
|
|
getHtml(jroot, 0, sb);
|
|
|
|
|
|
|
|
|
|
|
|
Document d = Document.createShell("");
|
|
|
|
Document d = Document.createShell("");
|
|
|
|
d.appendElement("pre")
|
|
|
|
d.appendElement("hr")
|
|
|
|
|
|
|
|
.appendElement("pre")
|
|
|
|
.attr("style", "font-size: smaller !important;")
|
|
|
|
.attr("style", "font-size: smaller !important;")
|
|
|
|
.text(sb.toString());
|
|
|
|
.text(sb.toString())
|
|
|
|
|
|
|
|
.appendElement("hr");
|
|
|
|
return d.html();
|
|
|
|
return d.html();
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
@ -63,13 +67,26 @@ public class StructuredEmail {
|
|
|
|
.append(':')
|
|
|
|
.append(':')
|
|
|
|
.append('\n');
|
|
|
|
.append('\n');
|
|
|
|
getHtml(v, indent + 1, sb);
|
|
|
|
getHtml(v, indent + 1, sb);
|
|
|
|
} else
|
|
|
|
} else {
|
|
|
|
|
|
|
|
if (v instanceof String) {
|
|
|
|
|
|
|
|
String s = (String) v;
|
|
|
|
|
|
|
|
if (s.startsWith("https://"))
|
|
|
|
|
|
|
|
try {
|
|
|
|
|
|
|
|
Uri uri = Uri.parse(s);
|
|
|
|
|
|
|
|
String p = uri.getPath();
|
|
|
|
|
|
|
|
if (!TextUtils.isEmpty(p))
|
|
|
|
|
|
|
|
v = split(p.substring(1));
|
|
|
|
|
|
|
|
} catch (Throwable ex) {
|
|
|
|
|
|
|
|
Log.w(ex);
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
}
|
|
|
|
sb.append(indent(indent))
|
|
|
|
sb.append(indent(indent))
|
|
|
|
.append(split(key))
|
|
|
|
.append(split(key))
|
|
|
|
.append(": ")
|
|
|
|
.append(": ")
|
|
|
|
.append(v)
|
|
|
|
.append(v)
|
|
|
|
.append('\n');
|
|
|
|
.append('\n');
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
}
|
|
|
|
} else if (obj instanceof JSONArray) {
|
|
|
|
} else if (obj instanceof JSONArray) {
|
|
|
|
JSONArray jarray = (JSONArray) obj;
|
|
|
|
JSONArray jarray = (JSONArray) obj;
|
|
|
|
for (int i = 0; i < jarray.length(); i++)
|
|
|
|
for (int i = 0; i < jarray.length(); i++)
|
|
|
|