Procházet zdrojové kódy

-Parsing change from integer to object

ilhamitubagoes před 4 roky
rodič
revize
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 45
             View.OnClickListener listener = v -> {
46 46
                 selectedItem = getAdapterPosition();
47
-                onItemSelected.onSelected(detailList.get(getAdapterPosition()).getId());
47
+                onItemSelected.onSelected(detailList.get(getAdapterPosition()));
48 48
                 notifyDataSetChanged();
49 49
             };
50 50
 
@@ -74,7 +74,7 @@ public class StatusScanAdapter extends RecyclerView.Adapter<StatusScanAdapter.Vi
74 74
     }
75 75
 
76 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 22
     public static final String ID_PERMIT = "id_permit";
23 23
     public static final String ID_DEVICE = "id_device";
24 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 28
     private ActivityScanBinding binding;
28 29
     private FusedLocationProviderClient locationClient;
29 30
 
@@ -42,6 +43,7 @@ public class ScanActivity extends LFScanProcessing {
42 43
             idPermit = getIntent().getExtras().getString(ID_PERMIT);
43 44
             idDevice = getIntent().getExtras().getString(ID_DEVICE);
44 45
             idCheckType = String.valueOf(getIntent().getExtras().getInt(ID_CHECK_TYPE));
46
+            checkTypeName = getIntent().getExtras().getString(CHECK_TYPE_NAME);
45 47
         }
46 48
 
47 49
         locationClient = LocationServices.getFusedLocationProviderClient(this);
@@ -62,6 +64,7 @@ public class ScanActivity extends LFScanProcessing {
62 64
         intent.putExtra(ScanResultActivity.ID_PERMIT, idPermit);
63 65
         intent.putExtra(ScanResultActivity.ID_DEVICE, idDevice);
64 66
         intent.putExtra(ScanResultActivity.ID_CHECK_TYPE, idCheckType);
67
+        intent.putExtra(ScanResultActivity.CHECK_TYPE_NAME, checkTypeName);
65 68
         intent.putExtra(ScanResultActivity.LOCATION, longLat);
66 69
         startActivityForResult(intent, 1);
67 70
     }
@@ -101,8 +104,7 @@ public class ScanActivity extends LFScanProcessing {
101 104
                 double latitude = location.getLatitude();
102 105
                 double longitude = location.getLongitude();
103 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 49
     private ActivityHomeBinding binding;
50 50
     private StatusScanAdapter adapter;
51 51
     private Integer idCheckType = null;
52
-    private String idDevice;
52
+    private String idDevice, checkTypeName;
53 53
 
54 54
     @Override
55 55
     protected void onCreate(Bundle savedInstanceState) {
@@ -161,6 +161,7 @@ public class HomeActivity extends BaseActivity implements StatusScanAdapter.OnIt
161 161
             intent.putExtra(ScanActivity.ID_PERMIT, String.valueOf(dataEntryPermit.getId()));
162 162
             intent.putExtra(ScanActivity.ID_DEVICE, idDevice);
163 163
             intent.putExtra(ScanActivity.ID_CHECK_TYPE, idCheckType);
164
+            intent.putExtra(ScanActivity.CHECK_TYPE_NAME, checkTypeName);
164 165
             startActivity(intent);
165 166
         });
166 167
 
@@ -219,7 +220,8 @@ public class HomeActivity extends BaseActivity implements StatusScanAdapter.OnIt
219 220
     }
220 221
 
221 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 30
     public static final String ID_PERMIT = "id_permit";
31 31
     public static final String ID_DEVICE = "id_device";
32 32
     public static final String ID_CHECK_TYPE = "id_check_type";
33
+    public static final String CHECK_TYPE_NAME = "check_type_name";
33 34
     public static final String LOCATION = "location";
34 35
 
35 36
     private ScanResultPresenter presenter;
36 37
     private ScanResultAdapter adapter;
37 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 40
     private ActivityScanResultBinding binding;
40 41
 
41 42
     @Override
@@ -54,6 +55,7 @@ public class ScanResultActivity extends BaseActivity implements ScanResultView {
54 55
             idPermit = getIntent().getStringExtra(ID_PERMIT);
55 56
             idDevice = getIntent().getStringExtra(ID_DEVICE);
56 57
             idCheckType = getIntent().getStringExtra(ID_CHECK_TYPE);
58
+            checkTypeName = getIntent().getStringExtra(CHECK_TYPE_NAME);
57 59
             longLat = getIntent().getStringExtra(LOCATION);
58 60
         }
59 61