|
|
@ -7133,7 +7133,6 @@ public class FragmentMessages extends FragmentBase implements SharedPreferences.
|
|
|
|
return null;
|
|
|
|
return null;
|
|
|
|
|
|
|
|
|
|
|
|
Document document = JsoupEx.parse(file);
|
|
|
|
Document document = JsoupEx.parse(file);
|
|
|
|
HtmlHelper.truncate(document, false);
|
|
|
|
|
|
|
|
HtmlHelper.embedInlineImages(context, id, document, true);
|
|
|
|
HtmlHelper.embedInlineImages(context, id, document, true);
|
|
|
|
|
|
|
|
|
|
|
|
// Prevent multiple pages for Microsoft Office
|
|
|
|
// Prevent multiple pages for Microsoft Office
|
|
|
@ -7141,88 +7140,92 @@ public class FragmentMessages extends FragmentBase implements SharedPreferences.
|
|
|
|
if (section == null)
|
|
|
|
if (section == null)
|
|
|
|
section = document.body();
|
|
|
|
section = document.body();
|
|
|
|
|
|
|
|
|
|
|
|
Element header = document.createElement("p");
|
|
|
|
SharedPreferences prefs = PreferenceManager.getDefaultSharedPreferences(context);
|
|
|
|
|
|
|
|
boolean print_html_header = prefs.getBoolean("print_html_header", true);
|
|
|
|
|
|
|
|
if (print_html_header) {
|
|
|
|
|
|
|
|
Element header = document.createElement("p");
|
|
|
|
|
|
|
|
|
|
|
|
if (message.from != null && message.from.length > 0) {
|
|
|
|
if (message.from != null && message.from.length > 0) {
|
|
|
|
Element span = document.createElement("span");
|
|
|
|
Element span = document.createElement("span");
|
|
|
|
Element strong = document.createElement("strong");
|
|
|
|
Element strong = document.createElement("strong");
|
|
|
|
strong.text(context.getString(R.string.title_from));
|
|
|
|
strong.text(context.getString(R.string.title_from));
|
|
|
|
span.appendChild(strong);
|
|
|
|
span.appendChild(strong);
|
|
|
|
span.appendText(" " + MessageHelper.formatAddresses(message.from));
|
|
|
|
span.appendText(" " + MessageHelper.formatAddresses(message.from));
|
|
|
|
span.appendElement("br");
|
|
|
|
span.appendElement("br");
|
|
|
|
header.appendChild(span);
|
|
|
|
header.appendChild(span);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
if (message.to != null && message.to.length > 0) {
|
|
|
|
if (message.to != null && message.to.length > 0) {
|
|
|
|
Element span = document.createElement("span");
|
|
|
|
Element span = document.createElement("span");
|
|
|
|
Element strong = document.createElement("strong");
|
|
|
|
Element strong = document.createElement("strong");
|
|
|
|
strong.text(context.getString(R.string.title_to));
|
|
|
|
strong.text(context.getString(R.string.title_to));
|
|
|
|
span.appendChild(strong);
|
|
|
|
span.appendChild(strong);
|
|
|
|
span.appendText(" " + MessageHelper.formatAddresses(message.to));
|
|
|
|
span.appendText(" " + MessageHelper.formatAddresses(message.to));
|
|
|
|
span.appendElement("br");
|
|
|
|
span.appendElement("br");
|
|
|
|
header.appendChild(span);
|
|
|
|
header.appendChild(span);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
if (message.cc != null && message.cc.length > 0) {
|
|
|
|
if (message.cc != null && message.cc.length > 0) {
|
|
|
|
Element span = document.createElement("span");
|
|
|
|
Element span = document.createElement("span");
|
|
|
|
Element strong = document.createElement("strong");
|
|
|
|
Element strong = document.createElement("strong");
|
|
|
|
strong.text(context.getString(R.string.title_cc));
|
|
|
|
strong.text(context.getString(R.string.title_cc));
|
|
|
|
span.appendChild(strong);
|
|
|
|
span.appendChild(strong);
|
|
|
|
span.appendText(" " + MessageHelper.formatAddresses(message.cc));
|
|
|
|
span.appendText(" " + MessageHelper.formatAddresses(message.cc));
|
|
|
|
span.appendElement("br");
|
|
|
|
span.appendElement("br");
|
|
|
|
header.appendChild(span);
|
|
|
|
header.appendChild(span);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
if (message.received != null) {
|
|
|
|
if (message.received != null) {
|
|
|
|
DateFormat DTF = Helper.getDateTimeInstance(context, SimpleDateFormat.LONG, SimpleDateFormat.LONG);
|
|
|
|
DateFormat DTF = Helper.getDateTimeInstance(context, SimpleDateFormat.LONG, SimpleDateFormat.LONG);
|
|
|
|
|
|
|
|
|
|
|
|
Element span = document.createElement("span");
|
|
|
|
Element span = document.createElement("span");
|
|
|
|
Element strong = document.createElement("strong");
|
|
|
|
Element strong = document.createElement("strong");
|
|
|
|
strong.text(context.getString(R.string.title_received));
|
|
|
|
strong.text(context.getString(R.string.title_received));
|
|
|
|
span.appendChild(strong);
|
|
|
|
span.appendChild(strong);
|
|
|
|
span.appendText(" " + DTF.format(message.received));
|
|
|
|
span.appendText(" " + DTF.format(message.received));
|
|
|
|
span.appendElement("br");
|
|
|
|
span.appendElement("br");
|
|
|
|
header.appendChild(span);
|
|
|
|
header.appendChild(span);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
if (!TextUtils.isEmpty(message.subject)) {
|
|
|
|
if (!TextUtils.isEmpty(message.subject)) {
|
|
|
|
Element span = document.createElement("span");
|
|
|
|
Element span = document.createElement("span");
|
|
|
|
span.appendText(message.subject);
|
|
|
|
span.appendText(message.subject);
|
|
|
|
span.appendElement("br");
|
|
|
|
span.appendElement("br");
|
|
|
|
header.appendChild(span);
|
|
|
|
header.appendChild(span);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
if (headers && message.headers != null) {
|
|
|
|
if (headers && message.headers != null) {
|
|
|
|
header.appendElement("hr");
|
|
|
|
header.appendElement("hr");
|
|
|
|
Element pre = document.createElement("pre");
|
|
|
|
Element pre = document.createElement("pre");
|
|
|
|
pre.text(message.headers);
|
|
|
|
pre.text(message.headers);
|
|
|
|
header.appendChild(pre);
|
|
|
|
header.appendChild(pre);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
header.appendElement("hr").appendElement("br");
|
|
|
|
header.appendElement("hr").appendElement("br");
|
|
|
|
|
|
|
|
|
|
|
|
section.prependChild(header);
|
|
|
|
section.prependChild(header);
|
|
|
|
|
|
|
|
|
|
|
|
boolean hasAttachments = false;
|
|
|
|
boolean hasAttachments = false;
|
|
|
|
Element footer = document.createElement("p");
|
|
|
|
Element footer = document.createElement("p");
|
|
|
|
footer.appendElement("br").appendElement("hr");
|
|
|
|
footer.appendElement("br").appendElement("hr");
|
|
|
|
for (EntityAttachment attachment : attachments)
|
|
|
|
for (EntityAttachment attachment : attachments)
|
|
|
|
if (attachment.isAttachment()) {
|
|
|
|
if (attachment.isAttachment()) {
|
|
|
|
hasAttachments = true;
|
|
|
|
hasAttachments = true;
|
|
|
|
Element strong = document.createElement("strong");
|
|
|
|
Element strong = document.createElement("strong");
|
|
|
|
strong.text(context.getString(R.string.title_attachment));
|
|
|
|
strong.text(context.getString(R.string.title_attachment));
|
|
|
|
footer.appendChild(strong);
|
|
|
|
footer.appendChild(strong);
|
|
|
|
if (!TextUtils.isEmpty(attachment.name))
|
|
|
|
if (!TextUtils.isEmpty(attachment.name))
|
|
|
|
footer.appendText(" " + attachment.name);
|
|
|
|
footer.appendText(" " + attachment.name);
|
|
|
|
if (attachment.size != null)
|
|
|
|
if (attachment.size != null)
|
|
|
|
footer.appendText(" " + Helper.humanReadableByteCount(attachment.size));
|
|
|
|
footer.appendText(" " + Helper.humanReadableByteCount(attachment.size));
|
|
|
|
footer.appendElement("br");
|
|
|
|
footer.appendElement("br");
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
if (hasAttachments)
|
|
|
|
if (hasAttachments)
|
|
|
|
section.appendChild(footer);
|
|
|
|
section.appendChild(footer);
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
return new String[]{message.subject, document.html()};
|
|
|
|
return new String[]{message.subject, section.html()};
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
@Override
|
|
|
|
@Override
|
|
|
|