resolved conflicts for merge of a830816f to master

This commit is contained in:
Mihai Preda 2009-06-16 15:51:11 -07:00
commit d250bcd5cd

View File

@ -156,6 +156,7 @@ public class MessageView extends Activity
private static final int MSG_FETCHING_ATTACHMENT = 10; private static final int MSG_FETCHING_ATTACHMENT = 10;
private static final int MSG_SET_SENDER_PRESENCE = 11; private static final int MSG_SET_SENDER_PRESENCE = 11;
private static final int MSG_VIEW_ATTACHMENT_ERROR = 12; private static final int MSG_VIEW_ATTACHMENT_ERROR = 12;
private static final int MSG_UPDATE_ATTACHMENT_ICON = 18;
@Override @Override
public void handleMessage(android.os.Message msg) { public void handleMessage(android.os.Message msg) {
@ -223,6 +224,10 @@ public class MessageView extends Activity
getString(R.string.message_view_display_attachment_toast), getString(R.string.message_view_display_attachment_toast),
Toast.LENGTH_SHORT).show(); Toast.LENGTH_SHORT).show();
break; break;
case MSG_UPDATE_ATTACHMENT_ICON:
((Attachment) mAttachments.getChildAt(msg.arg1).getTag())
.iconView.setImageBitmap((Bitmap) msg.obj);
break;
default: default:
super.handleMessage(msg); super.handleMessage(msg);
} }
@ -300,6 +305,13 @@ public class MessageView extends Activity
public void attachmentViewError() { public void attachmentViewError() {
sendEmptyMessage(MSG_VIEW_ATTACHMENT_ERROR); sendEmptyMessage(MSG_VIEW_ATTACHMENT_ERROR);
} }
public void updateAttachmentIcon(int pos, Bitmap icon) {
android.os.Message msg = android.os.Message.obtain(this, MSG_UPDATE_ATTACHMENT_ICON);
msg.arg1 = pos;
msg.obj = icon;
sendMessage(msg);
}
} }
/** /**
@ -769,6 +781,19 @@ public class MessageView extends Activity
} }
} }
private void updateAttachmentThumbnail(Part part) {
for (int i = 0, count = mAttachments.getChildCount(); i < count; i++) {
Attachment attachment = (Attachment) mAttachments.getChildAt(i).getTag();
if (attachment.part == part) {
Bitmap previewIcon = getPreviewIcon(attachment);
if (previewIcon != null) {
mHandler.updateAttachmentIcon(i, previewIcon);
}
return;
}
}
}
private void renderAttachments(Part part, int depth) throws MessagingException { private void renderAttachments(Part part, int depth) throws MessagingException {
String contentType = MimeUtility.unfoldAndDecode(part.getContentType()); String contentType = MimeUtility.unfoldAndDecode(part.getContentType());
String name = MimeUtility.getHeaderParameter(contentType, "name"); String name = MimeUtility.getHeaderParameter(contentType, "name");
@ -1228,7 +1253,7 @@ public class MessageView extends Activity
} }
}); });
} }
@Override @Override
public void loadAttachmentStarted(EmailContent.Account account, Message message, public void loadAttachmentStarted(EmailContent.Account account, Message message,
Part part, Object tag, boolean requiresDownload) { Part part, Object tag, boolean requiresDownload) {
@ -1245,6 +1270,7 @@ public class MessageView extends Activity
Part part, Object tag) { Part part, Object tag) {
mHandler.setAttachmentsEnabled(true); mHandler.setAttachmentsEnabled(true);
mHandler.progress(false, null); mHandler.progress(false, null);
updateAttachmentThumbnail(part);
Object[] params = (Object[]) tag; Object[] params = (Object[]) tag;
boolean download = (Boolean) params[0]; boolean download = (Boolean) params[0];