-
Notifications
You must be signed in to change notification settings - Fork 25
Available Actions (Obsolete)
All the examples below will use a field named "btnAction", so it is assumed that in the visual interface exists a button with that Id that will fire the actions once the user click it.
Any enhanced activity can be used in an action. The Activity will be automatically opened when the action is fired:
@Action
MainActivity btnAction;
If the activity has any extra argument, it can be provided in the annotation:
@EActivity(R.layout.activity_login)
public class EnhancedActivity extends Activity {
@Extra
int age;
}
@Action("age=25")
EnhancedActivity btnAction;
When starting activities, you can specify Flags (represented by the setFlag()
function in the Activity Intent), and action (represented by the setAction()
function in the Activity Intent)
To provide any of these argument use the "flags" keyword, or "action" keyword. You should separate several parameters by the symbol "$" or "->"
@Action("age=25 $flags=Intent.FLAG_ACTIVITY_CLEAR_TOP")
EnhancedActivity btnAction;
Any enhanced fragment can be used in an action. The Fragment will be automatically shown when the action is fired. It is assumed the current activity contains a Layout to hold the fragment with ID R.id.container
@Action
MainFragment btnAction;
If the fragment has any extra argument, it can be provided in the annotation:
@EFragment(R.layout.activity_login)
public class EnhancedFragment extends Activity {
@FragmentArg
int age;
}
@Action("age=25")
EnhancedFragment btnAction;
Any event can be fired with an action
@Event MyEvent event;
@Action
MyEvent btnAction;
If the event has any extra argument, it can be provided in the annotation:
@Event("message: String") MyEvent event;
@Action("message=\"Hello world!\"")
MyEvent btnAction;
Models can be Loaded and Put with an action. You should provide the field name of the model:
@Model
User user;
@Action("user")
GetModel btnAction;
@Model
User user;
@Action("user")
PutModel btnAction;
@Model
User user;
@Action("user")
GetAndPutModel btnAction;
You can provide also "query" and "orderBy" parameter for the injection process
@Model
List<User> users;
@Action("query = age > 20 -> orderBy = name DESC -> users")
GetModel btnAction;
Important! The "query" and "orderBy" parameters should be provided before the field name.
Toast
Toast can easily be shown by an action:
@Action("Hello World!")
Toast btnAction;
AlertDialog and ProgressDialog
Alert and Progress Dialogs can be easily constructed and displayed by an action:
@Action("message=\"Hello World\"")
AlertDialog btnAction;
@Action("message=\"Saving Data...\"")
ProgressDialog btnAction;
You can assign any Android Component to an existing variable using the symbol "="
Dialog dialog;
@Action("message=\"Hello World\" -> =dialog")
AlertDialog btnAction;
And you can also assign to a "virtual variable" using the symbol ":" in order to be used later in another action
@Action("message=\"Hello World\" -> :dialog")
AlertDialog btnAction;
See also
- [About Flow Control (Obsolete)](About Flow Control (Obsolete))
- [Action Types (Obsolete)](Action Types (Obsolete))
- [Action Sequences (Obsolete)](Action Sequences (Obsolete))
Sponsored by DSpot Sp. z o.o. Contact us at [email protected]