|
@@ -12,11 +12,14 @@ import androidx.recyclerview.widget.DefaultItemAnimator;
|
12
|
12
|
import androidx.recyclerview.widget.DividerItemDecoration;
|
13
|
13
|
import androidx.recyclerview.widget.LinearLayoutManager;
|
14
|
14
|
|
|
15
|
+import com.annimon.stream.Collectors;
|
|
16
|
+import com.annimon.stream.Stream;
|
15
|
17
|
import com.bumptech.glide.Glide;
|
16
|
18
|
import com.fusi24.rfid.R;
|
17
|
|
-import com.fusi24.rfid.adapter.ScanResultAdapter;
|
|
19
|
+import com.fusi24.rfid.adapter.ProblemGroupAdapter;
|
18
|
20
|
import com.fusi24.rfid.base.BaseActivity;
|
19
|
21
|
import com.fusi24.rfid.config.Constant;
|
|
22
|
+import com.fusi24.rfid.data.entity.DataGroup;
|
20
|
23
|
import com.fusi24.rfid.data.entity.DataProblems;
|
21
|
24
|
import com.fusi24.rfid.data.entity.DataResultRfid;
|
22
|
25
|
import com.fusi24.rfid.databinding.ActivityScanResultNewBinding;
|
|
@@ -36,7 +39,7 @@ public class ScanResultActivity extends BaseActivity implements ScanResultView {
|
36
|
39
|
public static final String LOCATION = "location";
|
37
|
40
|
|
38
|
41
|
private ScanResultPresenter presenter;
|
39
|
|
- private ScanResultAdapter adapter;
|
|
42
|
+ private ProblemGroupAdapter adapter;
|
40
|
43
|
private List<DataProblems> problemsList;
|
41
|
44
|
private String dataUrl, numberRfid, numberRfidTemp, idPermit, idDevice, idCheckType, checkTypeName, longLat;
|
42
|
45
|
private ActivityScanResultNewBinding binding;
|
|
@@ -97,7 +100,7 @@ public class ScanResultActivity extends BaseActivity implements ScanResultView {
|
97
|
100
|
binding.tvRfidNumber.setText(numberRfid);
|
98
|
101
|
|
99
|
102
|
problemsList = new ArrayList<>();
|
100
|
|
- adapter = new ScanResultAdapter(this);
|
|
103
|
+ adapter = new ProblemGroupAdapter(this);
|
101
|
104
|
|
102
|
105
|
LinearLayoutManager layoutManager = new LinearLayoutManager(this);
|
103
|
106
|
binding.rvDocumentProblem.setLayoutManager(layoutManager);
|
|
@@ -187,7 +190,14 @@ public class ScanResultActivity extends BaseActivity implements ScanResultView {
|
187
|
190
|
}
|
188
|
191
|
|
189
|
192
|
problemsList = dataResultRfid.getProblems();
|
190
|
|
- adapter.updateProblemList(problemsList);
|
|
193
|
+
|
|
194
|
+ // Function mapping data problem by Group
|
|
195
|
+ List<DataGroup> groupList = Stream.of(problemsList)
|
|
196
|
+ .map(v -> v.getDataDocumentType().getGroup())
|
|
197
|
+ .distinctBy(DataGroup::getId)
|
|
198
|
+ .collect(Collectors.toList());
|
|
199
|
+
|
|
200
|
+ adapter.updateGroupList(groupList);
|
191
|
201
|
adapter.notifyDataSetChanged();
|
192
|
202
|
}
|
193
|
203
|
|