excilys/androidannotations — pull request #928 by dodgex (2014-03-02 11:50:57+00:00)
Title: add @AfterExtras

this PR adds an @AfterExtras annotation, that works similar to @AfterInject, but the methods are called every time a new intent is set to the activty by setIntent(Intent intent).

this allows an activity to get notified about new intents and so new extras.

the generated code looks like this
```
private void injectExtras_() {
Bundle extras_ = getIntent().getExtras();
if (extras_!= null) {
if (extras_.containsKey(OPEN_ALARMCLOCK_EXTRA)) {
openAlarmclock = extras_.getBoolean(OPEN_ALARMCLOCK_EXTRA);
}
myAfterExtraMethod();
}
}
```
for multiple extras and/or methods, first all extras get injected and then the methods get called.

to be useful this currently needs this code block in the activity
```
@Override
protected void onNewIntent(Intent intent) {
super.onNewIntent(intent);
setIntent(intent);
}
```

currently known "issues", the first call to an @AfterExtras annotated method does not yet have `@Bean` fields set. this would require to move the `ExtraHandler` below the `BeanHandler` in `AnnotationHandlers`. i don't think that this would cause any issues. but i'll open a seperate PR for this change.