use of org.androidannotations.holder.FoundViewHolder in project androidannotations by androidannotations.
the class ViewsByIdHandler method addViewToListIfNotNull.
private void addViewToListIfNotNull(IJExpression elementRef, AbstractJClass viewClass, JFieldRef idRef, EComponentWithViewSupportHolder holder) {
FoundViewHolder foundViewHolder = holder.getFoundViewHolder(idRef, viewClass);
foundViewHolder.getIfNotNullBlock().invoke(elementRef, "add").arg(foundViewHolder.getOrCastRef(viewClass));
}
use of org.androidannotations.holder.FoundViewHolder in project androidannotations by androidannotations.
the class ViewByIdHandler method assignValue.
@Override
public void assignValue(JBlock targetBlock, IJAssignmentTarget fieldRef, EComponentWithViewSupportHolder holder, Element element, Element param) {
TypeMirror uiFieldTypeMirror = param.asType();
JFieldRef idRef = annotationHelper.extractOneAnnotationFieldRef(element, IRClass.Res.ID, true);
AbstractJClass viewClass = codeModelHelper.typeMirrorToJClass(uiFieldTypeMirror);
IJAssignmentTarget viewHolderTarget = null;
if (element.getKind() == ElementKind.FIELD) {
viewHolderTarget = fieldRef;
}
FoundViewHolder viewHolder = holder.getFoundViewHolder(idRef, viewClass, viewHolderTarget);
if (!viewHolder.getRef().equals(viewHolderTarget)) {
targetBlock.add(fieldRef.assign(viewHolder.getOrCastRef(viewClass)));
}
}
use of org.androidannotations.holder.FoundViewHolder in project androidannotations by androidannotations.
the class AbstractViewListenerHandler method assignListeners.
@Override
protected final void assignListeners(EComponentWithViewSupportHolder holder, List<JFieldRef> idsRefs, JDefinedClass listenerAnonymousClass) {
for (JFieldRef idRef : idsRefs) {
AbstractJClass listenerTargetClass = getListenerTargetClass(holder);
FoundViewHolder foundViewHolder = holder.getFoundViewHolder(idRef, listenerTargetClass);
foundViewHolder.getIfNotNullBlock().invoke(foundViewHolder.getOrCastRef(listenerTargetClass), getSetterName()).arg(_new(listenerAnonymousClass));
}
}
Aggregations