use of org.robobinding.SubBindingContext in project RoboBinding by RoboBinding.
the class SubViewPresentationModelAttribute method bindTo.
@Override
public void bindTo(BindingContext bindingContext) {
SubBindingContext subBindingContext = bindingContext.navigateToSubContext(attribute.getPropertyName());
View subView = subBindingContext.inflateAndBindWithoutAttachingToRoot(layoutId, parent);
subViewHolder.setSubView(subView);
}
use of org.robobinding.SubBindingContext in project RoboBinding by RoboBinding.
the class SubViewPresentationModelAttributeTest method whenBind_thenBoundSubViewIsSetOnHolder.
@Test
public void whenBind_thenBoundSubViewIsSetOnHolder() {
int layoutId = 1;
String presentationModelPropertyName = "propertyName";
ViewGroup parent = mock(ViewGroup.class);
View boundSubView = mock(View.class);
BindingContext context = mock(BindingContext.class);
SubViewHolder subViewHolder = mock(SubViewHolder.class);
SubBindingContext subBindingContext = mock(SubBindingContext.class);
when(context.navigateToSubContext(presentationModelPropertyName)).thenReturn(subBindingContext);
when(subBindingContext.inflateAndBindWithoutAttachingToRoot(layoutId, parent)).thenReturn(boundSubView);
SubViewPresentationModelAttribute subViewAttribute = new SubViewPresentationModelAttribute(parent, layoutId, subViewHolder);
subViewAttribute.setAttribute(aValueModelAttribute(presentationModelPropertyName));
subViewAttribute.bindTo(context);
verify(subViewHolder).setSubView(boundSubView);
}
Aggregations