package com.tenlionsoft.baselib.core.widget.base;

import android.content.Context;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;

import com.bumptech.glide.Glide;
import com.tenlionsoft.baselib.R;
import com.tenlionsoft.baselib.core.beans.FuncBean;
import com.tenlionsoft.baselib.core.widget.views.BaseFunctionHolder;

import java.util.List;

/**
 * 作者: adam
 * 日期: 2020/6/4 - 9:27 PM
 * 邮箱: itgaojian@163.com
 * 描述:
 */
public class BaseFuncAdapter extends BaseRecyclerAdapter<FuncBean, BaseFunctionHolder> {
    public BaseFuncAdapter(Context ctx, List<FuncBean> list) {
        super(ctx, list);
    }

    @Override
    public BaseFunctionHolder createHolder(ViewGroup parent, int viewType) {
        View itemView = LayoutInflater.from(mContext).inflate(R.layout.item_base_func_layout, parent, false);
        return new BaseFunctionHolder(itemView);
    }

    @Override
    public void bindHolder(BaseFunctionHolder baseFunctionHolder, int i) {
        Glide.with(mContext)
                .load(mData.get(i).getIconRes())
                .into(baseFunctionHolder.mIvButton);
        baseFunctionHolder.mTvName.setText(mData.get(i).getText());
    }
}
