Browse Source

-Parsing change from integer to object

ilhamitubagoes 4 years ago
parent
commit
944107d228

+ 2 - 2
app/src/main/java/com/fusi24/rfid/adapter/StatusScanAdapter.java

@@ -44,7 +44,7 @@ public class StatusScanAdapter extends RecyclerView.Adapter<StatusScanAdapter.Vi
44
 
44
 
45
             View.OnClickListener listener = v -> {
45
             View.OnClickListener listener = v -> {
46
                 selectedItem = getAdapterPosition();
46
                 selectedItem = getAdapterPosition();
47
-                onItemSelected.onSelected(detailList.get(getAdapterPosition()).getId());
47
+                onItemSelected.onSelected(detailList.get(getAdapterPosition()));
48
                 notifyDataSetChanged();
48
                 notifyDataSetChanged();
49
             };
49
             };
50
 
50
 
@@ -74,7 +74,7 @@ public class StatusScanAdapter extends RecyclerView.Adapter<StatusScanAdapter.Vi
74
     }
74
     }
75
 
75
 
76
     public interface OnItemSelected {
76
     public interface OnItemSelected {
77
-        void onSelected(Integer idStatus);
77
+        void onSelected(DataDetail detail);
78
     }
78
     }
79
 
79
 
80
 }
80
 }

+ 5 - 3
app/src/main/java/com/fusi24/rfid/ui/ScanActivity.java

@@ -22,8 +22,9 @@ public class ScanActivity extends LFScanProcessing {
22
     public static final String ID_PERMIT = "id_permit";
22
     public static final String ID_PERMIT = "id_permit";
23
     public static final String ID_DEVICE = "id_device";
23
     public static final String ID_DEVICE = "id_device";
24
     public static final String ID_CHECK_TYPE = "id_check_type";
24
     public static final String ID_CHECK_TYPE = "id_check_type";
25
+    public static final String CHECK_TYPE_NAME = "check_type_name";
25
 
26
 
26
-    private String idPermit, idDevice, idCheckType, longLat;
27
+    private String idPermit, idDevice, idCheckType, checkTypeName, longLat;
27
     private ActivityScanBinding binding;
28
     private ActivityScanBinding binding;
28
     private FusedLocationProviderClient locationClient;
29
     private FusedLocationProviderClient locationClient;
29
 
30
 
@@ -42,6 +43,7 @@ public class ScanActivity extends LFScanProcessing {
42
             idPermit = getIntent().getExtras().getString(ID_PERMIT);
43
             idPermit = getIntent().getExtras().getString(ID_PERMIT);
43
             idDevice = getIntent().getExtras().getString(ID_DEVICE);
44
             idDevice = getIntent().getExtras().getString(ID_DEVICE);
44
             idCheckType = String.valueOf(getIntent().getExtras().getInt(ID_CHECK_TYPE));
45
             idCheckType = String.valueOf(getIntent().getExtras().getInt(ID_CHECK_TYPE));
46
+            checkTypeName = getIntent().getExtras().getString(CHECK_TYPE_NAME);
45
         }
47
         }
46
 
48
 
47
         locationClient = LocationServices.getFusedLocationProviderClient(this);
49
         locationClient = LocationServices.getFusedLocationProviderClient(this);
@@ -62,6 +64,7 @@ public class ScanActivity extends LFScanProcessing {
62
         intent.putExtra(ScanResultActivity.ID_PERMIT, idPermit);
64
         intent.putExtra(ScanResultActivity.ID_PERMIT, idPermit);
63
         intent.putExtra(ScanResultActivity.ID_DEVICE, idDevice);
65
         intent.putExtra(ScanResultActivity.ID_DEVICE, idDevice);
64
         intent.putExtra(ScanResultActivity.ID_CHECK_TYPE, idCheckType);
66
         intent.putExtra(ScanResultActivity.ID_CHECK_TYPE, idCheckType);
67
+        intent.putExtra(ScanResultActivity.CHECK_TYPE_NAME, checkTypeName);
65
         intent.putExtra(ScanResultActivity.LOCATION, longLat);
68
         intent.putExtra(ScanResultActivity.LOCATION, longLat);
66
         startActivityForResult(intent, 1);
69
         startActivityForResult(intent, 1);
67
     }
70
     }
@@ -101,8 +104,7 @@ public class ScanActivity extends LFScanProcessing {
101
                 double latitude = location.getLatitude();
104
                 double latitude = location.getLatitude();
102
                 double longitude = location.getLongitude();
105
                 double longitude = location.getLongitude();
103
                 longLat = longitude + "," + latitude;
106
                 longLat = longitude + "," + latitude;
104
-                System.out.println("DEVELOPER Location : " + location.getLatitude() + " , " + location.getLongitude());
105
-                System.out.println("DEVELOPER Location : " + longLat);
107
+                Timber.d("DEVELOPER Location : " + location.getLatitude() + " , " + location.getLongitude());
106
             }
108
             }
107
         });
109
         });
108
     }
110
     }

+ 5 - 3
app/src/main/java/com/fusi24/rfid/ui/home/HomeActivity.java

@@ -49,7 +49,7 @@ public class HomeActivity extends BaseActivity implements StatusScanAdapter.OnIt
49
     private ActivityHomeBinding binding;
49
     private ActivityHomeBinding binding;
50
     private StatusScanAdapter adapter;
50
     private StatusScanAdapter adapter;
51
     private Integer idCheckType = null;
51
     private Integer idCheckType = null;
52
-    private String idDevice;
52
+    private String idDevice, checkTypeName;
53
 
53
 
54
     @Override
54
     @Override
55
     protected void onCreate(Bundle savedInstanceState) {
55
     protected void onCreate(Bundle savedInstanceState) {
@@ -161,6 +161,7 @@ public class HomeActivity extends BaseActivity implements StatusScanAdapter.OnIt
161
             intent.putExtra(ScanActivity.ID_PERMIT, String.valueOf(dataEntryPermit.getId()));
161
             intent.putExtra(ScanActivity.ID_PERMIT, String.valueOf(dataEntryPermit.getId()));
162
             intent.putExtra(ScanActivity.ID_DEVICE, idDevice);
162
             intent.putExtra(ScanActivity.ID_DEVICE, idDevice);
163
             intent.putExtra(ScanActivity.ID_CHECK_TYPE, idCheckType);
163
             intent.putExtra(ScanActivity.ID_CHECK_TYPE, idCheckType);
164
+            intent.putExtra(ScanActivity.CHECK_TYPE_NAME, checkTypeName);
164
             startActivity(intent);
165
             startActivity(intent);
165
         });
166
         });
166
 
167
 
@@ -219,7 +220,8 @@ public class HomeActivity extends BaseActivity implements StatusScanAdapter.OnIt
219
     }
220
     }
220
 
221
 
221
     @Override
222
     @Override
222
-    public void onSelected(Integer idStatus) {
223
-        this.idCheckType = idStatus;
223
+    public void onSelected(DataDetail detail) {
224
+        idCheckType = detail.getId();
225
+        checkTypeName = detail.getName();
224
     }
226
     }
225
 }
227
 }

+ 3 - 1
app/src/main/java/com/fusi24/rfid/ui/scanresult/ScanResultActivity.java

@@ -30,12 +30,13 @@ public class ScanResultActivity extends BaseActivity implements ScanResultView {
30
     public static final String ID_PERMIT = "id_permit";
30
     public static final String ID_PERMIT = "id_permit";
31
     public static final String ID_DEVICE = "id_device";
31
     public static final String ID_DEVICE = "id_device";
32
     public static final String ID_CHECK_TYPE = "id_check_type";
32
     public static final String ID_CHECK_TYPE = "id_check_type";
33
+    public static final String CHECK_TYPE_NAME = "check_type_name";
33
     public static final String LOCATION = "location";
34
     public static final String LOCATION = "location";
34
 
35
 
35
     private ScanResultPresenter presenter;
36
     private ScanResultPresenter presenter;
36
     private ScanResultAdapter adapter;
37
     private ScanResultAdapter adapter;
37
     private List<DataProblems> problemsList;
38
     private List<DataProblems> problemsList;
38
-    private String dataUrl, numberRfid, numberRfidTemp, idPermit, idDevice, idCheckType, longLat;
39
+    private String dataUrl, numberRfid, numberRfidTemp, idPermit, idDevice, idCheckType, checkTypeName, longLat;
39
     private ActivityScanResultBinding binding;
40
     private ActivityScanResultBinding binding;
40
 
41
 
41
     @Override
42
     @Override
@@ -54,6 +55,7 @@ public class ScanResultActivity extends BaseActivity implements ScanResultView {
54
             idPermit = getIntent().getStringExtra(ID_PERMIT);
55
             idPermit = getIntent().getStringExtra(ID_PERMIT);
55
             idDevice = getIntent().getStringExtra(ID_DEVICE);
56
             idDevice = getIntent().getStringExtra(ID_DEVICE);
56
             idCheckType = getIntent().getStringExtra(ID_CHECK_TYPE);
57
             idCheckType = getIntent().getStringExtra(ID_CHECK_TYPE);
58
+            checkTypeName = getIntent().getStringExtra(CHECK_TYPE_NAME);
57
             longLat = getIntent().getStringExtra(LOCATION);
59
             longLat = getIntent().getStringExtra(LOCATION);
58
         }
60
         }
59
 
61