Skip to content

Customization of Composite Items

Vitaly Vivchar edited this page Jan 28, 2018 · 17 revisions

Custom LayoutManager

To change LayoutManager extend CompositeViewBinder and override the createLayoutManager()` method:

public class YourCompositeViewBinder extends CompositeViewBinder<YourCompositeModel> {
    //...
    @Override
    protected RecyclerView.LayoutManager createLayoutManager() {
        return new AnyLayoutManager();
    }
}

Custom Adapter

To set custom RendererRecyclerViewAdapter extend CompositeViewBinder and override createAdapter method:

public class YourCompositeViewBinder extends CompositeViewBinder<YourCompositeModel> {
    //...
    @Override
    protected RendererRecyclerViewAdapter createAdapter() {
        return new AnyExtendedAdapter();
    }
}

Add ItemDecoration

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());
    }
}