From 7a381a08a1b1886b7bd217fda5ef9f7d93437471 Mon Sep 17 00:00:00 2001 From: Colin Edwards Date: Wed, 2 Jan 2013 12:12:24 -0600 Subject: [PATCH 1/2] Call afterSetContentView in onViewCreated --- .../processing/EFragmentProcessor.java | 18 ++++++++++++++++-- 1 file changed, 16 insertions(+), 2 deletions(-) diff --git a/AndroidAnnotations/androidannotations/src/main/java/org/androidannotations/processing/EFragmentProcessor.java b/AndroidAnnotations/androidannotations/src/main/java/org/androidannotations/processing/EFragmentProcessor.java index 6eaf9f3b2d..c94578d519 100644 --- a/AndroidAnnotations/androidannotations/src/main/java/org/androidannotations/processing/EFragmentProcessor.java +++ b/AndroidAnnotations/androidannotations/src/main/java/org/androidannotations/processing/EFragmentProcessor.java @@ -128,11 +128,25 @@ public void process(Element element, JCodeModel codeModel, EBeansHolder eBeansHo .assign(contentView, inflater.invoke("inflate").arg(contentViewId).arg(container).arg(FALSE)); } - body.invoke(holder.afterSetContentView); - body._return(contentView); } + { + // onViewCreated + + JMethod onViewCreated = holder.generatedClass.method(PUBLIC, classes.VIEW, "onViewCreated"); + onViewCreated.annotate(Override.class); + JVar view = onViewCreated.param(classes.VIEW, "view"); + JVar savedInstanceState = onViewCreated.param(classes.BUNDLE, "savedInstanceState"); + + JBlock body = onViewCreated.body(); + + body.invoke(_super(), onViewCreated).arg(view).arg(savedInstanceState); + + body.invoke(holder.afterSetContentView); + } + + { // findViewById From d4808c74922a6685facfdb9528d7a0def6de8a6f Mon Sep 17 00:00:00 2001 From: Colin Edwards Date: Fri, 4 Jan 2013 20:22:58 -0600 Subject: [PATCH 2/2] Use proper return type for Fragment.onViewCreated(...) --- .../androidannotations/processing/EFragmentProcessor.java | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/AndroidAnnotations/androidannotations/src/main/java/org/androidannotations/processing/EFragmentProcessor.java b/AndroidAnnotations/androidannotations/src/main/java/org/androidannotations/processing/EFragmentProcessor.java index c94578d519..4719682fc2 100644 --- a/AndroidAnnotations/androidannotations/src/main/java/org/androidannotations/processing/EFragmentProcessor.java +++ b/AndroidAnnotations/androidannotations/src/main/java/org/androidannotations/processing/EFragmentProcessor.java @@ -134,16 +134,16 @@ public void process(Element element, JCodeModel codeModel, EBeansHolder eBeansHo { // onViewCreated - JMethod onViewCreated = holder.generatedClass.method(PUBLIC, classes.VIEW, "onViewCreated"); + JMethod onViewCreated = holder.generatedClass.method(PUBLIC, codeModel.VOID, "onViewCreated"); onViewCreated.annotate(Override.class); JVar view = onViewCreated.param(classes.VIEW, "view"); JVar savedInstanceState = onViewCreated.param(classes.BUNDLE, "savedInstanceState"); - JBlock body = onViewCreated.body(); + JBlock onViewCreatedBody = onViewCreated.body(); - body.invoke(_super(), onViewCreated).arg(view).arg(savedInstanceState); + onViewCreatedBody.invoke(_super(), onViewCreated).arg(view).arg(savedInstanceState); - body.invoke(holder.afterSetContentView); + onViewCreatedBody.invoke(holder.afterSetContentView); }