1
0
mirror of https://github.com/moparisthebest/k-9 synced 2024-11-30 05:02:26 -05:00

SingleMessageView cleanup

This commit is contained in:
cketti 2012-04-04 10:04:57 +02:00
parent 8f1b42bf22
commit 5041a2c832
6 changed files with 18 additions and 60 deletions

View File

@ -1,11 +0,0 @@
<html>
<body bgcolor="white">
<table width="100%" height="100%">
<tr>
<td align="center" valign="middle">
<font color="gray">No text</font>
</td>
</tr>
</table>
</body>
</html>

View File

@ -1,17 +0,0 @@
<html>
<body bgcolor="white">
<table width="100%" height="100%">
<tr>
<td align="center" valign="middle">
<font color="gray">Loading...</font>
<br/>
<br/>
<br/>
<br/>
<br/>
<img src="loading.gif">
</td>
</tr>
</table>
</body>
</html>

View File

@ -1,18 +0,0 @@
<html>
<body>
Lorem ipsum dolor sit amet, consectetuer adipiscing elit. Phasellus dui dui, luctus sit amet, hendrerit ac, blandit quis, diam. Duis libero velit, elementum id, mattis ut, fermentum aliquet, tortor. Maecenas tincidunt egestas pede. Integer sagittis ipsum ut lorem. Morbi egestas egestas sapien. Pellentesque habitant morbi tristique senectus et netus et malesuada fames ac turpis egestas. Duis eget erat ac sem iaculis sollicitudin. Maecenas in velit id mauris cursus tincidunt. Sed ultrices elit in sapien ullamcorper imperdiet. Nunc viverra, lacus id varius elementum, nisl turpis lacinia tellus, sit amet viverra neque odio quis nisl. Quisque facilisis, ipsum non vulputate malesuada, leo augue elementum tortor, nec eleifend tellus lectus non massa.
<br/><br/>
Maecenas pulvinar rutrum risus. Phasellus mattis arcu sit amet neque. Aliquam sed quam at nulla laoreet pretium. Proin elit. Integer ullamcorper dolor a pede. Nam lobortis quam ut mauris. Pellentesque non mauris ut lacus hendrerit iaculis. In volutpat nulla et turpis. Fusce mollis. Aliquam sit amet tortor fermentum orci lacinia convallis. Donec tincidunt tortor sed erat sollicitudin gravida. In hac habitasse platea dictumst. Class aptent taciti sociosqu ad litora torquent per conubia nostra, per inceptos himenaeos. Sed pulvinar arcu consectetuer dolor. Nunc luctus aliquam leo. In hac habitasse platea dictumst. Praesent et mi sit amet ligula blandit hendrerit. Nam aliquam tincidunt est. Aliquam erat volutpat.
<br/><br/>
Curabitur augue. Fusce pulvinar nisi vitae diam. Donec dictum. Sed suscipit convallis magna. Ut hendrerit tortor in mauris. In at diam. Maecenas commodo. Aliquam erat volutpat. Nunc odio eros, vestibulum at, sodales id, congue et, risus. Curabitur feugiat blandit lacus. Nulla gravida placerat enim. Nunc turpis. Praesent malesuada.
<br/><br/>
Aenean quis erat. Vivamus non ipsum. Vestibulum ante ipsum primis in faucibus orci luctus et ultrices posuere cubilia Curae; Sed metus magna, porta eu, ultricies vitae, vulputate et, urna. Sed pulvinar, massa at ultricies rhoncus, nunc eros dapibus felis, quis congue risus orci rhoncus nibh. Pellentesque quam ante, laoreet vitae, iaculis a, gravida in, nibh. In hac habitasse platea dictumst. Aliquam erat volutpat. Suspendisse augue neque, posuere eu, sollicitudin quis, sagittis et, massa. Maecenas varius sem sodales ipsum. Donec congue mi nec orci. Nam pede ipsum, varius sed, condimentum ac, rhoncus non, lorem. Integer vestibulum, neque vitae ornare euismod, mauris turpis congue massa, non venenatis arcu lorem eget metus. Sed sollicitudin, enim aliquam pharetra cursus, neque augue bibendum leo, vitae ullamcorper ante felis nec massa. Maecenas vitae urna. Proin tincidunt, urna eu sodales vulputate, nisl tellus pretium ligula, ut venenatis metus nulla eu lectus. Integer urna purus, sagittis ut, posuere sed, sagittis non, mauris. Nunc eros risus, lacinia sit amet, dictum in, faucibus quis, urna. Fusce dictum mattis enim. Vivamus luctus sagittis felis.
<br/><br/>
Fusce pulvinar, erat a facilisis congue, lacus libero imperdiet dui, nec luctus justo neque sit amet mauris. Praesent sodales. Sed sed nisl a arcu tempus placerat. Duis sagittis risus. Aliquam tristique. Ut a mi. Integer volutpat, turpis vitae lobortis blandit, lorem sapien suscipit arcu, sit amet dignissim felis mauris vitae ipsum. Sed elit. Mauris elementum, pede nec accumsan pretium, leo metus fringilla erat, at feugiat turpis arcu pretium urna. Morbi lorem tellus, commodo sed, convallis id, suscipit sed, leo. Donec egestas ultricies tellus. Curabitur sapien orci, interdum nec, molestie at, pharetra eu, magna. Duis pharetra orci sed felis posuere malesuada. Donec nec nisi non urna ultricies porttitor. Maecenas lectus. Sed dignissim malesuada justo. Nunc rutrum consectetuer nunc.
<img src="cid:23978198273">
more text
<img src="cid:12371982371">
more text
</body>
</html>

View File

@ -300,8 +300,8 @@ Welcome to K-9 Mail setup. K-9 is an open source mail client for Android origin
<string name="message_view_show_more_attachments_action">More&#8230;</string>
<string name="message_view_fetching_attachment_toast">Fetching attachment.</string>
<string name="message_view_no_viewer">Unable to find viewer for <xliff:g id="mimetype">%s</xliff:g>.</string>
<string name="message_view_download_remainder">Download complete message</string>
<string name="message_view_downloading">Downloading…</string>
<!-- NOTE: The following message refers to strings with id 'account_setup_incoming_save_all_headers_label' and 'account_setup_incoming_title' -->
<string name="message_additional_headers_not_downloaded">Not all headers have been downloaded or saved. Select \"Save all headers locally\" in the account\'s incoming server settings to enable this for the future.</string>
@ -1142,6 +1142,8 @@ the import operation. Please install a file manager application from Android Mar
<string name="open_market">Open Market</string>
<string name="close">Close</string>
<string name="webview_empty_message">No text</string>
<string name="webview_contextmenu_link_view_action">Open for viewing</string>
<string name="webview_contextmenu_link_share_action">Share link</string>
<string name="webview_contextmenu_link_copy_action">Copy link to clipboard</string>

View File

@ -980,7 +980,8 @@ public class MessageView extends K9Activity implements OnClickListener {
public void run() {
if (!clonedMessage.isSet(Flag.X_DOWNLOADED_FULL) &&
!clonedMessage.isSet(Flag.X_DOWNLOADED_PARTIAL)) {
mMessageView.loadBodyFromUrl("file:///android_asset/downloading.html");
String text = getString(R.string.message_view_downloading);
mMessageView.showStatusMessage(text);
}
mMessageView.setHeaders(clonedMessage, account);
mMessageView.setOnFlagListener(new OnClickListener() {
@ -1033,7 +1034,7 @@ public class MessageView extends K9Activity implements OnClickListener {
}
if ((MessageView.this.mMessage == null) ||
!MessageView.this.mMessage.isSet(Flag.X_DOWNLOADED_PARTIAL)) {
mMessageView.loadBodyFromUrl("file:///android_asset/empty.html");
mMessageView.showStatusMessage(getString(R.string.webview_empty_message));
}
}
});

View File

@ -524,15 +524,13 @@ public class SingleMessageView extends LinearLayout implements OnClickListener,
resetView();
String type;
String text = pgpData.getDecryptedData();
String text = null;
if (pgpData != null) {
text = pgpData.getDecryptedData();
}
if (text != null) {
/*
* also return here html instead of text/plain. with text/plain the
* webview does not render the CSS on the darktheme to make the text
* white. so the user is not able to see the mailcontent.
*/
type = "text/html";
text = "<html><body><pre>" + text + "</pre></body></html>";
} else {
// getTextForDisplay() always returns HTML-ified content.
text = message.getTextForDisplay();
@ -544,7 +542,7 @@ public class SingleMessageView extends LinearLayout implements OnClickListener,
loadBodyFromText(emailText, contentType);
updateCryptoLayout(account.getCryptoProvider(), pgpData, message);
} else {
loadBodyFromUrl("file:///android_asset/empty.html");
showStatusMessage(getContext().getString(R.string.webview_empty_message));
}
mHasAttachments = message.hasAttachments();
@ -596,10 +594,12 @@ public class SingleMessageView extends LinearLayout implements OnClickListener,
}
}
public void loadBodyFromUrl(String url) {
mMessageContentView.loadUrl(url);
public void showStatusMessage(String status) {
String text = "<html><body><div style=\"text-align:center; color: grey;\">" +
status +
"</div></body></html>";
loadBodyFromText(text, "text/html");
mCryptoView.hide();
}
private void loadBodyFromText(String emailText, String contentType) {
@ -769,6 +769,7 @@ public class SingleMessageView extends LinearLayout implements OnClickListener,
mSavedState = savedState;
}
@Override
public void onLayoutChanged() {
if (mMessageContentView != null) {
mMessageContentView.invalidate();