mirror of
https://github.com/moparisthebest/k-9
synced 2024-11-04 08:35:08 -05:00
Added work-around for image loading bug in Android 4.0's WebView
Fixes issue 3997
This commit is contained in:
parent
b72fcd9d4b
commit
5467a71cbf
@ -104,6 +104,7 @@ public class SingleMessageView extends LinearLayout implements OnClickListener,
|
|||||||
private LinearLayout mInsideAttachmentsContainer;
|
private LinearLayout mInsideAttachmentsContainer;
|
||||||
private SavedState mSavedState;
|
private SavedState mSavedState;
|
||||||
private ClipboardManager mClipboardManager;
|
private ClipboardManager mClipboardManager;
|
||||||
|
private String mText;
|
||||||
|
|
||||||
|
|
||||||
public void initialize(Activity activity) {
|
public void initialize(Activity activity) {
|
||||||
@ -400,7 +401,10 @@ public class SingleMessageView extends LinearLayout implements OnClickListener,
|
|||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
case R.id.show_pictures: {
|
case R.id.show_pictures: {
|
||||||
|
// Allow network access first...
|
||||||
setLoadPictures(true);
|
setLoadPictures(true);
|
||||||
|
// ...then re-populate the WebView with the message text
|
||||||
|
loadBodyFromText(mText, "text/html");
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -538,28 +542,20 @@ public class SingleMessageView extends LinearLayout implements OnClickListener,
|
|||||||
MessagingController controller, MessagingListener listener) throws MessagingException {
|
MessagingController controller, MessagingListener listener) throws MessagingException {
|
||||||
resetView();
|
resetView();
|
||||||
|
|
||||||
String type;
|
|
||||||
String text = null;
|
String text = null;
|
||||||
if (pgpData != null) {
|
if (pgpData != null) {
|
||||||
text = pgpData.getDecryptedData();
|
text = pgpData.getDecryptedData();
|
||||||
}
|
}
|
||||||
if (text != null) {
|
if (text != null) {
|
||||||
type = "text/html";
|
|
||||||
text = "<html><body><pre>" + text + "</pre></body></html>";
|
text = "<html><body><pre>" + text + "</pre></body></html>";
|
||||||
} else {
|
} else {
|
||||||
// getTextForDisplay() always returns HTML-ified content.
|
// getTextForDisplay() always returns HTML-ified content.
|
||||||
text = message.getTextForDisplay();
|
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();
|
mHasAttachments = message.hasAttachments();
|
||||||
|
|
||||||
if (mHasAttachments) {
|
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) {
|
public void showStatusMessage(String status) {
|
||||||
|
Loading…
Reference in New Issue
Block a user