Search in sources :

Example 1 with ComposedAdapter

use of com.h6ah4i.android.widget.advrecyclerview.composedadapter.ComposedAdapter in project android-advancedrecyclerview by h6ah4i.

the class CompositionAllExampleActivity method createComposedAdapter.

private ComposedAdapter createComposedAdapter(RecyclerView rv, OnListItemClickMessageListener clickListener) {
    RecyclerViewDragDropManager dragMgr = new RecyclerViewDragDropManager();
    RecyclerViewDragDropManager dragMgr2 = new RecyclerViewDragDropManager();
    RecyclerViewSwipeManager swipeMgr = new RecyclerViewSwipeManager();
    RecyclerViewSwipeManager swipeMgr2 = new RecyclerViewSwipeManager();
    RecyclerViewExpandableItemManager expMgr = new RecyclerViewExpandableItemManager(null);
    RecyclerViewExpandableItemManager expMgr2 = new RecyclerViewExpandableItemManager(null);
    dragMgr.setDraggingItemShadowDrawable((NinePatchDrawable) ContextCompat.getDrawable(this, R.drawable.material_shadow_z3));
    dragMgr2.setDraggingItemShadowDrawable((NinePatchDrawable) ContextCompat.getDrawable(this, R.drawable.material_shadow_z3));
    ComposedAdapter composedAdapter = new ComposedAdapter();
    composedAdapter.addAdapter(new MySectionHeaderAdapter("Draggable - 1"));
    composedAdapter.addAdapter(dragMgr.createWrappedAdapter(new MyDraggableAdapter(clickListener)));
    composedAdapter.addAdapter(new MySectionHeaderAdapter("Draggable - 2"));
    composedAdapter.addAdapter(dragMgr2.createWrappedAdapter(new MyDraggableAdapter(clickListener)));
    composedAdapter.addAdapter(new MySectionHeaderAdapter("Swipeable - 1"));
    composedAdapter.addAdapter(swipeMgr.createWrappedAdapter(new MySwipeableAdapter(clickListener)));
    composedAdapter.addAdapter(new MySectionHeaderAdapter("Swipeable - 2"));
    composedAdapter.addAdapter(swipeMgr2.createWrappedAdapter(new MySwipeableAdapter(clickListener)));
    composedAdapter.addAdapter(new MySectionHeaderAdapter("Expandable - 1"));
    composedAdapter.addAdapter(expMgr.createWrappedAdapter(new MyExpandableAdapter(expMgr, clickListener)));
    composedAdapter.addAdapter(new MySectionHeaderAdapter("Expandable - 2"));
    composedAdapter.addAdapter(expMgr2.createWrappedAdapter(new MyExpandableAdapter(expMgr2, clickListener)));
    dragMgr.attachRecyclerView(rv);
    dragMgr2.attachRecyclerView(rv);
    swipeMgr.attachRecyclerView(rv);
    swipeMgr2.attachRecyclerView(rv);
    expMgr.attachRecyclerView(rv);
    expMgr2.attachRecyclerView(rv);
    return composedAdapter;
}
Also used : RecyclerViewSwipeManager(com.h6ah4i.android.widget.advrecyclerview.swipeable.RecyclerViewSwipeManager) ComposedAdapter(com.h6ah4i.android.widget.advrecyclerview.composedadapter.ComposedAdapter) RecyclerViewDragDropManager(com.h6ah4i.android.widget.advrecyclerview.draggable.RecyclerViewDragDropManager) RecyclerViewExpandableItemManager(com.h6ah4i.android.widget.advrecyclerview.expandable.RecyclerViewExpandableItemManager)

Aggregations

ComposedAdapter (com.h6ah4i.android.widget.advrecyclerview.composedadapter.ComposedAdapter)1 RecyclerViewDragDropManager (com.h6ah4i.android.widget.advrecyclerview.draggable.RecyclerViewDragDropManager)1 RecyclerViewExpandableItemManager (com.h6ah4i.android.widget.advrecyclerview.expandable.RecyclerViewExpandableItemManager)1 RecyclerViewSwipeManager (com.h6ah4i.android.widget.advrecyclerview.swipeable.RecyclerViewSwipeManager)1