use of com.helger.jcodemodel.JBlock in project androidannotations by androidannotations.
the class EActivityHolder method setInitNonConfigurationInstance.
private void setInitNonConfigurationInstance() throws JClassAlreadyExistsException {
JBlock initBody = getInitBodyInjectionBlock();
JDefinedClass ncHolderClass = getNonConfigurationHolder().getGeneratedClass();
initNonConfigurationInstance = initBody.decl(ncHolderClass, "nonConfigurationInstance", cast(ncHolderClass, _super().invoke(getGetLastNonConfigurationInstance())));
initIfNonConfigurationNotNullBlock = initBody._if(initNonConfigurationInstance.ne(_null()))._then();
}
use of com.helger.jcodemodel.JBlock in project androidannotations by androidannotations.
the class EActivityHolder method setOnCreate.
private void setOnCreate() {
onCreate = generatedClass.method(PUBLIC, getCodeModel().VOID, "onCreate");
onCreate.annotate(Override.class);
AbstractJClass bundleClass = getClasses().BUNDLE;
JVar onCreateSavedInstanceState = onCreate.param(bundleClass, "savedInstanceState");
JBlock onCreateBody = onCreate.body();
JVar previousNotifier = viewNotifierHelper.replacePreviousNotifier(onCreateBody);
onCreateBody.invoke(getInit()).arg(onCreateSavedInstanceState);
onCreateBody.invoke(_super(), onCreate).arg(onCreateSavedInstanceState);
viewNotifierHelper.resetPreviousNotifier(onCreateBody, previousNotifier);
}
use of com.helger.jcodemodel.JBlock in project androidannotations by androidannotations.
the class EActivityHolder method setInjectExtras.
private void setInjectExtras() {
injectExtrasMethod = generatedClass.method(PRIVATE, getCodeModel().VOID, "injectExtras" + generationSuffix());
JBlock injectExtrasBody = injectExtrasMethod.body();
injectExtras = injectExtrasBody.decl(getClasses().BUNDLE, "extras_", invoke("getIntent").invoke("getExtras"));
injectExtrasBlock = injectExtrasBody._if(injectExtras.ne(_null()))._then();
getSetIntent().body().invoke(injectExtrasMethod);
getInitBodyInjectionBlock().invoke(injectExtrasMethod);
}
use of com.helger.jcodemodel.JBlock in project androidannotations by androidannotations.
the class EActivityHolder method setOnOptionsItemSelected.
private void setOnOptionsItemSelected() {
JMethod method = generatedClass.method(JMod.PUBLIC, getCodeModel().BOOLEAN, "onOptionsItemSelected");
method.annotate(Override.class);
JBlock methodBody = method.body();
onOptionsItemSelectedItem = method.param(getClasses().MENU_ITEM, "item");
onOptionsItemSelectedItemId = methodBody.decl(getCodeModel().INT, "itemId_", onOptionsItemSelectedItem.invoke("getItemId"));
onOptionsItemSelectedMiddleBlock = methodBody.blockSimple();
methodBody._return(invoke(_super(), method).arg(onOptionsItemSelectedItem));
}
use of com.helger.jcodemodel.JBlock in project androidannotations by androidannotations.
the class EActivityHolder method setFindNativeFragmentByTag.
@Override
protected void setFindNativeFragmentByTag() {
JMethod method = generatedClass.method(PRIVATE, getClasses().FRAGMENT, "findNativeFragmentByTag");
JVar tagParam = method.param(getClasses().STRING, "tag");
JBlock body = method.body();
body._return(invoke("getFragmentManager").invoke("findFragmentByTag").arg(tagParam));
findNativeFragmentByTag = method;
}
Aggregations