1
0
mirror of https://github.com/moparisthebest/k-9 synced 2024-11-24 02:12:15 -05:00

Implement support for android.intent.action.SEND_MULTIPLE (e.g. send multiple images from gallery)

Fixes issue 1210
This commit is contained in:
cketti 2010-02-12 15:21:10 +00:00
parent 6fe2dad5cc
commit ae12453a57
2 changed files with 31 additions and 5 deletions

View File

@ -195,6 +195,11 @@
<data android:mimeType="*/*" /> <data android:mimeType="*/*" />
<category android:name="android.intent.category.DEFAULT" /> <category android:name="android.intent.category.DEFAULT" />
</intent-filter> </intent-filter>
<intent-filter>
<action android:name="android.intent.action.SEND_MULTIPLE" />
<data android:mimeType="*/*" />
<category android:name="android.intent.category.DEFAULT" />
</intent-filter>
<intent-filter> <intent-filter>
<action android:name="android.intent.action.VIEW" /> <action android:name="android.intent.action.VIEW" />
<data android:scheme="mailto" /> <data android:scheme="mailto" />

View File

@ -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. * Someone is trying to compose an email with an attachment, probably Pictures.
@ -409,6 +409,26 @@ public class MessageCompose extends K9Activity implements OnClickListener, OnFoc
} }
String type = intent.getType(); String type = intent.getType();
if (Intent.ACTION_SEND_MULTIPLE.equals(action))
{
ArrayList<Parcelable> list = intent.getParcelableArrayListExtra(Intent.EXTRA_STREAM);
if (list != null)
{
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); Uri stream = (Uri) intent.getParcelableExtra(Intent.EXTRA_STREAM);
if (stream != null && type != null) if (stream != null && type != null)
{ {
@ -417,6 +437,7 @@ public class MessageCompose extends K9Activity implements OnClickListener, OnFoc
addAttachment(stream); addAttachment(stream);
} }
} }
}
/* /*
* There might be an EXTRA_SUBJECT, EXTRA_TEXT, EXTRA_EMAIL, EXTRA_BCC or EXTRA_CC * There might be an EXTRA_SUBJECT, EXTRA_TEXT, EXTRA_EMAIL, EXTRA_BCC or EXTRA_CC