1
0
mirror of https://github.com/moparisthebest/k-9 synced 2024-12-25 09:08:49 -05:00

Extract text to display before viewing the message

This commit is contained in:
cketti 2015-01-12 21:40:23 +01:00
parent 2532362ed5
commit bcd64017e3
3 changed files with 7 additions and 3 deletions

View File

@ -25,7 +25,7 @@ import static com.fsck.k9.mail.internet.Viewable.MessageHeader;
import static com.fsck.k9.mail.internet.Viewable.Text;
import static com.fsck.k9.mail.internet.Viewable.Textual;
class LocalMessageExtractor {
public class LocalMessageExtractor {
private static final String TEXT_DIVIDER =
"------------------------------------------------------------------------";
private static final int TEXT_DIVIDER_LENGTH = TEXT_DIVIDER.length();

View File

@ -10,7 +10,7 @@ import java.util.List;
*
* @see LocalMessageExtractor#extractTextAndAttachments(android.content.Context, com.fsck.k9.mail.Message)
*/
class ViewableContainer {
public class ViewableContainer {
/**
* The viewable text of the message in plain text.
*/

View File

@ -58,6 +58,8 @@ import com.fsck.k9.mail.Part;
import com.fsck.k9.mail.internet.MimeUtility;
import com.fsck.k9.mailstore.LocalAttachmentBodyPart;
import com.fsck.k9.mailstore.LocalMessage;
import com.fsck.k9.mailstore.LocalMessageExtractor;
import com.fsck.k9.mailstore.ViewableContainer;
import com.fsck.k9.provider.AttachmentProvider.AttachmentProviderColumns;
import org.apache.commons.io.IOUtils;
@ -512,7 +514,9 @@ public class SingleMessageView extends LinearLayout implements OnClickListener,
}
if (text == null) {
text = message.getTextForDisplay();
//FIXME: Run the text extraction in a background thread because it might involve disk I/O
ViewableContainer viewables = LocalMessageExtractor.extractTextAndAttachments(getContext(), message);
text = viewables.html;
}
// Save the text so we can reset the WebView when the user clicks the "Show pictures" button