DeliveryXrecAdapter.java
3.3 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
package com.hh.xuetubao.adapter;
import android.content.Context;
import android.support.annotation.NonNull;
import android.support.v7.widget.RecyclerView;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.TextView;
import com.hh.xuetubao.R;
import com.hh.xuetubao.bean.ResumedJobListBean;
import java.util.List;
public class DeliveryXrecAdapter extends RecyclerView.Adapter<DeliveryXrecAdapter.ViewHolder> {
private List<ResumedJobListBean.JobListBean> mlist;
private Context context;
public DeliveryXrecAdapter(List<ResumedJobListBean.JobListBean> mlist, Context context) {
this.mlist = mlist;
this.context = context;
}
@NonNull
@Override
public ViewHolder onCreateViewHolder(@NonNull ViewGroup parent, int viewType) {
View view = LayoutInflater.from(context).inflate(R.layout.activity_delivery_list, null);
ViewHolder holder = new ViewHolder(view);
return holder;
}
@Override
public void onBindViewHolder(@NonNull ViewHolder holder, final int position) {
ResumedJobListBean.JobListBean bean = mlist.get(position);
if (bean.getJobName() != null)
holder.jobName.setText(bean.getJobName());
if (bean.getCompanName() != null)
holder.company.setText(bean.getCompanName());
if (bean.getSalary() != null)
holder.money.setText(bean.getSalary());
if (bean.getExprience() != null)
holder.jiangYan.setText(bean.getExprience());
if (bean.getEducation() != null)
holder.xueLi.setText(bean.getEducation());
if (bean.getAddress() != null)
holder.address.setText(bean.getAddress());
if (bean.getSendTime() != null) {
holder.tv_time.setText(bean.getSendTime());
}
holder.itemView.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
if (turnTo != null)
turnTo.turnToActicity(mlist.get(position).getJobOid());
}
});
}
@Override
public int getItemCount() {
return mlist.size();
}
public class ViewHolder extends RecyclerView.ViewHolder {
private final TextView jobName;
private final TextView company;
private final TextView money;
private final TextView jiangYan;
private final TextView xueLi;
private final TextView address;
private final TextView tv_time;
public ViewHolder(View itemView) {
super(itemView);
jobName = (TextView) itemView.findViewById(R.id.tv_job);
company = (TextView) itemView.findViewById(R.id.tv_company);
money = (TextView) itemView.findViewById(R.id.tv_money);
jiangYan = (TextView) itemView.findViewById(R.id.tv_jingyan);
xueLi = (TextView) itemView.findViewById(R.id.tv_xueli);
address = (TextView) itemView.findViewById(R.id.tv_address);
tv_time = itemView.findViewById(R.id.tv_time);
}
}
private TurnTo turnTo;
public void setTurnTo(TurnTo turnTo) {
this.turnTo = turnTo;
}
public interface TurnTo {
void turnToActicity(String jobId);
}
}