1
0
mirror of https://github.com/moparisthebest/k-9 synced 2024-11-24 10:22:15 -05:00

Try calculating content preview from HTML part if text part is unsuccessful on appendMessages.

This commit is contained in:
Andrew Chen 2010-12-13 00:33:00 +00:00
parent 749072c4e7
commit b0e4d9cdff

View File

@ -2951,6 +2951,11 @@ public class LocalStore extends Store implements Serializable, LocalStoreMigrati
String text = sbText.toString(); String text = sbText.toString();
String html = markupContent(text, sbHtml.toString()); String html = markupContent(text, sbHtml.toString());
String preview = calculateContentPreview(text); String preview = calculateContentPreview(text);
// If we couldn't generate a reasonable preview from the text part, try doing it with the HTML part.
if (preview == null || preview.length() == 0)
{
preview = calculateContentPreview(Html.fromHtml(html).toString());
}
try try
{ {
@ -3074,6 +3079,7 @@ public class LocalStore extends Store implements Serializable, LocalStoreMigrati
String text = sbText.toString(); String text = sbText.toString();
String html = markupContent(text, sbHtml.toString()); String html = markupContent(text, sbHtml.toString());
String preview = calculateContentPreview(text); String preview = calculateContentPreview(text);
// If we couldn't generate a reasonable preview from the text part, try doing it with the HTML part.
if (preview == null || preview.length() == 0) if (preview == null || preview.length() == 0)
{ {
preview = calculateContentPreview(Html.fromHtml(html).toString()); preview = calculateContentPreview(Html.fromHtml(html).toString());
@ -3204,7 +3210,7 @@ public class LocalStore extends Store implements Serializable, LocalStoreMigrati
/** /**
* @param messageId * @param messageId
* @param attachment * @param attachment
* @param attachmentId -1 to create a new attachment or >= 0 to update an existing * @param saveAsNew
* @throws IOException * @throws IOException
* @throws MessagingException * @throws MessagingException
*/ */