MyConsultAdapter.java
2.34 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
package com.shunzhi.parent.adapter;
import android.content.Context;
import android.support.v7.widget.LinearLayoutManager;
import android.support.v7.widget.RecyclerView;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.ImageView;
import android.widget.TextView;
import com.share.mvpsdk.base.adapter.BaseRecyclerViewAdapter;
import com.share.mvpsdk.base.adapter.BaseRecyclerViewHolder;
import com.shunzhi.parent.R;
import com.shunzhi.parent.bean.channel.ChannelContextBean;
/**
* Created by ToaHanDong on 2018/3/14.
*/
public class MyConsultAdapter extends BaseRecyclerViewAdapter<ChannelContextBean> {
private Context mContext=null;
public MyConsultAdapter(Context context){
mContext=context;
}
@Override
public void onAttachedToRecyclerView(RecyclerView recyclerView) {
super.onAttachedToRecyclerView(recyclerView);
LinearLayoutManager layoutManager=new LinearLayoutManager(mContext);
layoutManager.setOrientation(LinearLayoutManager.VERTICAL);
recyclerView.setLayoutManager(layoutManager);
}
@Override
public BaseRecyclerViewHolder onCreateViewHolder(ViewGroup parent, int viewType) {
View view = LayoutInflater.from(mContext).inflate(R.layout.layout_consult_content, parent, false);
return new MyConsultViewHolder(view);
}
private class MyConsultViewHolder extends BaseRecyclerViewHolder<ChannelContextBean>{
TextView tvConsultTitle, tvConsultContent, tvPingLunNums, tvZhuanFaNums;
ImageView iv_consult;
public MyConsultViewHolder(View itemView) {
super(itemView);
tvConsultTitle = itemView.findViewById(R.id.tvConsultTitle);
tvConsultContent = itemView.findViewById(R.id.tvConsultContent);
tvPingLunNums = itemView.findViewById(R.id.tvPingLunNums);
tvZhuanFaNums = itemView.findViewById(R.id.tvZhuanFaNums);
iv_consult = itemView.findViewById(R.id.iv_consult);
}
@Override
public void onBindViewHolder(ChannelContextBean object, int position) {
tvConsultContent.setText(object.getContent());
tvConsultTitle.setText(object.getTitle());
// tvPingLunNums.setText(object.getForwardingNum());
// tvZhuanFaNums.setText(object.getTalkNum());
}
}
}