ResumeExpAdapter.java 2.1 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 ResumeExpAdapter extends BaseAdapter {
    private List<ResumeDetailBean.ExpListBean> list;
    private Context context;
    private TextView company;
    private TextView job;
    private TextView content;
    private TextView satrtTime;
    private TextView endTime;

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

    @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_exp, null);
        company = (TextView) view.findViewById(R.id.tv_company);
        job = (TextView) view.findViewById(R.id.tv_job);
        content = (TextView) view.findViewById(R.id.tv_content);
        satrtTime = (TextView) view.findViewById(R.id.tv_start);
        endTime = (TextView) view.findViewById(R.id.tv_end);

        if (list.get(position).getCompanyName() != null)
            company.setText(list.get(position).getCompanyName());
        if (list.get(position).getJobName() != null)
            job.setText(list.get(position).getJobName());
        if (list.get(position).getDetail() != null)
            content.setText(list.get(position).getDetail());
        if (list.get(position).getStartTime() != null)
            satrtTime.setText(list.get(position).getStartTime());
        if (list.get(position).getEndTime() != null)
            endTime.setText(list.get(position).getEndTime());
        return view;
    }
}