use of org.robobinding.BindingContext in project RoboBinding by RoboBinding.
the class BindingTest method newBindingContext.
@SuppressWarnings("unchecked")
private BindingContext newBindingContext() {
BinderProvider binderProvider = mock(BinderProvider.class);
BindableView bindableView = mock(BindableView.class);
when(bindableView.getRootView()).then(new Answer<View>() {
@Override
public View answer(InvocationOnMock invocation) throws Throwable {
return new View(context);
}
});
ItemBinder itemBinder = mock(ItemBinder.class);
when(itemBinder.inflateWithoutAttachingToRoot(anyInt(), anyCollection(), any(ViewGroup.class))).thenReturn(bindableView);
when(binderProvider.createItemBinder(any(BindingContextFactory.class))).thenReturn(itemBinder);
return new BindingContext(binderProvider, context, new PresentationModelAdapterFactory().create(new JavaReflectionPresentationModelObject(new PresentationModelForTest())), PreInitializingViews.initial(true));
}
use of org.robobinding.BindingContext in project RoboBinding by RoboBinding.
the class OneWayBindingPropertyTest method aBoundProperty.
private OneWayBindingProperty aBoundProperty() {
ValueModelAttribute attribute = aValueModelAttribute(PROPERTY_NAME);
OneWayBindingProperty bindingProperty = new OneWayBindingProperty(view, viewAttributeSpy, attribute);
BindingContext bindingContext = aBindingContextWithReadOnlyProperty(PROPERTY_NAME, valueModel);
bindingProperty.performBind(bindingContext);
return bindingProperty;
}
use of org.robobinding.BindingContext in project RoboBinding by RoboBinding.
the class TwoWayBindingPropertyTest method aBoundProperty.
private TwoWayBindingProperty aBoundProperty(ValueModel<Integer> valueModel) {
ValueModelAttribute attribute = aValueModelAttribute(PROPERTY_NAME);
TwoWayBindingProperty bindingProperty = new TwoWayBindingProperty(view, viewAddOn, viewAttributeSpy, attribute);
BindingContext bindingContext = aBindingContextWithProperty(PROPERTY_NAME, valueModel);
bindingProperty.performBind(bindingContext);
return bindingProperty;
}
use of org.robobinding.BindingContext in project RoboBinding by RoboBinding.
the class MenuBinderImpl method inflateAndBind.
public void inflateAndBind(int menuRes, Object presentationModel) {
checkMenuRes(menuRes);
checkPresentationModel(presentationModel);
BindingContext bindingContext = bindingContextFactory.create(presentationModel);
InflatedView inflatedView = bindingMenuInflater.inflate(menuRes);
viewBindingLifecycle.run(inflatedView, bindingContext);
}
use of org.robobinding.BindingContext in project RoboBinding by RoboBinding.
the class ViewBinderImpl method inflateAndBind.
private View inflateAndBind(int layoutId, Object presentationModel, ViewGroup root, boolean attachToRoot) {
checkLayoutId(layoutId);
checkPresentationModel(presentationModel);
checkRoot(root);
BindingContext bindingContext = bindingContextFactory.create(presentationModel);
InflatedViewWithRoot inflatedView = bindingViewInflater.inflateView(layoutId, root, attachToRoot);
viewBindingLifecycle.run(inflatedView, bindingContext);
return inflatedView.getRootView();
}
Aggregations