Automated import from //branches/master/...@142153,142153
This commit is contained in:
parent
75a07d0a22
commit
ce4504b78e
@ -157,6 +157,9 @@
|
||||
<string name="message_compose_error_no_recipients">You must add at least one recipient.</string>
|
||||
<!-- Toast that appears in the context of forwarding a message with attachment(s) -->
|
||||
<string name="message_compose_attachments_skipped_toast">Some attachments cannot be forwarded because they have not downloaded.</string>
|
||||
<!-- Toast that appears when an attachment is too big to send. Note, translation temporarily
|
||||
borrowed from camera app (msgid="6989632611223725558") -->
|
||||
<string name="message_compose_attachment_size" msgid="6989632611223725558">File too large to attach.</string>
|
||||
<!-- Label for To field in read message view -->
|
||||
<string name="message_view_to_label">To:</string>
|
||||
<!-- Label for CC field in read message view -->
|
||||
|
@ -116,6 +116,14 @@ public class Email extends Application {
|
||||
*/
|
||||
public static final int MAX_ATTACHMENT_DOWNLOAD_SIZE = (5 * 1024 * 1024);
|
||||
|
||||
/**
|
||||
* The maximum size of an attachment we're willing to upload (measured as stored on disk).
|
||||
* Attachments that are base64 encoded (most) will be about 1.375x their actual size
|
||||
* so we should probably factor that in. A 5MB attachment will generally be around
|
||||
* 6.8MB uploaded.
|
||||
*/
|
||||
public static final int MAX_ATTACHMENT_UPLOAD_SIZE = (5 * 1024 * 1024);
|
||||
|
||||
/**
|
||||
* Called throughout the application when the number of accounts has changed. This method
|
||||
* enables or disables the Compose activity, the boot receiver and the service based on
|
||||
|
@ -832,6 +832,13 @@ public class MessageCompose extends Activity implements OnClickListener, OnFocus
|
||||
attachment.name = uri.getLastPathSegment();
|
||||
}
|
||||
|
||||
// Before attaching the attachment, make sure it meets any other pre-attach criteria
|
||||
if (attachment.size > Email.MAX_ATTACHMENT_UPLOAD_SIZE) {
|
||||
Toast.makeText(this, R.string.message_compose_attachment_size, Toast.LENGTH_LONG)
|
||||
.show();
|
||||
return;
|
||||
}
|
||||
|
||||
View view = getLayoutInflater().inflate(
|
||||
R.layout.message_compose_attachment,
|
||||
mAttachments,
|
||||
|
Loading…
Reference in New Issue
Block a user