use of com.muzi.library.manager.MGridLayoutManager in project VerticalCalendar by mzyq.
the class CalendarAdapter method convert.
@Override
protected void convert(BaseViewHolder helper, MonthBean item) {
helper.setText(R.id.textMonth, item.getYear() + "年" + item.getMonth() + "月");
recyclerView = helper.getView(R.id.rvMonth);
recyclerView.setLayoutManager(new MGridLayoutManager(context, 7));
adapter = new MonthAdapter(context, R.layout.item_day, item.getDayList());
adapter.setSpanSizeLookup(new SpanSizeLookup() {
@Override
public int getSpanSize(GridLayoutManager gridLayoutManager, int position) {
return 1;
}
});
recyclerView.setAdapter(adapter);
helper.addOnClickListener(R.id.rvMonth);
recyclerView.addOnItemTouchListener(new com.chad.library.adapter.base.listener.OnItemChildClickListener() {
@Override
public void onSimpleItemChildClick(BaseQuickAdapter adapter, View view, int position) {
if (listener != null) {
listener.onItemChildClick(adapter, view, position);
}
}
});
}
Aggregations