This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
$PutModel(user).withProgress("Saving user...") | |
.onFailed().toast("An error occurred"); | |
$PutModel(user).always().code("checkState();") | |
.onDone().toast("User was saved") | |
.onFailed().toast("An error occurred"); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
@Click | |
void sendInformation() { | |
int informationType = getInformationType(); | |
$Toast("The information type index is {informationType}"); | |
} | |
int getInformationType() { | |
String[] types= {"Type 1", "Type 2", "Type 3"} | |
$AlertDialog().items(types).negativeButton("Cancel"); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
@EFragment(R.id.fragment_address) | |
public class AddressFragment extends Fragment { | |
@Model(lazy = true) | |
@Populate | |
@Recollect(validate = true) | |
User user; | |
@AfterViews | |
void loadUser(View userInformation) { |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
@Event | |
void onAuthenticationDone(String userName) { | |
//Do some action after the event is triggered | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
@Model | |
@Populate | |
List<Item> itemsList; | |
void sortAndUpdateItemsList() { | |
//This will run the following code in an Asynchronous (Background) Thread | |
$Background(); | |
Collections.sort(itemsList, |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
@Click | |
void selectAction() { | |
String[] actions = {"Action 1", "Action 2", "Action 3"} | |
$AlertDialog().items(actions) | |
.positiveButton("More Actions") | |
.negativeButton("Cancel"); | |
if ($AlertDialog.ItemSelected) { | |
$Toast("Action selected was {actions[position]}"); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
@EActivity(R.id.activity_main) | |
public class MainActivity extends Activity { | |
@Model | |
User_ user; | |
@Click | |
void showSettings() { | |
$SettingsActivity().userName(user.getName()).withResult(); | |
if ($SettingsActivity.OnResult) { |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
@EActivity(R.id.activity_settings) | |
public class SettingsActivity extends Activity { | |
@Extra | |
String userName; | |
@Click | |
void showProfile() { | |
$ProfileFragment().userName(userName); | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
$ProfileFragment().transaction() | |
.setCustomAnimations( | |
R.anim.move_right_in, | |
R.anim.move_left_out | |
); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
@EActivity(R.id.activity_settings) | |
public class SettingsActivity extends Activity { | |
@Click | |
$ProfileFragment showProfile; | |
@Click | |
$NotificationsFragment showNotifications; | |
... |