package com.wd.workoffice.ui.adapter;


import com.chad.library.adapter.base.BaseQuickAdapter;
import com.chad.library.adapter.base.BaseViewHolder;
import com.wd.workoffice.R;
import com.wd.workoffice.bean.ProductBean;

import java.util.ArrayList;
import java.util.List;

/**
 * Created by flexible on 2018/8/13.
 */

public class StarAdapter extends BaseQuickAdapter<Object, BaseViewHolder> {
    int score;// 1 - 5

    public StarAdapter(int layoutResId, List data) {
        super(layoutResId, data);
    }

    @Override
    protected void convert(BaseViewHolder helper, Object item) {
        if (helper.getAdapterPosition() >= score) {
            helper.setImageResource(R.id.iv_img, R.mipmap.ticket_star_gray);
        } else {
            helper.setImageResource(R.id.iv_img, R.mipmap.ticket_star_yellow);
        }
    }

    public int getScore() {
        return score;
    }

    public void setScore(int score) {
        this.score = score;
        notifyDataSetChanged();
    }
}

