ResumeCertAdapter.java 1.5 KB
package com.hh.xuetubao.adapter;

import android.content.Context;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.BaseAdapter;
import android.widget.ImageView;
import android.widget.TextView;

import com.bumptech.glide.Glide;
import com.hh.xuetubao.R;
import com.hh.xuetubao.bean.ResumeDetailBean;

import java.util.List;

public class ResumeCertAdapter extends BaseAdapter {
    List<ResumeDetailBean.CertListBean> list;
    private Context context;

    public ResumeCertAdapter(List<ResumeDetailBean.CertListBean> list, Context context) {
        this.list = list;
        this.context = context;
    }

    @Override
    public int getCount() {
        return list.size();
    }

    @Override
    public Object getItem(int position) {
        return list.get(position);
    }

    @Override
    public long getItemId(int position) {
        return position;
    }

    @Override
    public View getView(int position, View convertView, ViewGroup parent) {
        View view = LayoutInflater.from(context).inflate(R.layout.lv_resume_cert, null);
        TextView title = (TextView) view.findViewById(R.id.tv_title);
        ImageView img = (ImageView) view.findViewById(R.id.img_zhengshu);

        if (list.get(position).getCertName() != null)
            title.setText(list.get(position).getCertName());
        if (list.get(position).getImgUrl() != null)
            Glide.with(context).load(list.get(position).getImgUrl()).into(img);

        return view;
    }
}