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

Added work-around for image loading bug in Android 4.0's WebView

Fixes issue 3997
This commit is contained in:
cketti 2012-07-16 02:08:22 +02:00
parent b72fcd9d4b
commit 5467a71cbf

View File

@ -104,6 +104,7 @@ public class SingleMessageView extends LinearLayout implements OnClickListener,
private LinearLayout mInsideAttachmentsContainer;
private SavedState mSavedState;
private ClipboardManager mClipboardManager;
private String mText;
public void initialize(Activity activity) {
@ -400,7 +401,10 @@ public class SingleMessageView extends LinearLayout implements OnClickListener,
break;
}
case R.id.show_pictures: {
// Allow network access first...
setLoadPictures(true);
// ...then re-populate the WebView with the message text
loadBodyFromText(mText, "text/html");
break;
}
}
@ -538,28 +542,20 @@ public class SingleMessageView extends LinearLayout implements OnClickListener,
MessagingController controller, MessagingListener listener) throws MessagingException {
resetView();
String type;
String text = null;
if (pgpData != null) {
text = pgpData.getDecryptedData();
}
if (text != null) {
type = "text/html";
text = "<html><body><pre>" + text + "</pre></body></html>";
} else {
// getTextForDisplay() always returns HTML-ified content.
text = message.getTextForDisplay();
type = "text/html";
}
if (text != null) {
final String emailText = text;
final String contentType = type;
loadBodyFromText(emailText, contentType);
updateCryptoLayout(account.getCryptoProvider(), pgpData, message);
} else {
showStatusMessage(getContext().getString(R.string.webview_empty_message));
}
// Save the text so we can reset the WebView when the user clicks the "Show pictures" button
mText = text;
mHasAttachments = message.hasAttachments();
if (mHasAttachments) {
@ -607,6 +603,13 @@ public class SingleMessageView extends LinearLayout implements OnClickListener,
}
}
}
if (text != null) {
loadBodyFromText(text, "text/html");
updateCryptoLayout(account.getCryptoProvider(), pgpData, message);
} else {
showStatusMessage(getContext().getString(R.string.webview_empty_message));
}
}
public void showStatusMessage(String status) {