Skip to content
This repository has been archived by the owner on May 4, 2022. It is now read-only.

About Flow Control (Obsolete)

Adrián Rivero edited this page Mar 10, 2017 · 3 revisions

Action Parameters

Action parameters are passed directly in a string. When an action accepts more than one parameter, this can be provided in the same string separating each parameter by "->", or starting next parameter with "$".

This code reloads users field with a new orderBy and query parameter. See Models.

@Model
@Populator(R.id.item_user)
List<User> users;

@Action("orderBy=age -> query = age > 20 $users")
GetModel btnAction;

Executing java code

You can execute java code in the action, this permits that you call any existing method or perform any action prior or after the action execution. If you want that the code be executed before the action, you should write: ";"+code+";". For the code to be executed after the action simply end the line with ";"

This code will run doSomethingBefore() method, then it'll start MainActivity and it will run finish() method. See Enhanced Activities

@Action(";doSomethingBefore(); -> finish();")
MainActivity btnAction;

void doSomethingBefore() {

}

Conditionals

To execute the action under certain condition, you should end the logical parameter with the symbol "?"

This code will start the activity only if startEnabled is true. See Enhanced Activities.

boolean startEnabled;

@Action("startEnabled? -> finish();")
MainActivity btnAction;

In the conditional can be any valid boolean expression.

Enumerating Actions

Actions can be enumerated, to executed several actions on the same object. For it, it is enough to add a number at the end of the action.

@Action("Opening the Main Activity")
Toast btnAction1;

@Action("startEnabled? -> finish();")
MainActivity btnAction2;

See also

  • [Action Types (Obsolete)](Action Types (Obsolete))
  • [Available Actions (Obsolete)](Avaiblable Actions (Obsolete))
  • [Action Sequences (Obsolete)](Action Sequences (Obsolete))