package com.unis.sxzcl.ui.template;

import com.chad.library.adapter.base.BaseQuickAdapter;
import com.chad.library.adapter.base.module.LoadMoreModule;
import com.chad.library.adapter.base.viewholder.BaseViewHolder;
import com.unis.sxzcl.R;

import org.jetbrains.annotations.NotNull;

/**
 * 包名: com.unis.sxzcl.ui.template
 * 类名: DetailTemplateAdapter
 * 作用描述:
 * 创建人: mQ
 * 创建时间: 2020/11/18 15:03
 * 更新人:
 * 更新时间: 2020/11/18 15:03
 * 更新说明:
 * 版本号: 1.0
 */
public class TemplateListAdapter extends BaseQuickAdapter<TemplateListBean, BaseViewHolder>
        implements LoadMoreModule {

    private Callback mCallback;

    public TemplateListAdapter() {
        super(R.layout.item_list_template);
    }

    @Override
    protected void convert(@NotNull BaseViewHolder holder, TemplateListBean item) {
        holder
                .setText(R.id.tv_title, item.houseName)
                .setText(R.id.tv_time, item.time)
        ;
        holder.itemView.setOnClickListener(v -> {
            if (mCallback != null)
                mCallback.onItemClick(item);
        });
    }

    public void setCallback(Callback callback) {
        mCallback = callback;
    }

    public interface Callback {
        void onItemClick(TemplateListBean item);
    }

}
