You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
This repository was archived by the owner on Feb 26, 2023. It is now read-only.
don't pass any extra to open activity for new entity creation.
So I've had method:
@AfterExtras
protected void setupEntity() {
if (id != null) {
entity = loadEntityById(id);
} else { // create new entity with default data
entity = new Entity();
// some more initialization of entity
}
}
But code generated by AA is:
private void injectExtras_() {
Bundle extras_ = getIntent().getExtras();
if (extras_!= null) {
if (extras_.containsKey(ID_EXTRA)) {
id = ((Long) extras_.getSerializable(ID_EXTRA));
}
setupEntity();
}
}
So my setupEntity() method is not called if in result I'm unable to check if this single extra was passed or not in AA style and perform actions based on this. So I have two propositions:
[EASY?] change generated code to:
private void injectExtras_() {
Bundle extras_ = getIntent().getExtras();
if (extras_!= null) {
if (extras_.containsKey(ID_EXTRA)) {
id = ((Long) extras_.getSerializable(ID_EXTRA));
}
}
setupEntity();
}
[HARD] add required extras to intent builder,
tell me what is better way to handle this without boilerplate code, AA style?