Improve display of attachments in pop
b/10714298 This is related to this CL in UnifiedEmail https://googleplex-android-review.git.corp.google.com/#/c/363626/1 Change-Id: Idea2827791ed52e7558b11aaea07b1f3f1764db5
This commit is contained in:
parent
ab4eadaf4d
commit
aad690f699
|
@ -1297,6 +1297,9 @@ public abstract class EmailContent {
|
|||
public static final int FLAG_SMART_FORWARD = 1<<8;
|
||||
// Indicates that the attachment cannot be forwarded due to a policy restriction
|
||||
public static final int FLAG_POLICY_DISALLOWS_DOWNLOAD = 1<<9;
|
||||
// Indicates that this is a dummy placeholder attachment.
|
||||
public static final int FLAG_DUMMY_ATTACHMENT = 1<<10;
|
||||
|
||||
/**
|
||||
* no public constructor since this is a utility class
|
||||
*/
|
||||
|
|
|
@ -2229,6 +2229,7 @@ public class EmailProvider extends ContentProvider {
|
|||
.add(UIProvider.AttachmentColumns.DOWNLOADED_SIZE,
|
||||
AttachmentColumns.UI_DOWNLOADED_SIZE)
|
||||
.add(UIProvider.AttachmentColumns.CONTENT_URI, AttachmentColumns.CONTENT_URI)
|
||||
.add(UIProvider.AttachmentColumns.FLAGS, AttachmentColumns.FLAGS)
|
||||
.build();
|
||||
}
|
||||
return sAttachmentMap;
|
||||
|
@ -2383,6 +2384,7 @@ public class EmailProvider extends ContentProvider {
|
|||
uiAtt.setContentType(att.mMimeType);
|
||||
uiAtt.size = (int) att.mSize;
|
||||
uiAtt.uri = uiUri("uiattachment", att.mId);
|
||||
uiAtt.flags = att.mFlags;
|
||||
uiAtts.add(uiAtt);
|
||||
}
|
||||
values.put(UIProvider.MessageColumns.ATTACHMENTS, "@?"); // @ for literal
|
||||
|
|
|
@ -30,6 +30,7 @@ import com.android.emailcommon.mail.MessagingException;
|
|||
import com.android.emailcommon.mail.Part;
|
||||
import com.android.emailcommon.provider.Account;
|
||||
import com.android.emailcommon.provider.EmailContent;
|
||||
import com.android.emailcommon.provider.EmailContent.Attachment;
|
||||
import com.android.emailcommon.provider.EmailContent.MessageColumns;
|
||||
import com.android.emailcommon.provider.EmailContent.SyncColumns;
|
||||
import com.android.emailcommon.provider.Mailbox;
|
||||
|
@ -139,12 +140,21 @@ public class Utilities {
|
|||
LegacyConversions.updateAttachments(context, localMessage, attachments);
|
||||
} else {
|
||||
EmailContent.Attachment att = new EmailContent.Attachment();
|
||||
// STOPSHIP: Redo UI or localize
|
||||
att.mFileName = "Click to load entire message";
|
||||
// Since we haven't actually loaded the attachment, we're just putting
|
||||
// a dummy placeholder here. When the user taps on it, we'll load the attachment
|
||||
// for real.
|
||||
// TODO: This is not really a great way to model this.... could we at least get
|
||||
// the file names and mime types from the attachments? Then we could display
|
||||
// something sensible at least. This may be impossible in POP, but maybe
|
||||
// we could put a flag on the message indicating that there are undownloaded
|
||||
// attachments, rather than this dummy placeholder, which causes a lot of
|
||||
// special case handling in a lot of places.
|
||||
att.mFileName = "";
|
||||
att.mSize = message.getSize();
|
||||
att.mMimeType = "text/plain";
|
||||
att.mMessageKey = localMessage.mId;
|
||||
att.mAccountKey = localMessage.mAccountKey;
|
||||
att.mFlags = Attachment.FLAG_DUMMY_ATTACHMENT;
|
||||
att.save(context);
|
||||
localMessage.mFlagAttachment = true;
|
||||
}
|
||||
|
|
|
@ -408,7 +408,6 @@ public class EmailServiceUtils {
|
|||
// It would be nice if we could copy or move all of the old account's data over
|
||||
// to the new account here. b/10805685
|
||||
|
||||
|
||||
// Delete the AccountManager account
|
||||
amFuture = AccountManager.get(context)
|
||||
.removeAccount(amAccount, null, null);
|
||||
|
|
Loading…
Reference in New Issue