Show smart forward attachments in MessageCompose
Bug: 3367188 Change-Id: I59dae9781be59eebe3a68769138e8253a24455e6
This commit is contained in:
parent
d87284f62e
commit
fe9db17831
@ -680,14 +680,6 @@ public class MessageCompose extends Activity implements OnClickListener, OnFocus
|
||||
mLoadAttachmentsTask = new AsyncTask<Long, Void, Attachment[]>() {
|
||||
@Override
|
||||
protected Attachment[] doInBackground(Long... messageIds) {
|
||||
// TODO: When we finally allow the user to change the sending account,
|
||||
// we'll need a test to check whether the sending account is
|
||||
// the message's account
|
||||
boolean smartForward =
|
||||
(account.mFlags & Account.FLAGS_SUPPORTS_SMART_FORWARD) != 0;
|
||||
if (smartForward && !draft) {
|
||||
return null;
|
||||
}
|
||||
return Attachment.restoreAttachmentsWithMessageId(MessageCompose.this,
|
||||
messageIds[0]);
|
||||
}
|
||||
@ -696,8 +688,14 @@ public class MessageCompose extends Activity implements OnClickListener, OnFocus
|
||||
if (attachments == null) {
|
||||
return;
|
||||
}
|
||||
boolean smartForward =
|
||||
(account.mFlags & Account.FLAGS_SUPPORTS_SMART_FORWARD) != 0;
|
||||
|
||||
for (Attachment attachment : attachments) {
|
||||
addAttachment(attachment, true);
|
||||
if (smartForward && !draft) {
|
||||
attachment.mFlags |= Attachment.FLAG_SMART_FORWARD;
|
||||
}
|
||||
addAttachment(attachment, !smartForward);
|
||||
}
|
||||
}
|
||||
}.execute(message.mId);
|
||||
@ -931,7 +929,9 @@ public class MessageCompose extends Activity implements OnClickListener, OnFocus
|
||||
// For any unloaded attachment, set the flag saying we need it loaded
|
||||
boolean hasUnloadedAttachments = false;
|
||||
for (Attachment attachment : attachments) {
|
||||
if (attachment.mContentUri == null) {
|
||||
|
||||
if (attachment.mContentUri == null &&
|
||||
((attachment.mFlags & Attachment.FLAG_SMART_FORWARD) != 0)) {
|
||||
attachment.mFlags |= Attachment.FLAG_DOWNLOAD_FORWARD;
|
||||
hasUnloadedAttachments = true;
|
||||
if (Email.DEBUG){
|
||||
@ -939,6 +939,8 @@ public class MessageCompose extends Activity implements OnClickListener, OnFocus
|
||||
"Requesting download of attachment #" + attachment.mId);
|
||||
}
|
||||
}
|
||||
// Make sure the UI version of the attachment has the now-correct id; we will
|
||||
// use the id again when coming back from picking new attachments
|
||||
if (!attachment.isSaved()) {
|
||||
// this attachment is new so save it to DB.
|
||||
attachment.mMessageKey = mDraft.mId;
|
||||
@ -949,6 +951,7 @@ public class MessageCompose extends Activity implements OnClickListener, OnFocus
|
||||
// the attachments will be independent of the original message in the
|
||||
// database; however, we still need the message on the server in order
|
||||
// to retrieve unloaded attachments
|
||||
attachment.mMessageKey = mDraft.mId;
|
||||
ContentValues cv = attachment.toContentValues();
|
||||
cv.put(Attachment.FLAGS, attachment.mFlags);
|
||||
cv.put(Attachment.MESSAGE_KEY, mDraft.mId);
|
||||
|
@ -59,6 +59,9 @@ public class Rfc822Output {
|
||||
private static final SimpleDateFormat DATE_FORMAT =
|
||||
new SimpleDateFormat("EEE, dd MMM yyyy HH:mm:ss Z", Locale.US);
|
||||
|
||||
private static final String WHERE_NOT_SMART_FORWARD = "(" + Attachment.FLAGS + "&" +
|
||||
Attachment.FLAG_SMART_FORWARD + ")=0";
|
||||
|
||||
/*package*/ static String buildBodyText(Context context, Message message,
|
||||
boolean appendQuotedText) {
|
||||
Body body = Body.restoreBodyWithMessageId(context, message.mId);
|
||||
@ -151,7 +154,7 @@ public class Rfc822Output {
|
||||
|
||||
Uri uri = ContentUris.withAppendedId(Attachment.MESSAGE_ID_URI, messageId);
|
||||
Cursor attachmentsCursor = context.getContentResolver().query(uri,
|
||||
Attachment.CONTENT_PROJECTION, null, null, null);
|
||||
Attachment.CONTENT_PROJECTION, WHERE_NOT_SMART_FORWARD, null, null);
|
||||
|
||||
try {
|
||||
int attachmentCount = attachmentsCursor.getCount();
|
||||
|
@ -1976,7 +1976,9 @@ public abstract class EmailContent {
|
||||
public static final int FLAG_DOWNLOAD_FORWARD = 1<<2;
|
||||
// Indicates that the attachment download failed in a non-recoverable manner
|
||||
public static final int FLAG_DOWNLOAD_FAILED = 1<<3;
|
||||
|
||||
// Allow "room" for some additional download-related flags here
|
||||
// Indicates that the attachment will be smart-forwarded
|
||||
public static final int FLAG_SMART_FORWARD = 1<<8;
|
||||
/**
|
||||
* no public constructor since this is a utility class
|
||||
*/
|
||||
|
Loading…
Reference in New Issue
Block a user