public class SimpleIntent extends BaseIntent<SimpleIntent>
BaseIntent builder implementation providing API for building and starting of simple intents.
Activity that should be started by an intent can be specified via activityClass(Class).
If you want to specify some intent flag, you can do so via flag(int) or flags(int).
If you want to start activity for some result, you can specify request code via requestCode(int).
| Constructor and Description |
|---|
SimpleIntent() |
| Modifier and Type | Method and Description |
|---|---|
String |
action()
Returns the intent action.
|
SimpleIntent |
action(String action)
Specifies an action that will be used to search for available activities (that can handle
intent with such action) whenever this intent is started.
|
Class<? extends android.app.Activity> |
activityClass()
Returns the class of activity that will be launched.
|
SimpleIntent |
activityClass(Class<? extends android.app.Activity> activityClass)
Specifies class of an activity to be launched when this intent is started.
|
protected void |
ensureCanBuildOrThrow()
Called to ensure that this builder can build its Intent from its current data.
|
SimpleIntent |
flag(int flag)
Appends the specified flag to the current intent flags.
|
int |
flags()
Returns the intent flags.
|
SimpleIntent |
flags(int flags)
Sets flags for the intent to be started.
|
protected android.content.Intent |
onBuild(android.content.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,
android.content.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). |
int |
requestCode()
Returns the request code used to start this intent for result.
|
SimpleIntent |
requestCode(int requestCode)
Sets a request code for the intent to be started.
|
activityNotFoundMessage, activityNotFoundMessage, build, cannotBuildIntentException, dialogTitle, dialogTitle, enterTransition, enterTransition, exitTransition, exitTransition, isActivityForIntentAvailable, notifyActivityNotFound, startWith, transitionspublic SimpleIntent activityClass(Class<? extends android.app.Activity> activityClass)
Intent.Intent(android.content.Context, Class) for more info.activityClass - Class of the desired activity that should be launched. May be null
to clear the current one.activityClass()public Class<? extends android.app.Activity> activityClass()
null if no activity class has been specified yet.activityClass(Class)public SimpleIntent action(String action)
Intent.Intent(String)
for more info.
Default value: ""
action - The desired intent action. See Intent class for available actions.action()public String action()
Intent class for allowed actions.action(String)public SimpleIntent flags(int flags)
Intent.setFlags(int) for more
info.flags - The desired flags for Intent. Use | to set multiple flags, like:
Intent.FLAG_ACTIVITY_CLEAR_TASK | Intent.FLAG_ACTIVITY_NO_HISTORY .flags()public SimpleIntent flag(int flag)
flag - The desired intent flag to append to the current ones.flags(int),
flags()public int flags()
0 if no flags has been specified yet.flags(int)public SimpleIntent requestCode(int requestCode)
Default value: -1
requestCode - The desired request code to start this intent for result. May be negative
number to clear the current one.requestCode()public int requestCode()
requestCode(int)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<SimpleIntent>protected android.content.Intent onBuild(android.content.Context context)
BaseIntentBaseIntent.build(Context) after BaseIntent.ensureCanBuildOrThrow() to build intent
specific for this intent builder from the current data.onBuild in class BaseIntent<SimpleIntent>context - Context obtained from the IntentStarter.protected boolean onStartWith(IntentStarter starter, android.content.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<SimpleIntent>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.