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
package cn.flightfeather.thirdappmodule.adapter;
 
import android.content.Context;
import android.support.constraint.ConstraintLayout;
import android.support.constraint.Group;
import android.support.v7.widget.RecyclerView;
import android.view.View;
import android.widget.ImageView;
import android.widget.TextView;
 
import cn.flightfeather.thirdappmodule.R;
import cn.flightfeather.thirdappmodule.util.ScreenUtils;
import cn.flightfeather.thirdappmodule.util.slideswaphelper.Extension;
 
 
/**
 * Created by note_ff_1602 on 2017/9/14.
 */
 
public class TaskListHolder extends RecyclerView.ViewHolder implements Extension {
 
    private Context context;
 
    TextView txt_date;
    TextView txt_total_task_count;
    TextView txt_complete_task_count;
    TextView txt_changed_task_count;
 
    TextView mtv_name;
    TextView mtv_address;
    TextView mtv_time;
    TextView mtv_staff;
    TextView mtv_check_status;
    // 审核状态
    ImageView img_status;
 
    // 风险提示
    Group group_risk_warn;
    TextView tv_risk_warn;
    // 巡查要点
    Group group_inspection_key_point;
    TextView tv_inspection_key_point;
    // 应急巡查
    Group group_emergency_inspection;
    TextView tv_emergency_inspection;
 
    public ConstraintLayout slideLayout;
 
    public TaskListHolder(View itemView, Context context, int viewType) {
        super(itemView);
        this.context = context;
        if (viewType == TaskListAdapter.ITEM_VIEW_TYPE_HEAD) {
            txt_date = itemView.findViewById(R.id.txt_date);
            txt_total_task_count = itemView.findViewById(R.id.txt_total_task_count);
            txt_complete_task_count = itemView.findViewById(R.id.txt_complete_task_count);
            txt_changed_task_count = itemView.findViewById(R.id.txt_changed_task_count);
        } else if (viewType == TaskListAdapter.ITEM_VIEW_TYPE_CONTENT){
            mtv_time = itemView.findViewById(R.id.tv_item_task_list_time);
            mtv_name = itemView.findViewById(R.id.tv_item_task_list_name);
            mtv_address = itemView.findViewById(R.id.tv_item_task_list_address);
            mtv_staff = itemView.findViewById(R.id.tv_task_staff);
            img_status = itemView.findViewById(R.id.img_task_status);
            slideLayout = itemView.findViewById(R.id.cl_item);
            mtv_check_status = itemView.findViewById(R.id.tv_check_status);
            group_risk_warn = itemView.findViewById(R.id.group_risk_warn);
            tv_risk_warn = itemView.findViewById(R.id.tv_risk_warn);
            group_inspection_key_point = itemView.findViewById(R.id.group_inspection_key_point);
            tv_inspection_key_point = itemView.findViewById(R.id.tv_inspection_key_point);
            group_emergency_inspection = itemView.findViewById(R.id.group_emergency_inspection);
            tv_emergency_inspection = itemView.findViewById(R.id.tv_emergency_inspection);
        }
    }
 
    @Override
    public float getActionWidth() {
        return ScreenUtils.dp2px(context, 100);
    }
}