Improved extra parts formatting

pull/214/head
M66B 10 months ago
parent 943ad9398f
commit f49ed187f4

@ -3718,6 +3718,7 @@ public class MessageHelper {
parts.addAll(extra); parts.addAll(extra);
boolean first = true;
for (PartHolder h : parts) { for (PartHolder h : parts) {
/* /*
int size = h.part.getSize(); int size = h.part.getSize();
@ -4001,13 +4002,13 @@ public class MessageHelper {
StandardCharsets.US_ASCII.equals(cs) || StandardCharsets.US_ASCII.equals(cs) ||
StandardCharsets.ISO_8859_1.equals(cs)) StandardCharsets.ISO_8859_1.equals(cs))
result = new String(result.getBytes(StandardCharsets.ISO_8859_1), StandardCharsets.UTF_8); result = new String(result.getBytes(StandardCharsets.ISO_8859_1), StandardCharsets.UTF_8);
result = Markdown.toHtml(result); result = (first ? "" : "<br><hr>") + Markdown.toHtml(result);
} catch (Throwable ex) { } catch (Throwable ex) {
Log.e(ex); Log.e(ex);
result = HtmlHelper.formatPlainText(result); result = HtmlHelper.formatPlainText(result);
} }
} else if (h.isPatch() || h.isLog()) { } else if (h.isPatch() || h.isLog()) {
result = "<hr>" + result = (first ? "" : "<br><hr>") +
"<pre style=\"font-family: monospace; font-size:small;\">" + "<pre style=\"font-family: monospace; font-size:small;\">" +
HtmlHelper.formatPlainText(result) + HtmlHelper.formatPlainText(result) +
"</pre>"; "</pre>";
@ -4048,6 +4049,7 @@ public class MessageHelper {
Log.w("Unexpected content type=" + h.contentType); Log.w("Unexpected content type=" + h.contentType);
sb.append(result); sb.append(result);
first = false;
} }
return sb.toString(); return sb.toString();

Loading…
Cancel
Save