TaskBarView.java
1.57 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
package com.huaheng.mobilewms.view;
import android.content.Context;
import android.support.constraint.ConstraintLayout;
import android.view.LayoutInflater;
import android.widget.Button;
import com.huaheng.mobilewms.R;
import java.util.ArrayList;
import java.util.List;
import butterknife.BindView;
import butterknife.ButterKnife;
import butterknife.OnClick;
public class TaskBarView extends ConstraintLayout {
//备货入按钮
@BindView((R.id.btBeihuo))
Button bt_beihuo;
//二次分拣按钮
@BindView(R.id.btSecond)
Button bt_second;
@BindView(R.id.btSelectAll)
Button bt_selectAll;
List<TaskShipItemView> list;
public TaskBarView(Context context){
super(context);
LayoutInflater.from(context).inflate(R.layout.task_bar_view, this);
ButterKnife.bind(this);
}
@OnClick(R.id.btSelectAll)
public void selectAll(){
boolean all = true;
//检查是否已经全选
for(TaskShipItemView v : list){
if(!v.isItemSelected()){
all = false;
}
}
//全选或全不选
for(TaskShipItemView v : list){
v.select(!all);
}
}
public void setList(List<TaskShipItemView> list){
this.list = list;
}
/**
* 获取被选中的任务明细
* @return
*/
public List getSelectTaskDetail(){
List list = new ArrayList();
for(TaskShipItemView v : this.list){
if(v.isItemSelected()){
list.add(v);
}
}
return list;
}
}