package com.duben.microtribe.ui.adapter;

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

import com.duben.microtribe.R;
import com.duben.microtribe.mvp.model.VedioBean;
import com.duben.library.utils.GlideUtils;
import com.youth.banner.adapter.BannerAdapter;

import java.util.List;

public class VipBannerAdapter extends BannerAdapter<VedioBean, ImageTitleHolder> {

    private Context context;

    public VipBannerAdapter(List<VedioBean> data) {
        super(data);
    }

    @Override
    public ImageTitleHolder onCreateHolder(ViewGroup parent, int viewType) {
        context = parent.getContext();
        return new ImageTitleHolder(LayoutInflater.from(context).inflate(R.layout.item_banner_vip, parent, false));
    }

    @Override
    public void onBindView(ImageTitleHolder holder, VedioBean data, int position, int size) {
        if (data.getCoverImage() != null) {
            GlideUtils.INSTANCE.loadImageViewGifForCenterCrop(context, data.getCoverImage(), holder.imageView, 15);
        }
        holder.title.setText(data.getTitle());
    }

}
