use of com.chad.baserecyclerviewadapterhelper.entity.QuickMultipleEntity in project BaseRecyclerViewAdapterHelper by CymChad.
the class MultiItemQuickUseActivity method onCreate.
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_multiple_item_use);
setTitle("BaseMultiItemQuickAdapter");
setBackBtn();
RecyclerView mRecyclerView = findViewById(R.id.rv_list);
final List<QuickMultipleEntity> data = DataServer.getMultipleItemData();
final MultipleItemQuickAdapter multipleItemAdapter = new MultipleItemQuickAdapter(data);
final GridLayoutManager manager = new GridLayoutManager(this, 4);
mRecyclerView.setLayoutManager(manager);
multipleItemAdapter.setGridSpanSizeLookup(new GridSpanSizeLookup() {
@Override
public int getSpanSize(GridLayoutManager gridLayoutManager, int viewType, int position) {
return data.get(position).getSpanSize();
}
});
mRecyclerView.setAdapter(multipleItemAdapter);
}
use of com.chad.baserecyclerviewadapterhelper.entity.QuickMultipleEntity in project BaseRecyclerViewAdapterHelper by CymChad.
the class DataServer method getMultipleItemData.
public static List<QuickMultipleEntity> getMultipleItemData() {
List<QuickMultipleEntity> list = new ArrayList<>();
for (int i = 0; i <= 4; i++) {
list.add(new QuickMultipleEntity(QuickMultipleEntity.IMG, QuickMultipleEntity.IMG_SPAN_SIZE));
list.add(new QuickMultipleEntity(QuickMultipleEntity.TEXT, QuickMultipleEntity.TEXT_SPAN_SIZE, CYM_CHAD));
list.add(new QuickMultipleEntity(QuickMultipleEntity.IMG_TEXT, QuickMultipleEntity.IMG_TEXT_SPAN_SIZE));
list.add(new QuickMultipleEntity(QuickMultipleEntity.IMG_TEXT, QuickMultipleEntity.IMG_TEXT_SPAN_SIZE_MIN));
list.add(new QuickMultipleEntity(QuickMultipleEntity.IMG_TEXT, QuickMultipleEntity.IMG_TEXT_SPAN_SIZE_MIN));
}
return list;
}
Aggregations