mirror of
https://github.com/zxing/zxing.git
synced 2024-11-10 13:04:05 -08:00
Set EXTRA_EMAIL in order to make email clients fill in email address
git-svn-id: https://zxing.googlecode.com/svn/trunk@1257 59b500cc-1b3d-0410-9834-0bbf25fbcc57
This commit is contained in:
parent
48a74e2b14
commit
9aef445f0e
|
@ -52,7 +52,7 @@ public final class EmailAddressResultHandler extends ResultHandler {
|
|||
EmailAddressParsedResult emailResult = (EmailAddressParsedResult) getResult();
|
||||
switch (index) {
|
||||
case 0:
|
||||
sendEmailFromUri(emailResult.getMailtoURI(), null, null);
|
||||
sendEmailFromUri(emailResult.getMailtoURI(), emailResult.getEmailAddress(), null, null);
|
||||
break;
|
||||
case 1:
|
||||
String[] addresses = new String[1];
|
||||
|
|
|
@ -206,16 +206,19 @@ public abstract class ResultHandler {
|
|||
}
|
||||
|
||||
final void shareByEmail(String contents) {
|
||||
sendEmailFromUri("mailto:", activity.getString(R.string.msg_share_subject_line), contents);
|
||||
sendEmailFromUri("mailto:", null, activity.getString(R.string.msg_share_subject_line), contents);
|
||||
}
|
||||
|
||||
final void sendEmail(String address, String subject, String body) {
|
||||
sendEmailFromUri("mailto:" + address, subject, body);
|
||||
sendEmailFromUri("mailto:" + address, address, subject, body);
|
||||
}
|
||||
|
||||
// Use public Intent fields rather than private GMail app fields to specify subject and body.
|
||||
final void sendEmailFromUri(String uri, String subject, String body) {
|
||||
final void sendEmailFromUri(String uri, String email, String subject, String body) {
|
||||
Intent intent = new Intent(Intent.ACTION_SEND, Uri.parse(uri));
|
||||
if (email != null) {
|
||||
intent.putExtra(Intent.EXTRA_EMAIL, new String[] {email});
|
||||
}
|
||||
putExtra(intent, Intent.EXTRA_SUBJECT, subject);
|
||||
putExtra(intent, Intent.EXTRA_TEXT, body);
|
||||
intent.setType("text/plain");
|
||||
|
|
Loading…
Reference in a new issue