@@ -64,6 +64,7 @@ public class EActivityHolder extends EComponentWithViewSupportHolder implements
6464 private ActivityIntentBuilder intentBuilder ;
6565 private JMethod onCreate ;
6666 private JMethod setIntent ;
67+ private JMethod onNewIntentMethod ;
6768 private JMethod setContentViewLayout ;
6869 private JVar initSavedInstanceParam ;
6970 private JDefinedClass intentBuilderClass ;
@@ -180,11 +181,12 @@ protected void setOnPause() {
180181 }
181182
182183 protected void setOnNewIntent () {
183- JMethod method = generatedClass .method (JMod .PUBLIC , codeModel ().VOID , "onNewIntent" );
184- method .annotate (Override .class );
185- JVar intent = method .param (classes ().INTENT , "intent" );
186- JBlock body = method .body ();
187- body .invoke (_super (), method ).arg (intent );
184+ onNewIntentMethod = generatedClass .method (JMod .PUBLIC , codeModel ().VOID , "onNewIntent" );
185+ onNewIntentMethod .annotate (Override .class );
186+ JVar intent = onNewIntentMethod .param (classes ().INTENT , "intent" );
187+ JBlock body = onNewIntentMethod .body ();
188+ body .invoke (_super (), onNewIntentMethod ).arg (intent );
189+ body .invoke (getSetIntent ()).arg (intent );
188190 getRoboGuiceHolder ().onNewIntentAfterSuperBlock = body .block ();
189191 }
190192
@@ -368,15 +370,15 @@ private void handleBackPressed() {
368370
369371 onKeyDownBody ._if ( //
370372 sdkInt .lt (JExpr .lit (5 )) //
371- .cand (keyCodeParam .eq (keyEventClass .staticRef ("KEYCODE_BACK" ))) //
372- .cand (eventParam .invoke ("getRepeatCount" ).eq (JExpr .lit (0 )))) //
373+ .cand (keyCodeParam .eq (keyEventClass .staticRef ("KEYCODE_BACK" ))) //
374+ .cand (eventParam .invoke ("getRepeatCount" ).eq (JExpr .lit (0 )))) //
373375 ._then () //
374376 .invoke ("onBackPressed" );
375377
376378 onKeyDownBody ._return ( //
377379 JExpr ._super ().invoke (onKeyDownMethod ) //
378- .arg (keyCodeParam ) //
379- .arg (eventParam ));
380+ .arg (keyCodeParam ) //
381+ .arg (eventParam ));
380382
381383 }
382384 }
@@ -406,7 +408,7 @@ private boolean isCustomOnBackPressedMethod(ExecutableElement method) {
406408 && method .getModifiers ().contains (Modifier .PUBLIC ) //
407409 && method .getReturnType ().getKind ().equals (TypeKind .VOID ) //
408410 && method .getParameters ().size () == 0 //
409- ;
411+ ;
410412 }
411413
412414 @ Override
@@ -482,6 +484,13 @@ private void setInjectExtras() {
482484 getInitBody ().invoke (injectExtrasMethod );
483485 }
484486
487+ public JMethod getOnNewIntent () {
488+ if (onNewIntentMethod == null ) {
489+ setOnNewIntent ();
490+ }
491+ return onNewIntentMethod ;
492+ }
493+
485494 @ Override
486495 public JBlock getSaveStateMethodBody () {
487496 return instanceStateHolder .getSaveStateMethodBody ();
0 commit comments