Просмотр исходного кода

-Add latitude and longitude for check rfid

ilhamitubagoes лет назад: 4
Родитель
Сommit
3c11ba36cf

+ 3 - 0
app/build.gradle

@@ -46,6 +46,9 @@ dependencies {
46 46
     implementation "androidx.recyclerview:recyclerview:1.1.0"
47 47
     implementation "com.google.android.material:material:1.1.0"
48 48
 
49
+    //GMS Play Service
50
+    implementation 'com.google.android.gms:play-services-location:17.0.0'
51
+
49 52
     //Timber
50 53
     implementation 'com.jakewharton.timber:timber:4.7.1'
51 54
 

+ 3 - 7
app/src/main/AndroidManifest.xml

@@ -2,6 +2,8 @@
2 2
 <manifest xmlns:android="http://schemas.android.com/apk/res/android"
3 3
     package="com.fusi24.rfid">
4 4
 
5
+    <uses-permission android:name="android.permission.ACCESS_COARSE_LOCATION" />
6
+    <uses-permission android:name="android.permission.ACCESS_FINE_LOCATION" />
5 7
     <uses-permission android:name="android.permission.INTERNET" />
6 8
     <uses-permission android:name="android.permission.READ_PHONE_STATE"/>
7 9
 
@@ -11,8 +13,7 @@
11 13
         android:label="@string/app_name"
12 14
         android:roundIcon="@drawable/logo_hse_autimation"
13 15
         android:supportsRtl="true"
14
-        android:theme="@style/AppTheme"
15
-        android:fullBackupContent="">
16
+        android:theme="@style/AppTheme">
16 17
         <activity
17 18
             android:name=".SplashScreenActivity"
18 19
             android:screenOrientation="fullSensor"
@@ -28,11 +29,6 @@
28 29
             android:theme="@style/Theme.AppCompat.Light.NoActionBar">
29 30
         </activity>
30 31
         <activity
31
-            android:name=".MainActivity"
32
-            android:screenOrientation="portrait"
33
-            android:theme="@style/Theme.AppCompat.Light.NoActionBar">
34
-        </activity>
35
-        <activity
36 32
             android:name=".ui.home.HomeActivity"
37 33
             android:screenOrientation="portrait"
38 34
             android:theme="@style/Theme.AppCompat.Light.NoActionBar">

+ 0 - 165
app/src/main/java/com/fusi24/rfid/MainActivity.java

@@ -1,165 +0,0 @@
1
-package com.fusi24.rfid;
2
-
3
-import android.annotation.SuppressLint;
4
-import android.content.Intent;
5
-import android.os.Build;
6
-import android.os.Bundle;
7
-import android.view.View;
8
-import android.widget.AdapterView;
9
-import android.widget.ArrayAdapter;
10
-import android.widget.Toast;
11
-
12
-import com.fusi24.rfid.base.BaseActivity;
13
-import com.fusi24.rfid.config.Constant;
14
-import com.fusi24.rfid.data.api.RestService;
15
-import com.fusi24.rfid.data.api.RestServiceFactory;
16
-import com.fusi24.rfid.data.entity.DataEntryPermit;
17
-import com.fusi24.rfid.data.entity.DataSite;
18
-import com.fusi24.rfid.databinding.ActivityMainBinding;
19
-import com.fusi24.rfid.ui.ScanActivity;
20
-
21
-import org.jetbrains.annotations.NotNull;
22
-
23
-import java.util.ArrayList;
24
-import java.util.List;
25
-
26
-import retrofit2.Call;
27
-import retrofit2.Callback;
28
-import retrofit2.Response;
29
-import timber.log.Timber;
30
-
31
-public class MainActivity extends BaseActivity {
32
-
33
-    private DataSite dataSite;
34
-    private DataEntryPermit dataEntryPermit;
35
-    private List<DataSite> siteList;
36
-    private List<DataEntryPermit> entryPermitList;
37
-    private ActivityMainBinding binding;
38
-
39
-    @SuppressLint("SetTextI18n")
40
-    @Override
41
-    protected void onCreate(Bundle savedInstanceState) {
42
-        super.onCreate(savedInstanceState);
43
-        binding = ActivityMainBinding.inflate(getLayoutInflater());
44
-        View view = binding.getRoot();
45
-        setContentView(view);
46
-
47
-        dataSite = new DataSite();
48
-        dataEntryPermit = new DataEntryPermit();
49
-
50
-        siteList = new ArrayList<>();
51
-        entryPermitList = new ArrayList<>();
52
-
53
-        binding.tvBebas.setText(Build.DEVICE + " " + Build.ID + " " + Build.HARDWARE + " " + Build.MANUFACTURER + " " + Build.TYPE + " " + Build.HOST);
54
-
55
-        getDataSite();
56
-        getDataPermit();
57
-    }
58
-
59
-    @Override
60
-    protected void onResume() {
61
-        super.onResume();
62
-        initEvent();
63
-
64
-    }
65
-
66
-    private void getDataSite() {
67
-        RestService restService = RestServiceFactory.create(Constant.JWT_TOKEN);
68
-        Call<List<DataSite>> call = restService.getDataSite(100);
69
-        call.enqueue(new Callback<List<DataSite>>() {
70
-            @Override
71
-            public void onResponse(@NotNull Call<List<DataSite>> call, @NotNull Response<List<DataSite>> response) {
72
-                if (response.body() != null){
73
-                    siteList.addAll(response.body());
74
-                    setDataSite();
75
-                }
76
-            }
77
-
78
-            @Override
79
-            public void onFailure(@NotNull Call<List<DataSite>> call, @NotNull Throwable t) {
80
-                Toast.makeText(MainActivity.this, "Failed to get data site", Toast.LENGTH_SHORT).show();
81
-            }
82
-        });
83
-    }
84
-
85
-    private void getDataPermit() {
86
-        RestService restService = RestServiceFactory.create(Constant.JWT_TOKEN);
87
-        Call<List<DataEntryPermit>> call = restService.getEntryPermit();
88
-        call.enqueue(new Callback<List<DataEntryPermit>>() {
89
-            @Override
90
-            public void onResponse(@NotNull Call<List<DataEntryPermit>> call, @NotNull Response<List<DataEntryPermit>> response) {
91
-                if (response.body() != null) {
92
-                    entryPermitList.addAll(response.body());
93
-                    setDataPermit();
94
-                }
95
-            }
96
-
97
-            @Override
98
-            public void onFailure(@NotNull Call<List<DataEntryPermit>> call, @NotNull Throwable t) {
99
-                Toast.makeText(MainActivity.this, "Failed to get data permit", Toast.LENGTH_SHORT).show();
100
-                Timber.i("DEVELOPER : %s", t.getMessage());
101
-            }
102
-        });
103
-    }
104
-
105
-    private void setDataSite(){
106
-        ArrayAdapter<DataSite> adapter = new ArrayAdapter<>(this, android.R.layout.simple_spinner_dropdown_item, siteList);
107
-        binding.spinnerSite.setAdapter(adapter);
108
-    }
109
-
110
-    private void setDataPermit(){
111
-        ArrayAdapter<DataEntryPermit> adapter = new ArrayAdapter<>(this, android.R.layout.simple_spinner_dropdown_item, entryPermitList);
112
-        binding.spinnerPermit.setAdapter(adapter);
113
-    }
114
-
115
-    private void initEvent(){
116
-
117
-        binding.spinnerSite.setOnItemSelectedListener(new AdapterView.OnItemSelectedListener() {
118
-            @Override
119
-            public void onItemSelected(AdapterView<?> parent, View view, int position, long id) {
120
-                dataSite = (DataSite) parent.getItemAtPosition(position);
121
-            }
122
-
123
-            @Override
124
-            public void onNothingSelected(AdapterView<?> parent) {
125
-                dataSite = (DataSite) parent.getSelectedItem();
126
-            }
127
-        });
128
-
129
-        binding.spinnerPermit.setOnItemSelectedListener(new AdapterView.OnItemSelectedListener() {
130
-            @Override
131
-            public void onItemSelected(AdapterView<?> parent, View view, int position, long id) {
132
-                dataEntryPermit = (DataEntryPermit) parent.getItemAtPosition(position);
133
-            }
134
-
135
-            @Override
136
-            public void onNothingSelected(AdapterView<?> parent) {
137
-                dataEntryPermit = (DataEntryPermit) parent.getSelectedItem();
138
-            }
139
-        });
140
-
141
-        binding.btnScan.setOnClickListener(v -> {
142
-
143
-            if (binding.spinnerSite.getSelectedItem() == null){
144
-                Toast.makeText(this, "Data Site Belum Terpilih", Toast.LENGTH_SHORT).show();
145
-                return;
146
-            }
147
-
148
-            if (binding.spinnerPermit.getSelectedItem() == null){
149
-                Toast.makeText(this, "Data Permit Belum Terpilih", Toast.LENGTH_SHORT).show();
150
-                return;
151
-            }
152
-
153
-            Intent intent = new Intent(this, ScanActivity.class);
154
-            intent.putExtra(ScanActivity.ID_SITE, String.valueOf(dataSite.getId()));
155
-            intent.putExtra(ScanActivity.ID_PERMIT, String.valueOf(dataEntryPermit.getId()));
156
-            startActivity(intent);
157
-        });
158
-    }
159
-
160
-    @Override
161
-    protected void onDestroy() {
162
-        super.onDestroy();
163
-        binding = null;
164
-    }
165
-}

+ 9 - 0
app/src/main/java/com/fusi24/rfid/config/Constant.java

@@ -1,7 +1,16 @@
1 1
 package com.fusi24.rfid.config;
2 2
 
3
+import android.Manifest;
4
+
3 5
 public final class Constant {
4 6
 
7
+    /*__________________________________ACCESS_PERMISSION_________________________________________________*/
8
+
9
+    public static final String[] PERMISSIONS_RFID = new String[]{
10
+            Manifest.permission.ACCESS_FINE_LOCATION,
11
+            Manifest.permission.ACCESS_COARSE_LOCATION
12
+    };
13
+
5 14
     /*===================================================================================================*/
6 15
 
7 16
     public static final String JWT_TOKEN = "eyJhbGciOiJIUzI1NiJ9.eyJpZEthcnlhd2FuIjo0Mzg4NCwiaWQiOjIsImVtYWlsIjoiYXJpZi53aWR5YUBiZXJhdWNvYWwuY28uaWQiLCJ1c2VybmFtZSI6IkxTREVWIn0.ZgYBPYZgx5CdJAMm29T6_0Es5C199PULqOfwMwdGFz8";

+ 2 - 2
app/src/main/java/com/fusi24/rfid/data/DataManager.java

@@ -19,8 +19,8 @@ public class DataManager {
19 19
         return restService.userLogin(dataAuth);
20 20
     }
21 21
 
22
-    public Observable<DataResultRfid> checkRfidCard(String numberRfid, Integer permitId, Integer siteId, String[] expand) {
23
-        return restService.checkRfidCard(numberRfid, permitId, siteId, expand);
22
+    public Observable<DataResultRfid> checkRfidCard(String numberRfid, Integer permitId, String rfidDeviceId, Integer checkTypeId, String longLat, String[] expand) {
23
+        return restService.checkRfidCard(numberRfid, permitId, rfidDeviceId, checkTypeId, longLat, expand);
24 24
     }
25 25
 
26 26
 }

+ 3 - 1
app/src/main/java/com/fusi24/rfid/data/api/RestService.java

@@ -34,8 +34,10 @@ public interface RestService {
34 34
 
35 35
     @GET(Constant.SID2_ENDPOINT + Constant.RFID_ENDPOINT + "/permit/check/{number_rfid}")
36 36
     Observable<DataResultRfid> checkRfidCard(@Path("number_rfid") String numberRfid,
37
-                                             @Query("siteId") Integer siteId,
38 37
                                              @Query("entryPermitId") Integer permitId,
38
+                                             @Query("rfidDeviceId") String rfidDeviceId,
39
+                                             @Query("checkTypeId") Integer checkTypeId,
40
+                                             @Query("longLat") String longLat,
39 41
                                              @Query("expand") String[] expand);
40 42
 
41 43
 }

+ 35 - 6
app/src/main/java/com/fusi24/rfid/ui/ScanActivity.java

@@ -1,23 +1,31 @@
1 1
 package com.fusi24.rfid.ui;
2 2
 
3
+import android.Manifest;
3 4
 import android.content.Intent;
5
+import android.content.pm.PackageManager;
4 6
 import android.os.Bundle;
5 7
 import android.view.View;
6 8
 
9
+import androidx.core.app.ActivityCompat;
10
+
11
+import com.fusi24.rfid.config.Constant;
7 12
 import com.fusi24.rfid.databinding.ActivityScanBinding;
8 13
 import com.fusi24.rfid.ui.scanresult.ScanResultActivity;
9 14
 import com.fusi24.rfid.util.LFScanProcessing;
15
+import com.google.android.gms.location.FusedLocationProviderClient;
16
+import com.google.android.gms.location.LocationServices;
10 17
 
11 18
 import timber.log.Timber;
12 19
 
13 20
 public class ScanActivity extends LFScanProcessing {
14 21
 
15
-    public static final String ID_SITE = "id_site";
16 22
     public static final String ID_PERMIT = "id_permit";
23
+    public static final String ID_DEVICE = "id_device";
24
+    public static final String ID_CHECK_TYPE = "id_check_type";
17 25
 
18
-    private String idSite;
19
-    private String idPermit;
26
+    private String idPermit, idDevice, idCheckType, longLat;
20 27
     private ActivityScanBinding binding;
28
+    private FusedLocationProviderClient locationClient;
21 29
 
22 30
     @Override
23 31
     protected void onCreate(Bundle savedInstanceState) {
@@ -31,10 +39,13 @@ public class ScanActivity extends LFScanProcessing {
31 39
 
32 40
     private void initView() {
33 41
         if (getIntent().getExtras() != null){
34
-            idSite = getIntent().getExtras().getString(ID_SITE);
35 42
             idPermit = getIntent().getExtras().getString(ID_PERMIT);
43
+            idDevice = getIntent().getExtras().getString(ID_DEVICE);
44
+            idCheckType = String.valueOf(getIntent().getExtras().getInt(ID_CHECK_TYPE));
36 45
         }
37 46
 
47
+        locationClient = LocationServices.getFusedLocationProviderClient(this);
48
+        getLocation();
38 49
         binding.toggleScan.setOnCheckedChangeListener((buttonView, isChecked) -> statusScanner());
39 50
     }
40 51
 
@@ -47,9 +58,11 @@ public class ScanActivity extends LFScanProcessing {
47 58
 
48 59
     void startInstance(String rfidCardNumber){
49 60
         Intent intent = new Intent(this, ScanResultActivity.class);
50
-        intent.putExtra(ScanResultActivity.ID_SITE, idSite);
51
-        intent.putExtra(ScanResultActivity.ID_PERMIT, idPermit);
52 61
         intent.putExtra(ScanResultActivity.RFID_CARD_NUMBER, rfidCardNumber);
62
+        intent.putExtra(ScanResultActivity.ID_PERMIT, idPermit);
63
+        intent.putExtra(ScanResultActivity.ID_DEVICE, idDevice);
64
+        intent.putExtra(ScanResultActivity.ID_CHECK_TYPE, idCheckType);
65
+        intent.putExtra(ScanResultActivity.LOCATION, longLat);
53 66
         startActivityForResult(intent, 1);
54 67
     }
55 68
 
@@ -78,6 +91,22 @@ public class ScanActivity extends LFScanProcessing {
78 91
         });
79 92
     }
80 93
 
94
+    private void getLocation() {
95
+        if (ActivityCompat.checkSelfPermission(this, Manifest.permission.ACCESS_FINE_LOCATION) != PackageManager.PERMISSION_GRANTED && ActivityCompat.checkSelfPermission(this, Manifest.permission.ACCESS_COARSE_LOCATION) != PackageManager.PERMISSION_GRANTED) {
96
+            ActivityCompat.requestPermissions(this, Constant.PERMISSIONS_RFID, 1000);
97
+            return;
98
+        }
99
+        locationClient.getLastLocation().addOnSuccessListener(this, location -> {
100
+            if (location != null){
101
+                double latitude = location.getLatitude();
102
+                double longitude = location.getLongitude();
103
+                longLat = longitude + "," + latitude;
104
+                System.out.println("DEVELOPER Location : " + location.getLatitude() + " , " + location.getLongitude());
105
+                System.out.println("DEVELOPER Location : " + longLat);
106
+            }
107
+        });
108
+    }
109
+
81 110
     @Override
82 111
     protected void onDestroy() {
83 112
         super.onDestroy();

+ 11 - 6
app/src/main/java/com/fusi24/rfid/ui/home/HomeActivity.java

@@ -14,6 +14,7 @@ import android.widget.Toast;
14 14
 
15 15
 import androidx.annotation.NonNull;
16 16
 import androidx.appcompat.widget.Toolbar;
17
+import androidx.core.app.ActivityCompat;
17 18
 import androidx.recyclerview.widget.DefaultItemAnimator;
18 19
 import androidx.recyclerview.widget.LinearLayoutManager;
19 20
 
@@ -47,7 +48,8 @@ public class HomeActivity extends BaseActivity implements StatusScanAdapter.OnIt
47 48
     private List<DataDetail> statusScanList;
48 49
     private ActivityHomeBinding binding;
49 50
     private StatusScanAdapter adapter;
50
-    private Integer idStatus = null;
51
+    private Integer idCheckType = null;
52
+    private String idDevice;
51 53
 
52 54
     @Override
53 55
     protected void onCreate(Bundle savedInstanceState) {
@@ -107,6 +109,8 @@ public class HomeActivity extends BaseActivity implements StatusScanAdapter.OnIt
107 109
     }
108 110
 
109 111
     private void initView(){
112
+        ActivityCompat.requestPermissions(this, Constant.PERMISSIONS_RFID, 1000);
113
+
110 114
         entryPermitList = new ArrayList<>();
111 115
         statusScanList = new ArrayList<>();
112 116
 
@@ -118,7 +122,8 @@ public class HomeActivity extends BaseActivity implements StatusScanAdapter.OnIt
118 122
 
119 123
     @SuppressLint("SetTextI18n")
120 124
     private void loadingData(){
121
-        binding.tvRfidGunId.setText("RFID-" + Build.ID + "-" + Build.DEVICE);
125
+        idDevice = "RFID-" + Build.ID + "-" + Build.DEVICE;
126
+        binding.tvRfidGunId.setText(idDevice);
122 127
         binding.tvRfidCardNumber.setText(getSessionManager().getUserRfidNumber());
123 128
         binding.tvEmployeeName.setText(getSessionManager().getEmployeeName());
124 129
         //TODO STILL HARDCODE
@@ -147,13 +152,15 @@ public class HomeActivity extends BaseActivity implements StatusScanAdapter.OnIt
147 152
                 return;
148 153
             }
149 154
 
150
-            if (idStatus == null){
155
+            if (idCheckType == null){
151 156
                 Toast.makeText(this, "Status Scan Belum Terpilih", Toast.LENGTH_SHORT).show();
152 157
                 return;
153 158
             }
154 159
 
155 160
             Intent intent = new Intent(this, ScanActivity.class);
156 161
             intent.putExtra(ScanActivity.ID_PERMIT, String.valueOf(dataEntryPermit.getId()));
162
+            intent.putExtra(ScanActivity.ID_DEVICE, idDevice);
163
+            intent.putExtra(ScanActivity.ID_CHECK_TYPE, idCheckType);
157 164
             startActivity(intent);
158 165
         });
159 166
 
@@ -213,8 +220,6 @@ public class HomeActivity extends BaseActivity implements StatusScanAdapter.OnIt
213 220
 
214 221
     @Override
215 222
     public void onSelected(Integer idStatus) {
216
-        this.idStatus = idStatus;
217
-        Timber.tag(HomeActivity.class.getName()).d("DEVELOPER idStatus : %s", idStatus);
218
-        Toast.makeText(this, idStatus.toString(), Toast.LENGTH_SHORT).show();
223
+        this.idCheckType = idStatus;
219 224
     }
220 225
 }

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

@@ -11,7 +11,6 @@ import androidx.recyclerview.widget.DividerItemDecoration;
11 11
 import androidx.recyclerview.widget.LinearLayoutManager;
12 12
 
13 13
 import com.bumptech.glide.Glide;
14
-import com.fusi24.rfid.MainActivity;
15 14
 import com.fusi24.rfid.R;
16 15
 import com.fusi24.rfid.adapter.ScanResultAdapter;
17 16
 import com.fusi24.rfid.base.BaseActivity;
@@ -19,6 +18,7 @@ import com.fusi24.rfid.config.Constant;
19 18
 import com.fusi24.rfid.data.entity.DataProblems;
20 19
 import com.fusi24.rfid.data.entity.DataResultRfid;
21 20
 import com.fusi24.rfid.databinding.ActivityScanResultBinding;
21
+import com.fusi24.rfid.ui.home.HomeActivity;
22 22
 
23 23
 import java.util.ArrayList;
24 24
 import java.util.List;
@@ -26,18 +26,16 @@ import java.util.Locale;
26 26
 
27 27
 public class ScanResultActivity extends BaseActivity implements ScanResultView {
28 28
 
29
-    public static final String ID_SITE = "id_site";
30
-    public static final String ID_PERMIT = "id_permit";
31 29
     public static final String RFID_CARD_NUMBER = "rfid_card_number";
30
+    public static final String ID_PERMIT = "id_permit";
31
+    public static final String ID_DEVICE = "id_device";
32
+    public static final String ID_CHECK_TYPE = "id_check_type";
33
+    public static final String LOCATION = "location";
32 34
 
33 35
     private ScanResultPresenter presenter;
34 36
     private ScanResultAdapter adapter;
35 37
     private List<DataProblems> problemsList;
36
-    private String dataUrl;
37
-    private String idSite;
38
-    private String idPermit;
39
-    private String numberRfid;
40
-    private String numberRfidTemp;
38
+    private String dataUrl, numberRfid, numberRfidTemp, idPermit, idDevice, idCheckType, longLat;
41 39
     private ActivityScanResultBinding binding;
42 40
 
43 41
     @Override
@@ -51,19 +49,21 @@ public class ScanResultActivity extends BaseActivity implements ScanResultView {
51 49
                 getManager(), getAndroidScheduler(), getProcessScheduler());
52 50
         presenter.attachView(this);
53 51
 
54
-        if (getIntent() != null){
55
-            idSite = getIntent().getStringExtra(ID_SITE);
56
-            idPermit = getIntent().getStringExtra(ID_PERMIT);
52
+        if (getIntent() != null) {
57 53
             numberRfidTemp = getIntent().getStringExtra(RFID_CARD_NUMBER);
54
+            idPermit = getIntent().getStringExtra(ID_PERMIT);
55
+            idDevice = getIntent().getStringExtra(ID_DEVICE);
56
+            idCheckType = getIntent().getStringExtra(ID_CHECK_TYPE);
57
+            longLat = getIntent().getStringExtra(LOCATION);
58 58
         }
59 59
 
60 60
         // Setting digit rfid card using MAX_NUMBER = 10
61 61
         /* FORMAT "%010d"
62
-        * % ==> used as formatter, 0 ==> used to pad with zeroes instead of spaces
63
-        * 10 ==> maximum of 10 characters wide
64
-        * d ==> as a decimal integer */
65
-        if (numberRfidTemp != null){
66
-            if (numberRfidTemp.length() < 10){
62
+         * % ==> used as formatter, 0 ==> used to pad with zeroes instead of spaces
63
+         * 10 ==> maximum of 10 characters wide
64
+         * d ==> as a decimal integer */
65
+        if (numberRfidTemp != null) {
66
+            if (numberRfidTemp.length() < 10) {
67 67
                 numberRfid = String.format(Locale.getDefault(), "%010d", Integer.valueOf(numberRfidTemp));
68 68
             } else {
69 69
                 numberRfid = numberRfidTemp;
@@ -76,7 +76,7 @@ public class ScanResultActivity extends BaseActivity implements ScanResultView {
76 76
     }
77 77
 
78 78
     @SuppressLint("SetTextI18n")
79
-    private void initView(){
79
+    private void initView() {
80 80
         binding.tvRfidNumber.setText("Nomor RFID : " + numberRfid);
81 81
 
82 82
         problemsList = new ArrayList<>();
@@ -89,15 +89,15 @@ public class ScanResultActivity extends BaseActivity implements ScanResultView {
89 89
         binding.rvDocumentProblem.setAdapter(adapter);
90 90
     }
91 91
 
92
-    private void loadingdata(){
92
+    private void loadingdata() {
93 93
         problemsList.clear();
94 94
         String[] expand = {"employee.company, employee.structuralPosition, employee.functionalPosition"};
95
-        presenter.checkRfidCard(numberRfid, Integer.valueOf(idPermit), Integer.valueOf(idSite), expand);
95
+        presenter.checkRfidCard(numberRfid, Integer.valueOf(idPermit), idDevice, Integer.valueOf(idCheckType), longLat, expand);
96 96
     }
97 97
 
98
-    private void initEvent(){
98
+    private void initEvent() {
99 99
         binding.btnHome.setOnClickListener(v -> {
100
-            final Intent intent = new Intent(this, MainActivity.class);
100
+            final Intent intent = new Intent(this, HomeActivity.class);
101 101
             intent.setFlags(Intent.FLAG_ACTIVITY_CLEAR_TOP);
102 102
             startActivity(intent);
103 103
         });
@@ -108,7 +108,7 @@ public class ScanResultActivity extends BaseActivity implements ScanResultView {
108 108
     @Override
109 109
     public void showDataRfid(DataResultRfid dataResultRfid) {
110 110
 
111
-        if (dataResultRfid.getEmployee() != null){
111
+        if (dataResultRfid.getEmployee() != null) {
112 112
             dataUrl = Constant.URL_PHOTO + dataResultRfid.getEmployee().getUrlPhoto().substring(14);
113 113
 
114 114
             binding.tvProfileName.setText(dataResultRfid.getEmployee().getName());
@@ -128,17 +128,17 @@ public class ScanResultActivity extends BaseActivity implements ScanResultView {
128 128
                 .error(R.drawable.ic_profile_default)
129 129
                 .into(binding.ivProfileImage);
130 130
 
131
-        if (dataResultRfid.getPassed()){
131
+        if (dataResultRfid.getPassed()) {
132 132
             binding.tvProfileStatus.setText(R.string.label_status_passed);
133 133
             binding.llProfileStatus.setBackgroundColor(getResources().getColor(R.color.colorPrimary));
134 134
         } else {
135
-            if (dataResultRfid.getAlertType() != null){
136
-                if (dataResultRfid.getAlertType().equalsIgnoreCase("ERROR")){
135
+            if (dataResultRfid.getAlertType() != null) {
136
+                if (dataResultRfid.getAlertType().equalsIgnoreCase("ERROR")) {
137 137
                     binding.tvProfileStatus.setText(R.string.label_status_not_passed);
138 138
                     binding.llProfileStatus.setBackgroundColor(getResources().getColor(R.color.colorRedDark));
139 139
                 }
140 140
 
141
-                if (dataResultRfid.getAlertType().equalsIgnoreCase("WARNING")){
141
+                if (dataResultRfid.getAlertType().equalsIgnoreCase("WARNING")) {
142 142
                     binding.tvProfileStatus.setText(R.string.label_status_not_valid);
143 143
                     binding.llProfileStatus.setBackgroundColor(getResources().getColor(R.color.colorRedDark));
144 144
                 }
@@ -149,7 +149,7 @@ public class ScanResultActivity extends BaseActivity implements ScanResultView {
149 149
             }
150 150
         }
151 151
 
152
-        if (dataResultRfid.getMessage() != null){
152
+        if (dataResultRfid.getMessage() != null) {
153 153
             Toast.makeText(this, dataResultRfid.getMessage(), Toast.LENGTH_SHORT).show();
154 154
         }
155 155
 

+ 2 - 2
app/src/main/java/com/fusi24/rfid/ui/scanresult/ScanResultPresenter.java

@@ -18,8 +18,8 @@ class ScanResultPresenter extends BasePresenter<ScanResultView> {
18 18
         this.processScheduler = processScheduler;
19 19
     }
20 20
 
21
-    void checkRfidCard(String numberRfid, Integer permitId, Integer siteId, String[] expand) {
22
-        disposable.add(manager.checkRfidCard(numberRfid, siteId, permitId, expand)
21
+    void checkRfidCard(String numberRfid, Integer permitId, String rfidDeviceId, Integer checkTypeId, String longLat, String[] expand) {
22
+        disposable.add(manager.checkRfidCard(numberRfid, permitId, rfidDeviceId, checkTypeId, longLat, expand)
23 23
                 .observeOn(androidScheduler)
24 24
                 .subscribeOn(processScheduler)
25 25
                 .subscribe(dataRfid -> {