public class EmailIntent extends BaseIntent<EmailIntent>
BaseIntent builder implementation providing API for building and starting of intents
targeting a e-mail related applications.
Primary e-mail addresses may be specified via to(String) or to(String...).
Carbon copy addresses may be specified via cc(String) or cc(String...).
If blind carbon copy addresses are also desired, these may be specified via bcc(String)
or bcc(String...).
| Modifier and Type | Field and Description |
|---|---|
static Matcher |
EMAIL_MATCHER
Matcher for valid e-mail address.
|
static String |
URI_SCHEME
Uri scheme for e-mail targeting intents.
|
| Constructor and Description |
|---|
EmailIntent() |
| Modifier and Type | Method and Description |
|---|---|
List<String> |
addresses()
Returns the list with valid primary e-mail addresses.
|
EmailIntent |
bcc(List<String> addresses)
Appends the given set of addresses to the current blind carbon copy e-mail
addresses.
|
EmailIntent |
bcc(String... addresses)
Same as
bcc(List) for variable array of addresses. |
EmailIntent |
bcc(String address)
Appends the given address to the current blind carbon copy e-mail addresses.
|
List<String> |
bccAddresses()
Returns the list with valid blind carbon copy e-mail addresses.
|
EmailIntent |
cc(List<String> addresses)
Appends the given set of addresses to the current carbon copy e-mail addresses.
|
EmailIntent |
cc(String... addresses)
Same as
cc(List) for variable array of addresses. |
EmailIntent |
cc(String address)
Appends the given address to the current carbon copy e-mail addresses.
|
List<String> |
ccAddresses()
Returns the list with valid carbon copy e-mail addresses.
|
static Uri |
createUri(List<String> addresses)
Creates an Uri specific for the
Intent.ACTION_SENDTO intent action from the given set
of e-mail addresses. |
protected void |
ensureCanBuildOrThrow()
Called to ensure that this builder can build its Intent from its current data.
|
CharSequence |
message()
Returns the message for e-mail to send.
|
EmailIntent |
message(CharSequence message)
Sets a message for e-mail to send.
|
protected Intent |
onBuild(Context context)
Invoked from
BaseIntent.build(Context) after BaseIntent.ensureCanBuildOrThrow() to build intent
specific for this intent builder from the current data. |
protected boolean |
onStartWith(IntentStarter starter,
Intent intent)
Invoked whenever
BaseIntent.startWith(IntentStarter) is called and there is an activity available
that can handle the given intent that has been created via BaseIntent.build(Context). |
CharSequence |
subject()
Returns the subject for e-mail to send.
|
EmailIntent |
subject(CharSequence subject)
Set a subject for e-mail to send.
|
EmailIntent |
to(List<String> addresses)
Appends the given set of addresses to the current primary e-mail addresses
to which to send an e-mail.
|
EmailIntent |
to(String... addresses)
Same as
to(List) for variable array of addresses. |
EmailIntent |
to(String address)
Appends the given address to the current primary e-mail addresses to which
to send an e-mail.
|
activityNotFoundMessage, activityNotFoundMessage, build, cannotBuildIntentException, dialogTitle, dialogTitle, enterTransition, enterTransition, exitTransition, exitTransition, isActivityForIntentAvailable, notifyActivityNotFound, startWith, transitionspublic static final String URI_SCHEME
Constant value: mailto
public static final Matcher EMAIL_MATCHER
Patterns.EMAIL_ADDRESSpublic EmailIntent to(String address)
Note, that only valid e-mail address will be added.
address - The desired e-mail address to add.to(String...),
addresses()public EmailIntent to(String... addresses)
to(List) for variable array of addresses.addresses - The desired array of e-mail addresses to add.public EmailIntent to(List<String> addresses)
Note, that only valid e-mail addresses will be added.
addresses - The desired set of e-mail addresses to add. May be null to clear the
current one.addresses()public List<String> addresses()
Collections.EMPTY_LIST if there were no addresses specified yet.to(String),
to(String...),
to(List)public EmailIntent cc(String address)
Intent.EXTRA_CC for more info.
Note, that only valid e-mail address will be added.
address - The desired e-mail address to add.cc(String...),
ccAddresses()public EmailIntent cc(String... addresses)
cc(List) for variable array of addresses.addresses - The desired array of e-mail addresses to add.public EmailIntent cc(List<String> addresses)
Intent.EXTRA_CC for more info.
Note, that only valid e-mail addresses will be added.
addresses - The desired list of e-mail addresses to add. May be null to clear
the current one.cc(String),
cc(String...),
ccAddresses()public List<String> ccAddresses()
Collections.EMPTY_LIST if there were no addresses specified yet.cc(String),
cc(String...),
cc(List)public EmailIntent bcc(String address)
Intent.EXTRA_BCC for more info.
Note, that only valid e-mail address will be added.
address - The desired e-mail address to add.bcc(String...),
bccAddresses()public EmailIntent bcc(String... addresses)
bcc(List) for variable array of addresses.addresses - The desired array of e-mail addresses to add.public EmailIntent bcc(List<String> addresses)
Intent.EXTRA_CC for more info.
Note, that only valid e-mail addresses will be added.
addresses - The desired list of e-mail addresses to add. May be null to clear
the current one.bcc(String),
bcc(String...),
bccAddresses()public List<String> bccAddresses()
Collections.EMPTY_LIST if there were no addresses specified yet.bcc(String),
bcc(String...),
bcc(List)public EmailIntent subject(CharSequence subject)
Intent.EXTRA_SUBJECT for more info.subject - The desired subject text. May be null to clear the current one.subject()public CharSequence subject()
subject(CharSequence)public EmailIntent message(CharSequence message)
message - The desired message text. May be null to clear the current one.message()public CharSequence message()
message(CharSequence)protected void ensureCanBuildOrThrow()
BaseIntent
If there are some required data missing/not specified, an exception indicating such state
should be thrown. The default exception may be created via BaseIntent.cannotBuildIntentException(String).
ensureCanBuildOrThrow in class BaseIntent<EmailIntent>protected Intent onBuild(Context context)
BaseIntentBaseIntent.build(Context) after BaseIntent.ensureCanBuildOrThrow() to build intent
specific for this intent builder from the current data.onBuild in class BaseIntent<EmailIntent>context - Context obtained from the IntentStarter.public static Uri createUri(List<String> addresses)
Intent.ACTION_SENDTO intent action from the given set
of e-mail addresses.addresses - List with e-mail addresses.null if the given list of
addresses is empty.protected boolean onStartWith(IntentStarter starter, Intent intent)
BaseIntentBaseIntent.startWith(IntentStarter) is called and there is an activity available
that can handle the given intent that has been created via BaseIntent.build(Context).
This implementation always returns true.
onStartWith in class BaseIntent<EmailIntent>starter - The starter with which to start the intent.intent - The intent instance created by this intent builder.True to indicate that the intent has been started, false otherwise.