ResumeTrainAdapter.java 1.9 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.TextView;

import com.hh.xuetubao.R;
import com.hh.xuetubao.bean.ResumeDetailBean;

import java.util.List;

public class ResumeTrainAdapter extends BaseAdapter {
    private List<ResumeDetailBean.TrainListBean> list;
    private Context context;

    public ResumeTrainAdapter(List<ResumeDetailBean.TrainListBean> 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_train, null);
        TextView school = (TextView) view.findViewById(R.id.tv_school);
        TextView startTime = (TextView) view.findViewById(R.id.tv_start);
        TextView endTime = (TextView) view.findViewById(R.id.tv_end);
        TextView content = (TextView) view.findViewById(R.id.tv_content);
        TextView keTang = (TextView) view.findViewById(R.id.tv_ketang);

        if (list.get(position).getDetail() != null)
            content.setText(list.get(position).getDetail());
        if (list.get(position).getStartTime() != null)
            startTime.setText(list.get(position).getStartTime());
        if (list.get(position).getEdntime() != null)
            endTime.setText(list.get(position).getEdntime());
        if (list.get(position).getTrainName() != null)
            school.setText(list.get(position).getTrainName());
        return view;
    }
}