diff --git a/src/com/fsck/k9/activity/MessageCompose.java b/src/com/fsck/k9/activity/MessageCompose.java index af92695fa..b2fb4e3f9 100644 --- a/src/com/fsck/k9/activity/MessageCompose.java +++ b/src/com/fsck/k9/activity/MessageCompose.java @@ -3047,7 +3047,7 @@ public class MessageCompose extends K9Activity implements OnClickListener { if (part != null) { if (K9.DEBUG) Log.d(K9.LOG_TAG, "getBodyTextFromMessage: HTML requested, text found."); - return HtmlConverter.textToHtml(MimeUtility.getTextFromPart(part), false); + return HtmlConverter.textToHtml(MimeUtility.getTextFromPart(part)); } } else if (format == SimpleMessageFormat.TEXT) { // Text takes precedence, then html. diff --git a/src/com/fsck/k9/helper/HtmlConverter.java b/src/com/fsck/k9/helper/HtmlConverter.java index 3c6f3c2ed..5478f2e25 100644 --- a/src/com/fsck/k9/helper/HtmlConverter.java +++ b/src/com/fsck/k9/helper/HtmlConverter.java @@ -126,41 +126,27 @@ public class HtmlConverter { private static final int MAX_SMART_HTMLIFY_MESSAGE_LENGTH = 1024 * 256 ; - public static final String getHtmlHeader() { - // Include a meta tag so the MessageWebView will not use a fixed viewport width of 980 px - return ""; - } - - public static final String getHtmlFooter() { - return ""; - } - /** * Naively convert a text string into an HTML document. * *

* This method avoids using regular expressions on the entire message body to save memory. *

+ *

+ * No HTML headers or footers are added to the result. + *

* * @param text * Plain text string. - * @param useHtmlTag - * If {@code true} this method adds headers and footers to create a proper HTML - * document. - * * @return HTML string. */ - private static String simpleTextToHtml(String text, boolean useHtmlTag) { + private static String simpleTextToHtml(String text) { // Encode HTML entities to make sure we don't display something evil. text = TextUtils.htmlEncode(text); StringReader reader = new StringReader(text); StringBuilder buff = new StringBuilder(text.length() + TEXT_TO_HTML_EXTRA_BUFFER_LENGTH); - if (useHtmlTag) { - buff.append(getHtmlHeader()); - } - buff.append(htmlifyMessageHeader()); int c; @@ -185,10 +171,6 @@ public class HtmlConverter { buff.append(htmlifyMessageFooter()); - if (useHtmlTag) { - buff.append(getHtmlFooter()); - } - return buff.toString(); } @@ -202,26 +184,26 @@ public class HtmlConverter { * Convert a text string into an HTML document. * *

- * Attempts to do smart replacement for large documents to prevent OOM errors. This method - * optionally adds headers and footers to create a proper HTML document. To convert to a - * fragment, use {@link #textToHtmlFragment(String)}. + * Attempts to do smart replacement for large documents to prevent OOM + * errors. + *

+ * No HTML headers or footers are added to the result. + *

+ *

+ * To convert to a fragment, use {@link #textToHtmlFragment(String)} . *

* * @param text * Plain text string. - * @param useHtmlTag - * If {@code true} this method adds headers and footers to create a proper HTML - * document. - * * @return HTML string. */ - public static String textToHtml(String text, boolean useHtmlTag) { + public static String textToHtml(String text) { // Our HTMLification code is somewhat memory intensive // and was causing lots of OOM errors on the market // if the message is big and plain text, just do // a trivial htmlification if (text.length() > MAX_SMART_HTMLIFY_MESSAGE_LENGTH) { - return simpleTextToHtml(text, useHtmlTag); + return simpleTextToHtml(text); } StringReader reader = new StringReader(text); StringBuilder buff = new StringBuilder(text.length() + TEXT_TO_HTML_EXTRA_BUFFER_LENGTH); @@ -313,18 +295,10 @@ public class HtmlConverter { StringBuffer sb = new StringBuffer(text.length() + TEXT_TO_HTML_EXTRA_BUFFER_LENGTH); - if (useHtmlTag) { - sb.append(getHtmlHeader()); - } - sb.append(htmlifyMessageHeader()); linkifyText(text, sb); sb.append(htmlifyMessageFooter()); - if (useHtmlTag) { - sb.append(getHtmlFooter()); - } - text = sb.toString(); // Above we replaced > with , now make it > diff --git a/src/com/fsck/k9/mail/internet/MimeUtility.java b/src/com/fsck/k9/mail/internet/MimeUtility.java index 4fea487be..efece2af5 100644 --- a/src/com/fsck/k9/mail/internet/MimeUtility.java +++ b/src/com/fsck/k9/mail/internet/MimeUtility.java @@ -1920,7 +1920,7 @@ public class MimeUtility { * Use the contents of a {@link Viewable} to create the HTML to be displayed. * *

- * This will use {@link HtmlConverter#textToHtml(String, boolean)} to convert plain text parts + * This will use {@link HtmlConverter#textToHtml(String)} to convert plain text parts * to HTML if necessary. *

* @@ -1943,7 +1943,7 @@ public class MimeUtility { if (t == null) { t = ""; } else if (viewable instanceof Text) { - t = HtmlConverter.textToHtml(t, false); + t = HtmlConverter.textToHtml(t); } html.append(t); } else if (viewable instanceof Alternative) { @@ -3352,7 +3352,7 @@ public class MimeUtility { String bodyText = getTextFromPart(part); if (bodyText != null) { text = fixDraftTextBody(bodyText); - html = HtmlConverter.textToHtml(text, false); + html = HtmlConverter.textToHtml(text); } } else if (part.isMimeType("multipart/alternative") && firstBody instanceof MimeMultipart) { diff --git a/src/com/fsck/k9/view/SingleMessageView.java b/src/com/fsck/k9/view/SingleMessageView.java index ae0534f10..40b6ba68c 100644 --- a/src/com/fsck/k9/view/SingleMessageView.java +++ b/src/com/fsck/k9/view/SingleMessageView.java @@ -551,7 +551,7 @@ public class SingleMessageView extends LinearLayout implements OnClickListener, if (pgpData != null) { text = pgpData.getDecryptedData(); if (text != null) { - text = HtmlConverter.textToHtml(text, false); + text = HtmlConverter.textToHtml(text); } }