-
Notifications
You must be signed in to change notification settings - Fork 183
Customization of Composite Items
Vitaly Vivchar edited this page Jan 28, 2018
·
17 revisions
To change LayoutManager
extend CompositeViewBinder
and override the createLayoutManager()
method:
public class YourCompositeViewBinder extends CompositeViewBinder<YourCompositeModel> {
//...
@Override
protected RecyclerView.LayoutManager createLayoutManager() {
return new AnyLayoutManager();
}
}
To set custom RendererRecyclerViewAdapter
extend CompositeViewBinder
and override createAdapter
method:
public class YourCompositeViewBinder extends CompositeViewBinder<YourCompositeModel> {
//...
@Override
protected RendererRecyclerViewAdapter createAdapter() {
return new AnyExtendedAdapter();
}
}
To add any ItemDecoration
extend CompositeViewBinder
and override createItemDecorations()
method:
public class YourCompositeViewBinder extends CompositeViewBinder<YourCompositeModel> {
//...
@Override
protected List<? extends RecyclerView.ItemDecoration> createItemDecorations() {
return Collections.singletonList(new AnyItemDecoration());
}
}
OR use a special constructor:
new CompositeViewBinder(R.layout.composite_item,
R.id.nested_recycler_view_id,
YourCompositeModel.class,
Collections.singletonList(new AnyItemDecoration()));