RecruitmentLabelAdapter.java
1.6 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
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.CompanyDetailBean;
import java.util.List;
public class RecruitmentLabelAdapter extends RecyclerView.Adapter<RecruitmentLabelAdapter.ViewHolder> {
private List<CompanyDetailBean.JobFunctionListBean.JobListBean.LabelListBean> list;
private Context context;
public RecruitmentLabelAdapter(List<CompanyDetailBean.JobFunctionListBean.JobListBean.LabelListBean> list, Context context) {
this.list = list;
this.context = context;
}
@NonNull
@Override
public ViewHolder onCreateViewHolder(@NonNull ViewGroup parent, int viewType) {
View view = LayoutInflater.from(context).inflate(R.layout.list_label, null);
ViewHolder holder = new ViewHolder(view);
return holder;
}
@Override
public void onBindViewHolder(@NonNull ViewHolder holder, int position) {
if (list.get(position).getLabel() != null)
holder.content.setText(list.get(position).getLabel());
}
@Override
public int getItemCount() {
return list.size();
}
public class ViewHolder extends RecyclerView.ViewHolder {
private final TextView content;
public ViewHolder(View itemView) {
super(itemView);
content = (TextView) itemView.findViewById(R.id.content);
}
}
}