diff --git a/src/com/fsck/k9/helper/HtmlConverter.java b/src/com/fsck/k9/helper/HtmlConverter.java index e5ab099bd..42382d206 100644 --- a/src/com/fsck/k9/helper/HtmlConverter.java +++ b/src/com/fsck/k9/helper/HtmlConverter.java @@ -317,6 +317,7 @@ public class HtmlConverter { protected static final String QUOTE_COLOR_LEVEL_3 = "#8ae234"; protected static final String QUOTE_COLOR_LEVEL_4 = "#fcaf3e"; protected static final String QUOTE_COLOR_LEVEL_5 = "#e9b96e"; + private static final String K9MAIL_CSS_CLASS = "k9mail"; /** * Return an HTML hex color string for a given quote level. @@ -1230,16 +1231,34 @@ public class HtmlConverter { } private static String htmlifyMessageHeader() { - final String font = K9.messageViewFixedWidthFont() - ? "monospace" - : "sans-serif"; - return "
";
+        return "
";
     }
 
     private static String htmlifyMessageFooter() {
         return "
"; } + /** + * Dynamically generate a CSS style for {@code
} elements.
+     *
+     *  

+ * The style incorporates the user's current preference + * setting for the font family used for plain text messages. + *

+ * + * @return + * A {@code "; + } + /** * Convert a plain text string into an HTML fragment. * @param text Plain text. diff --git a/src/com/fsck/k9/view/MessageWebView.java b/src/com/fsck/k9/view/MessageWebView.java index e673f4134..a70a1c3e1 100644 --- a/src/com/fsck/k9/view/MessageWebView.java +++ b/src/com/fsck/k9/view/MessageWebView.java @@ -11,6 +11,8 @@ import android.webkit.WebSettings; import android.widget.Toast; import com.fsck.k9.K9; import com.fsck.k9.R; +import com.fsck.k9.helper.HtmlConverter; + import java.lang.reflect.Method; import com.nobu_games.android.view.web.TitleBarWebView; @@ -171,6 +173,7 @@ public class MessageWebView extends TitleBarWebView { ":link, :link * { color: #CCFF33 !important }" + ":visited, :visited * { color: #551A8B !important } "; } + content += HtmlConverter.cssStylePre(); content += "" + text + ""; loadDataWithBaseURL("http://", content, "text/html", "utf-8", null); } diff --git a/tests/src/com/fsck/k9/helper/HtmlConverterTest.java b/tests/src/com/fsck/k9/helper/HtmlConverterTest.java index 36deacd06..1b24da791 100644 --- a/tests/src/com/fsck/k9/helper/HtmlConverterTest.java +++ b/tests/src/com/fsck/k9/helper/HtmlConverterTest.java @@ -25,7 +25,7 @@ public class HtmlConverterTest extends TestCase { ">> Guess!"; String result = HtmlConverter.textToHtml(message); writeToFile(result); - assertEquals("
Panama!

Bob Barker <bob@aol.com> wrote:
a canal

Dorothy Jo Gideon <dorothy@aol.com> espoused:
A man, a plan...
Too easy!

Nice job :)
Guess!
", result); + assertEquals("
Panama!

Bob Barker <bob@aol.com> wrote:
a canal

Dorothy Jo Gideon <dorothy@aol.com> espoused:
A man, a plan...
Too easy!

Nice job :)
Guess!
", result); } public void testTextQuoteToHtmlBlockquoteIndented() { @@ -39,7 +39,7 @@ public class HtmlConverterTest extends TestCase { "> :)"; String result = HtmlConverter.textToHtml(message); writeToFile(result); - assertEquals("
*facepalm*

Bob Barker <bob@aol.com> wrote:
A wise man once said...

LOL F1RST!!!!!

:)
", result); + assertEquals("
*facepalm*

Bob Barker <bob@aol.com> wrote:
A wise man once said...

LOL F1RST!!!!!

:)
", result); } public void testQuoteDepthColor() { @@ -62,7 +62,7 @@ public class HtmlConverterTest extends TestCase { ">>>>>> six"; String result = HtmlConverter.textToHtml(message); writeToFile(result); - assertEquals("
zero
one
two
three
four
five
six
", result); + assertEquals("
zero
one
two
three
four
five
six
", result); } private void writeToFile(final String content) { diff --git a/tests/src/com/fsck/k9/mail/internet/ViewablesTest.java b/tests/src/com/fsck/k9/mail/internet/ViewablesTest.java index e0ed3125f..b99340e0c 100644 --- a/tests/src/com/fsck/k9/mail/internet/ViewablesTest.java +++ b/tests/src/com/fsck/k9/mail/internet/ViewablesTest.java @@ -29,8 +29,7 @@ public class ViewablesTest extends AndroidTestCase { String expectedText = bodyText; String expectedHtml = - "
" +
+                "
" +
                 "K-9 Mail rocks :>" +
                 "
"; @@ -87,14 +86,12 @@ public class ViewablesTest extends AndroidTestCase { "------------------------------------------------------------------------\n\n" + bodyText2; String expectedHtml = - "
" +
+                "
" +
                 bodyText1 +
                 "
" + "

" + - "
" +
+                "
" +
                 bodyText2 +
                 "
"; @@ -152,8 +149,7 @@ public class ViewablesTest extends AndroidTestCase { "\n" + innerBodyText; String expectedHtml = - "
" +
+                "
" +
                 bodyText +
                 "
" + "

Subject" + "" + "" + - "

" +
+                "
" +
                 innerBodyText +
                 "
";