mirror of
https://github.com/moparisthebest/k-9
synced 2024-12-17 21:32:26 -05:00
Change when <html> tags are applied to messages.
Previously, <html>, <head>, & <body> tags were attached to messages before they were stored locally. But now that the <head> element also needs to include a <meta> element (for proper MessageWebView display), it seems unecesary to store all these tags with each message. Now the tags are no longer stored with the messages. Instead, MessageWebView applies the tags before displaying the message. This also eliminates the need to upgrade an older message database where all the old messages would have otherwise needed to be wrapped with the new tags.
This commit is contained in:
parent
731022339d
commit
e2c5229e85
@ -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), true);
|
||||
return HtmlConverter.textToHtml(MimeUtility.getTextFromPart(part), false);
|
||||
}
|
||||
} else if (format == SimpleMessageFormat.TEXT) {
|
||||
// Text takes precedence, then html.
|
||||
|
@ -1376,7 +1376,6 @@ public class MimeUtility {
|
||||
|
||||
StringBuilder text = new StringBuilder();
|
||||
StringBuilder html = new StringBuilder();
|
||||
html.append(HtmlConverter.getHtmlHeader());
|
||||
|
||||
for (Viewable viewable : viewables) {
|
||||
if (viewable instanceof Textual) {
|
||||
@ -1428,8 +1427,6 @@ public class MimeUtility {
|
||||
}
|
||||
}
|
||||
|
||||
html.append(HtmlConverter.getHtmlFooter());
|
||||
|
||||
return new ViewableContainer(text.toString(), html.toString(), attachments);
|
||||
} catch (Exception e) {
|
||||
throw new MessagingException("Couldn't extract viewable parts", e);
|
||||
|
@ -152,15 +152,14 @@ public class MessageWebView extends TitleBarWebView {
|
||||
}
|
||||
|
||||
public void setText(String text, String contentType) {
|
||||
String content = text;
|
||||
String content = "<html><head><meta name=\"viewport\" content=\"width=device-width\"/>";
|
||||
if (K9.getK9MessageViewTheme() == K9.Theme.DARK) {
|
||||
// It's a little wrong to just throw in the <style> before the opening <html>
|
||||
// but it's less wrong than trying to edit the html stream
|
||||
content = "<style>* { background: black ! important; color: white !important }" +
|
||||
content += "<style type=\"text/css\">" +
|
||||
"* { background: black ! important; color: white !important }" +
|
||||
":link, :link * { color: #CCFF33 !important }" +
|
||||
":visited, :visited * { color: #551A8B !important }</style> "
|
||||
+ content;
|
||||
":visited, :visited * { color: #551A8B !important }</style> ";
|
||||
}
|
||||
content += "</head><body>" + text + "</body></html>";
|
||||
loadDataWithBaseURL("http://", content, contentType, "utf-8", null);
|
||||
}
|
||||
|
||||
|
@ -551,7 +551,7 @@ public class SingleMessageView extends LinearLayout implements OnClickListener,
|
||||
if (pgpData != null) {
|
||||
text = pgpData.getDecryptedData();
|
||||
if (text != null) {
|
||||
text = HtmlConverter.textToHtml(text, true);
|
||||
text = HtmlConverter.textToHtml(text, false);
|
||||
}
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user