1
0
mirror of https://github.com/moparisthebest/k-9 synced 2025-02-25 15:11:52 -05:00

Moving a few more things to UI thread as message are not displayed reliably

This commit is contained in:
Bao-Long Nguyen-Trong 2009-10-07 18:19:56 +00:00
parent 791d99fc7a
commit b3616e379d

View File

@ -171,17 +171,27 @@ public class MessageView extends K9Activity
{ onPrevious(); return true; } { onPrevious(); return true; }
case KeyEvent.KEYCODE_N: case KeyEvent.KEYCODE_N:
case KeyEvent.KEYCODE_K: { onNext(); return true; } case KeyEvent.KEYCODE_K: { onNext(); return true; }
case KeyEvent.KEYCODE_Z: { if (event.isShiftPressed()) { case KeyEvent.KEYCODE_Z: {
if (event.isShiftPressed()) {
mHandler.post(new Runnable() {
public void run() {
mMessageContentView.zoomIn(); mMessageContentView.zoomIn();
}
});
} else { } else {
mHandler.post(new Runnable() {
public void run() {
mMessageContentView.zoomOut(); mMessageContentView.zoomOut();
} }
return true; } });
}
return true;
}
case KeyEvent.KEYCODE_H: { case KeyEvent.KEYCODE_H: {
Toast toast = Toast.makeText(this, R.string.message_help_key, Toast.LENGTH_LONG); Toast toast = Toast.makeText(this, R.string.message_help_key, Toast.LENGTH_LONG);
toast.show(); toast.show();
return true; } return true;
}
} }
return super.onKeyDown(keyCode, event); return super.onKeyDown(keyCode, event);
} }
@ -1162,12 +1172,21 @@ public class MessageView extends K9Activity
* TODO this should be smarter, change to regex for img, but consider how to * TODO this should be smarter, change to regex for img, but consider how to
* get background images and a million other things that HTML allows. * get background images and a million other things that HTML allows.
*/ */
mMessageContentView.loadDataWithBaseURL("email://", text, "text/html", "utf-8", null); final String emailText = text;
mHandler.post(new Runnable() {
public void run() {
mMessageContentView.loadDataWithBaseURL("email://", emailText, "text/html", "utf-8", null);
}
});
mHandler.showShowPictures(text.contains("<img")); mHandler.showShowPictures(text.contains("<img"));
} }
else { else {
mHandler.post(new Runnable() {
public void run() {
mMessageContentView.loadUrl("file:///android_asset/empty.html"); mMessageContentView.loadUrl("file:///android_asset/empty.html");
} }
});
}
renderAttachments(mMessage, 0); renderAttachments(mMessage, 0);
} }