Search in sources :

Example 1 with ItemBinder

use of org.robobinding.ItemBinder 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));
}
Also used : ViewGroup(android.view.ViewGroup) BindableView(org.robobinding.BindableView) BindingContext(org.robobinding.BindingContext) View(android.view.View) AdapterView(android.widget.AdapterView) ListView(android.widget.ListView) PendingAttributesForViewBuilder.aPendingAttributesForView(org.robobinding.binder.PendingAttributesForViewBuilder.aPendingAttributesForView) BindableView(org.robobinding.BindableView) PendingAttributesForView(org.robobinding.PendingAttributesForView) BindingContextFactory(org.robobinding.BindingContextFactory) ItemBinder(org.robobinding.ItemBinder) PresentationModelAdapterFactory(org.robobinding.presentationmodel.PresentationModelAdapterFactory) BinderProvider(org.robobinding.BinderProvider) InvocationOnMock(org.mockito.invocation.InvocationOnMock) JavaReflectionPresentationModelObject(org.robobinding.test.JavaReflectionPresentationModelObject)

Example 2 with ItemBinder

use of org.robobinding.ItemBinder in project RoboBinding by RoboBinding.

the class DataSetAdapterBuilder method build.

public DataSetAdapter build() {
    ItemBinder itemBinder = bindingContext.createItemBinder();
    ItemLayoutBinder itemLayoutBinder = new ItemLayoutBinder(itemBinder, itemPredefinedMappings);
    ItemLayoutSelector itemLayoutSelector = buildItemLayoutSelector();
    DataSetAdapter dataSetAdapter = new DataSetAdapter(valueModelWithPreInitializeViews(), itemLayoutBinder, itemLayoutSelector, new ViewTags<RefreshableItemPresentationModel>(ITEM_PRESENTATION_MODEL_KEY), bindingContext.shouldPreInitializeViews());
    registerPropertyChangeListener(dataSetAdapter);
    return dataSetAdapter;
}
Also used : MultiItemLayoutSelector(org.robobinding.widget.adapterview.MultiItemLayoutSelector) ItemLayoutSelector(org.robobinding.widget.adapterview.ItemLayoutSelector) SingleItemLayoutSelector(org.robobinding.widget.adapterview.SingleItemLayoutSelector) ItemBinder(org.robobinding.ItemBinder) RefreshableItemPresentationModel(org.robobinding.itempresentationmodel.RefreshableItemPresentationModel) ItemLayoutBinder(org.robobinding.widget.adapterview.ItemLayoutBinder)

Example 3 with ItemBinder

use of org.robobinding.ItemBinder in project RoboBinding by RoboBinding.

the class DataSetAdapterBuilder method build.

public DataSetAdapter build() {
    ItemBinder itemBinder = bindingContext.createItemBinder();
    ItemLayoutBinder itemLayoutBinder = new ItemLayoutBinder(itemBinder, itemPredefinedMappings);
    ItemLayoutBinder dropdownLayoutBinder = new ItemLayoutBinder(itemBinder, dropdownPredefinedMappings);
    ItemLayoutSelector itemLayoutSelector = buildItemLayoutSelector();
    DataSetAdapter dataSetAdapter = new DataSetAdapter(valueModelWithPreInitializingViews(), itemLayoutBinder, dropdownLayoutBinder, itemLayoutSelector, dropdownLayoutId, new ViewTags<RefreshableItemPresentationModel>(ITEM_PRESENTATION_MODEL_KEY), bindingContext.shouldPreInitializeViews());
    registerPropertyChangeListener(dataSetAdapter);
    return dataSetAdapter;
}
Also used : ItemBinder(org.robobinding.ItemBinder) RefreshableItemPresentationModel(org.robobinding.itempresentationmodel.RefreshableItemPresentationModel)

Aggregations

ItemBinder (org.robobinding.ItemBinder)3 RefreshableItemPresentationModel (org.robobinding.itempresentationmodel.RefreshableItemPresentationModel)2 View (android.view.View)1 ViewGroup (android.view.ViewGroup)1 AdapterView (android.widget.AdapterView)1 ListView (android.widget.ListView)1 InvocationOnMock (org.mockito.invocation.InvocationOnMock)1 BindableView (org.robobinding.BindableView)1 BinderProvider (org.robobinding.BinderProvider)1 BindingContext (org.robobinding.BindingContext)1 BindingContextFactory (org.robobinding.BindingContextFactory)1 PendingAttributesForView (org.robobinding.PendingAttributesForView)1 PendingAttributesForViewBuilder.aPendingAttributesForView (org.robobinding.binder.PendingAttributesForViewBuilder.aPendingAttributesForView)1 PresentationModelAdapterFactory (org.robobinding.presentationmodel.PresentationModelAdapterFactory)1 JavaReflectionPresentationModelObject (org.robobinding.test.JavaReflectionPresentationModelObject)1 ItemLayoutBinder (org.robobinding.widget.adapterview.ItemLayoutBinder)1 ItemLayoutSelector (org.robobinding.widget.adapterview.ItemLayoutSelector)1 MultiItemLayoutSelector (org.robobinding.widget.adapterview.MultiItemLayoutSelector)1 SingleItemLayoutSelector (org.robobinding.widget.adapterview.SingleItemLayoutSelector)1