use of com.helger.jcodemodel.JBlock in project androidannotations by androidannotations.
the class RoboGuiceHandler method onRestartMethod.
private void onRestartMethod(EActivityHolder holder, JFieldVar eventManager) {
JBlock onRestartAfterSuperBlock = holder.getOnRestartAfterSuperBlock();
fireEvent(eventManager, onRestartAfterSuperBlock, getJClass(RoboGuiceClasses.ON_RESTART_EVENT));
}
use of com.helger.jcodemodel.JBlock in project androidannotations by androidannotations.
the class RoboGuiceHandler method onNewIntentMethod.
private void onNewIntentMethod(EActivityHolder holder, JFieldVar eventManager) {
JBlock onNewIntentAfterSuperBlock = holder.getOnNewIntentAfterSuperBlock();
fireEvent(eventManager, onNewIntentAfterSuperBlock, getJClass(RoboGuiceClasses.ON_NEW_INTENT_EVENT));
}
use of com.helger.jcodemodel.JBlock in project androidannotations by androidannotations.
the class RoboGuiceHandler method onActivityResultMethod.
private void onActivityResultMethod(EActivityHolder holder, JFieldVar eventManager) {
JBlock onActivityResultAfterSuperBlock = holder.getOnActivityResultAfterSuperBlock();
JVar requestCode = holder.getOnActivityResultRequestCodeParam();
JVar resultCode = holder.getOnActivityResultResultCodeParam();
JVar data = holder.getOnActivityResultDataParam();
fireEvent(eventManager, onActivityResultAfterSuperBlock, getJClass(RoboGuiceClasses.ON_ACTIVITY_RESULT_EVENT), requestCode, resultCode, data);
}
use of com.helger.jcodemodel.JBlock in project androidannotations by androidannotations.
the class RoboGuiceHandler method beforeCreateMethod.
private void beforeCreateMethod(EActivityHolder holder, JFieldVar scope, JFieldVar scopedObjects, JFieldVar eventManager) {
JBlock body = holder.getInitBody();
AbstractJClass keyWildCard = getJClass(RoboGuiceClasses.KEY).narrow(getCodeModel().wildcard());
AbstractJClass scopedHashMap = getClasses().HASH_MAP.narrow(keyWildCard, getClasses().OBJECT);
body.assign(scopedObjects, JExpr._new(scopedHashMap));
JVar injector = body.decl(getJClass(RoboGuiceClasses.ROBO_INJECTOR), "injector_", getJClass(RoboGuiceClasses.ROBO_GUICE).staticInvoke("getInjector").arg(_this()));
body.assign(scope, invoke(injector, "getInstance").arg(getJClass(RoboGuiceClasses.CONTEXT_SCOPE).dotclass()));
body.assign(eventManager, invoke(injector, "getInstance").arg(getJClass(RoboGuiceClasses.EVENT_MANAGER).dotclass()));
body.add(injector.invoke("injectMembersWithoutViews").arg(_this()));
fireEvent(eventManager, body, getJClass(RoboGuiceClasses.ON_CREATE_EVENT), holder.getInitSavedInstanceParam());
}
use of com.helger.jcodemodel.JBlock in project androidannotations by androidannotations.
the class RoboGuiceHandler method onStopMethod.
private void onStopMethod(EActivityHolder holder, JFieldVar eventManager) {
JBlock onStopBlock = new JBlock().bracesRequired(false).indentRequired(false);
JTryBlock tryBlock = onStopBlock._try();
fireEvent(eventManager, tryBlock.body(), getJClass(RoboGuiceClasses.ON_STOP_EVENT));
JBlock finallyBody = tryBlock._finally();
finallyBody.invoke(_super(), "onStop");
JMethod onStop = holder.getOnStop();
codeModelHelper.replaceSuperCall(onStop, onStopBlock);
}
Aggregations