Search in sources :

Example 1 with MGridLayoutManager

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);
            }
        }
    });
}
Also used : GridLayoutManager(android.support.v7.widget.GridLayoutManager) MGridLayoutManager(com.muzi.library.manager.MGridLayoutManager) BaseQuickAdapter(com.chad.library.adapter.base.BaseQuickAdapter) MGridLayoutManager(com.muzi.library.manager.MGridLayoutManager) RecyclerView(android.support.v7.widget.RecyclerView) View(android.view.View)

Aggregations

GridLayoutManager (android.support.v7.widget.GridLayoutManager)1 RecyclerView (android.support.v7.widget.RecyclerView)1 View (android.view.View)1 BaseQuickAdapter (com.chad.library.adapter.base.BaseQuickAdapter)1 MGridLayoutManager (com.muzi.library.manager.MGridLayoutManager)1