mirror of
https://github.com/moparisthebest/k-9
synced 2024-11-04 16:45:09 -05:00
Extract text to display before viewing the message
This commit is contained in:
parent
2532362ed5
commit
bcd64017e3
@ -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();
|
||||
|
@ -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.
|
||||
*/
|
||||
|
@ -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
|
||||
|
Loading…
Reference in New Issue
Block a user