From ae12453a57dd7754fc59347f350f0382304a4438 Mon Sep 17 00:00:00 2001 From: cketti Date: Fri, 12 Feb 2010 15:21:10 +0000 Subject: [PATCH] Implement support for android.intent.action.SEND_MULTIPLE (e.g. send multiple images from gallery) Fixes issue 1210 --- AndroidManifest.xml | 5 ++++ src/com/fsck/k9/activity/MessageCompose.java | 31 ++++++++++++++++---- 2 files changed, 31 insertions(+), 5 deletions(-) diff --git a/AndroidManifest.xml b/AndroidManifest.xml index acd7844ac..9a42a1bce 100644 --- a/AndroidManifest.xml +++ b/AndroidManifest.xml @@ -195,6 +195,11 @@ + + + + + diff --git a/src/com/fsck/k9/activity/MessageCompose.java b/src/com/fsck/k9/activity/MessageCompose.java index 97a33259a..02f75ed06 100644 --- a/src/com/fsck/k9/activity/MessageCompose.java +++ b/src/com/fsck/k9/activity/MessageCompose.java @@ -390,7 +390,7 @@ public class MessageCompose extends K9Activity implements OnClickListener, OnFoc } } } - else if (Intent.ACTION_SEND.equals(action)) + else if (Intent.ACTION_SEND.equals(action) || Intent.ACTION_SEND_MULTIPLE.equals(action)) { /* * Someone is trying to compose an email with an attachment, probably Pictures. @@ -409,12 +409,33 @@ public class MessageCompose extends K9Activity implements OnClickListener, OnFoc } String type = intent.getType(); - Uri stream = (Uri) intent.getParcelableExtra(Intent.EXTRA_STREAM); - if (stream != null && type != null) + if (Intent.ACTION_SEND_MULTIPLE.equals(action)) { - if (MimeUtility.mimeTypeMatches(type, K9.ACCEPTABLE_ATTACHMENT_SEND_TYPES)) + ArrayList list = intent.getParcelableArrayListExtra(Intent.EXTRA_STREAM); + if (list != null) { - addAttachment(stream); + for (Parcelable parcelable : list) + { + Uri stream = (Uri) parcelable; + if (stream != null && type != null) + { + if (MimeUtility.mimeTypeMatches(type, K9.ACCEPTABLE_ATTACHMENT_SEND_TYPES)) + { + addAttachment(stream); + } + } + } + } + } + else + { + Uri stream = (Uri) intent.getParcelableExtra(Intent.EXTRA_STREAM); + if (stream != null && type != null) + { + if (MimeUtility.mimeTypeMatches(type, K9.ACCEPTABLE_ATTACHMENT_SEND_TYPES)) + { + addAttachment(stream); + } } }