Browse Source

-Migrasi ButterKnife ke View Binding (Android Jetpack)

ilhamitubagoes 4 years ago
parent
commit
3b18ce1fe0

+ 3 - 4
app/build.gradle

@@ -13,6 +13,9 @@ android {
13
         versionName gitVersionName
13
         versionName gitVersionName
14
         testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
14
         testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
15
     }
15
     }
16
+    viewBinding {
17
+        enabled = true
18
+    }
16
     signingConfigs {
19
     signingConfigs {
17
         release {
20
         release {
18
             keyAlias 'rfid-hse-fusi'
21
             keyAlias 'rfid-hse-fusi'
@@ -39,10 +42,6 @@ dependencies {
39
     implementation 'androidx.constraintlayout:constraintlayout:1.1.3'
42
     implementation 'androidx.constraintlayout:constraintlayout:1.1.3'
40
     implementation "androidx.recyclerview:recyclerview:1.1.0"
43
     implementation "androidx.recyclerview:recyclerview:1.1.0"
41
 
44
 
42
-    //BUTTER KNIFE
43
-    implementation 'com.jakewharton:butterknife:10.0.0'
44
-    annotationProcessor 'com.jakewharton:butterknife-compiler:10.0.0'
45
-
46
     //Timber
45
     //Timber
47
     implementation 'com.jakewharton.timber:timber:4.7.1'
46
     implementation 'com.jakewharton.timber:timber:4.7.1'
48
 
47
 

+ 17 - 20
app/src/main/java/com/fusi24/rfid/MainActivity.java

@@ -5,8 +5,6 @@ import android.os.Bundle;
5
 import android.view.View;
5
 import android.view.View;
6
 import android.widget.AdapterView;
6
 import android.widget.AdapterView;
7
 import android.widget.ArrayAdapter;
7
 import android.widget.ArrayAdapter;
8
-import android.widget.Button;
9
-import android.widget.Spinner;
10
 import android.widget.Toast;
8
 import android.widget.Toast;
11
 
9
 
12
 import com.fusi24.rfid.base.BaseActivity;
10
 import com.fusi24.rfid.base.BaseActivity;
@@ -15,6 +13,7 @@ import com.fusi24.rfid.data.api.RestService;
15
 import com.fusi24.rfid.data.api.RestServiceFactory;
13
 import com.fusi24.rfid.data.api.RestServiceFactory;
16
 import com.fusi24.rfid.data.entity.DataEntryPermit;
14
 import com.fusi24.rfid.data.entity.DataEntryPermit;
17
 import com.fusi24.rfid.data.entity.DataSite;
15
 import com.fusi24.rfid.data.entity.DataSite;
16
+import com.fusi24.rfid.databinding.ActivityMainBinding;
18
 import com.fusi24.rfid.ui.ScanActivity;
17
 import com.fusi24.rfid.ui.ScanActivity;
19
 
18
 
20
 import org.jetbrains.annotations.NotNull;
19
 import org.jetbrains.annotations.NotNull;
@@ -22,8 +21,6 @@ import org.jetbrains.annotations.NotNull;
22
 import java.util.ArrayList;
21
 import java.util.ArrayList;
23
 import java.util.List;
22
 import java.util.List;
24
 
23
 
25
-import butterknife.BindView;
26
-import butterknife.ButterKnife;
27
 import retrofit2.Call;
24
 import retrofit2.Call;
28
 import retrofit2.Callback;
25
 import retrofit2.Callback;
29
 import retrofit2.Response;
26
 import retrofit2.Response;
@@ -31,23 +28,18 @@ import timber.log.Timber;
31
 
28
 
32
 public class MainActivity extends BaseActivity {
29
 public class MainActivity extends BaseActivity {
33
 
30
 
34
-    @BindView(R.id.btn_scan)
35
-    Button btnScan;
36
-    @BindView(R.id.spinner_site)
37
-    Spinner spinnerSite;
38
-    @BindView(R.id.spinner_permit)
39
-    Spinner spinnerPermit;
40
-
41
     private DataSite dataSite;
31
     private DataSite dataSite;
42
     private DataEntryPermit dataEntryPermit;
32
     private DataEntryPermit dataEntryPermit;
43
     private List<DataSite> siteList;
33
     private List<DataSite> siteList;
44
     private List<DataEntryPermit> entryPermitList;
34
     private List<DataEntryPermit> entryPermitList;
35
+    private ActivityMainBinding binding;
45
 
36
 
46
     @Override
37
     @Override
47
     protected void onCreate(Bundle savedInstanceState) {
38
     protected void onCreate(Bundle savedInstanceState) {
48
         super.onCreate(savedInstanceState);
39
         super.onCreate(savedInstanceState);
49
-        setContentView(R.layout.activity_main);
50
-        ButterKnife.bind(this);
40
+        binding = ActivityMainBinding.inflate(getLayoutInflater());
41
+        View view = binding.getRoot();
42
+        setContentView(view);
51
 
43
 
52
         dataSite = new DataSite();
44
         dataSite = new DataSite();
53
         dataEntryPermit = new DataEntryPermit();
45
         dataEntryPermit = new DataEntryPermit();
@@ -107,17 +99,17 @@ public class MainActivity extends BaseActivity {
107
 
99
 
108
     private void setDataSite(){
100
     private void setDataSite(){
109
         ArrayAdapter<DataSite> adapter = new ArrayAdapter<>(this, android.R.layout.simple_spinner_dropdown_item, siteList);
101
         ArrayAdapter<DataSite> adapter = new ArrayAdapter<>(this, android.R.layout.simple_spinner_dropdown_item, siteList);
110
-        spinnerSite.setAdapter(adapter);
102
+        binding.spinnerSite.setAdapter(adapter);
111
     }
103
     }
112
 
104
 
113
     private void setDataPermit(){
105
     private void setDataPermit(){
114
         ArrayAdapter<DataEntryPermit> adapter = new ArrayAdapter<>(this, android.R.layout.simple_spinner_dropdown_item, entryPermitList);
106
         ArrayAdapter<DataEntryPermit> adapter = new ArrayAdapter<>(this, android.R.layout.simple_spinner_dropdown_item, entryPermitList);
115
-        spinnerPermit.setAdapter(adapter);
107
+        binding.spinnerPermit.setAdapter(adapter);
116
     }
108
     }
117
 
109
 
118
     private void initEvent(){
110
     private void initEvent(){
119
 
111
 
120
-        spinnerSite.setOnItemSelectedListener(new AdapterView.OnItemSelectedListener() {
112
+        binding.spinnerSite.setOnItemSelectedListener(new AdapterView.OnItemSelectedListener() {
121
             @Override
113
             @Override
122
             public void onItemSelected(AdapterView<?> parent, View view, int position, long id) {
114
             public void onItemSelected(AdapterView<?> parent, View view, int position, long id) {
123
                 dataSite = (DataSite) parent.getItemAtPosition(position);
115
                 dataSite = (DataSite) parent.getItemAtPosition(position);
@@ -129,7 +121,7 @@ public class MainActivity extends BaseActivity {
129
             }
121
             }
130
         });
122
         });
131
 
123
 
132
-        spinnerPermit.setOnItemSelectedListener(new AdapterView.OnItemSelectedListener() {
124
+        binding.spinnerPermit.setOnItemSelectedListener(new AdapterView.OnItemSelectedListener() {
133
             @Override
125
             @Override
134
             public void onItemSelected(AdapterView<?> parent, View view, int position, long id) {
126
             public void onItemSelected(AdapterView<?> parent, View view, int position, long id) {
135
                 dataEntryPermit = (DataEntryPermit) parent.getItemAtPosition(position);
127
                 dataEntryPermit = (DataEntryPermit) parent.getItemAtPosition(position);
@@ -141,14 +133,14 @@ public class MainActivity extends BaseActivity {
141
             }
133
             }
142
         });
134
         });
143
 
135
 
144
-        btnScan.setOnClickListener(v -> {
136
+        binding.btnScan.setOnClickListener(v -> {
145
 
137
 
146
-            if (spinnerSite.getSelectedItem() == null){
138
+            if (binding.spinnerSite.getSelectedItem() == null){
147
                 Toast.makeText(this, "Data Site Belum Terpilih", Toast.LENGTH_SHORT).show();
139
                 Toast.makeText(this, "Data Site Belum Terpilih", Toast.LENGTH_SHORT).show();
148
                 return;
140
                 return;
149
             }
141
             }
150
 
142
 
151
-            if (spinnerPermit.getSelectedItem() == null){
143
+            if (binding.spinnerPermit.getSelectedItem() == null){
152
                 Toast.makeText(this, "Data Permit Belum Terpilih", Toast.LENGTH_SHORT).show();
144
                 Toast.makeText(this, "Data Permit Belum Terpilih", Toast.LENGTH_SHORT).show();
153
                 return;
145
                 return;
154
             }
146
             }
@@ -160,4 +152,9 @@ public class MainActivity extends BaseActivity {
160
         });
152
         });
161
     }
153
     }
162
 
154
 
155
+    @Override
156
+    protected void onDestroy() {
157
+        super.onDestroy();
158
+        binding = null;
159
+    }
163
 }
160
 }

+ 12 - 19
app/src/main/java/com/fusi24/rfid/adapter/ScanResultAdapter.java

@@ -2,23 +2,19 @@ package com.fusi24.rfid.adapter;
2
 
2
 
3
 import android.content.Context;
3
 import android.content.Context;
4
 import android.view.LayoutInflater;
4
 import android.view.LayoutInflater;
5
-import android.view.View;
6
 import android.view.ViewGroup;
5
 import android.view.ViewGroup;
7
 import android.widget.TextView;
6
 import android.widget.TextView;
8
 
7
 
9
 import androidx.annotation.NonNull;
8
 import androidx.annotation.NonNull;
10
 import androidx.recyclerview.widget.RecyclerView;
9
 import androidx.recyclerview.widget.RecyclerView;
11
 
10
 
12
-import com.fusi24.rfid.R;
13
 import com.fusi24.rfid.data.entity.DataProblems;
11
 import com.fusi24.rfid.data.entity.DataProblems;
12
+import com.fusi24.rfid.databinding.RowDocumentBinding;
14
 import com.fusi24.rfid.util.DateHelper;
13
 import com.fusi24.rfid.util.DateHelper;
15
 
14
 
16
 import java.util.ArrayList;
15
 import java.util.ArrayList;
17
 import java.util.List;
16
 import java.util.List;
18
 
17
 
19
-import butterknife.BindView;
20
-import butterknife.ButterKnife;
21
-
22
 public class ScanResultAdapter extends RecyclerView.Adapter<ScanResultAdapter.ViewHolder>{
18
 public class ScanResultAdapter extends RecyclerView.Adapter<ScanResultAdapter.ViewHolder>{
23
 
19
 
24
     private Context context;
20
     private Context context;
@@ -38,17 +34,15 @@ public class ScanResultAdapter extends RecyclerView.Adapter<ScanResultAdapter.Vi
38
     }
34
     }
39
 
35
 
40
     static class ViewHolder extends RecyclerView.ViewHolder {
36
     static class ViewHolder extends RecyclerView.ViewHolder {
41
-
42
-        @BindView(R.id.tv_document_name)
43
-        TextView tvDocumentName;
44
-        @BindView(R.id.tv_document_status)
45
-        TextView tvDocumentStatus;
46
-        @BindView(R.id.tv_document_date)
47
-        TextView tvDocumentDate;
48
-
49
-        ViewHolder(View itemView) {
50
-            super(itemView);
51
-            ButterKnife.bind(this, itemView);
37
+        private TextView tvDocumentName;
38
+        private TextView tvDocumentStatus;
39
+        private TextView tvDocumentDate;
40
+
41
+        ViewHolder(RowDocumentBinding itemBinding) {
42
+            super(itemBinding.getRoot());
43
+            tvDocumentName = itemBinding.tvDocumentName;
44
+            tvDocumentStatus = itemBinding.tvDocumentStatus;
45
+            tvDocumentDate = itemBinding.tvDocumentStatus;
52
         }
46
         }
53
     }
47
     }
54
 
48
 
@@ -56,9 +50,8 @@ public class ScanResultAdapter extends RecyclerView.Adapter<ScanResultAdapter.Vi
56
     @NonNull
50
     @NonNull
57
     @Override
51
     @Override
58
     public ScanResultAdapter.ViewHolder onCreateViewHolder(@NonNull ViewGroup parent, int viewType) {
52
     public ScanResultAdapter.ViewHolder onCreateViewHolder(@NonNull ViewGroup parent, int viewType) {
59
-        View itemView = LayoutInflater.from(context)
60
-                .inflate(R.layout.row_document, parent, false);
61
-        return new ViewHolder(itemView);
53
+        RowDocumentBinding itemBinding = RowDocumentBinding.inflate(LayoutInflater.from(context), parent, false);
54
+        return new ViewHolder(itemBinding);
62
     }
55
     }
63
 
56
 
64
     @Override
57
     @Override

+ 15 - 12
app/src/main/java/com/fusi24/rfid/ui/ScanActivity.java

@@ -2,15 +2,12 @@ package com.fusi24.rfid.ui;
2
 
2
 
3
 import android.content.Intent;
3
 import android.content.Intent;
4
 import android.os.Bundle;
4
 import android.os.Bundle;
5
-import android.widget.ToggleButton;
5
+import android.view.View;
6
 
6
 
7
-import com.fusi24.rfid.R;
7
+import com.fusi24.rfid.databinding.ActivityScanBinding;
8
 import com.fusi24.rfid.ui.scanresult.ScanResultActivity;
8
 import com.fusi24.rfid.ui.scanresult.ScanResultActivity;
9
 import com.fusi24.rfid.util.LFScanProcessing;
9
 import com.fusi24.rfid.util.LFScanProcessing;
10
 
10
 
11
-import butterknife.BindView;
12
-import butterknife.ButterKnife;
13
-import butterknife.OnCheckedChanged;
14
 import timber.log.Timber;
11
 import timber.log.Timber;
15
 
12
 
16
 public class ScanActivity extends LFScanProcessing {
13
 public class ScanActivity extends LFScanProcessing {
@@ -18,17 +15,16 @@ public class ScanActivity extends LFScanProcessing {
18
     public static final String ID_SITE = "id_site";
15
     public static final String ID_SITE = "id_site";
19
     public static final String ID_PERMIT = "id_permit";
16
     public static final String ID_PERMIT = "id_permit";
20
 
17
 
21
-    @BindView(R.id.toggle_scan)
22
-    ToggleButton toggleScan;
23
-
24
     private String idSite;
18
     private String idSite;
25
     private String idPermit;
19
     private String idPermit;
20
+    private ActivityScanBinding binding;
26
 
21
 
27
     @Override
22
     @Override
28
     protected void onCreate(Bundle savedInstanceState) {
23
     protected void onCreate(Bundle savedInstanceState) {
29
         super.onCreate(savedInstanceState);
24
         super.onCreate(savedInstanceState);
30
-        setContentView(R.layout.activity_scan);
31
-        ButterKnife.bind(this);
25
+        binding = ActivityScanBinding.inflate(getLayoutInflater());
26
+        View view = binding.getRoot();
27
+        setContentView(view);
32
         initView();
28
         initView();
33
         initSound();
29
         initSound();
34
     }
30
     }
@@ -38,11 +34,12 @@ public class ScanActivity extends LFScanProcessing {
38
             idSite = getIntent().getExtras().getString(ID_SITE);
34
             idSite = getIntent().getExtras().getString(ID_SITE);
39
             idPermit = getIntent().getExtras().getString(ID_PERMIT);
35
             idPermit = getIntent().getExtras().getString(ID_PERMIT);
40
         }
36
         }
37
+
38
+        binding.toggleScan.setOnCheckedChangeListener((buttonView, isChecked) -> statusScanner());
41
     }
39
     }
42
 
40
 
43
-    @OnCheckedChanged(R.id.toggle_scan)
44
     public void statusScanner(){
41
     public void statusScanner(){
45
-        if(toggleScan.isChecked()){
42
+        if(binding.toggleScan.isChecked()){
46
             onStart();
43
             onStart();
47
         } else
44
         } else
48
             onStop();
45
             onStop();
@@ -80,4 +77,10 @@ public class ScanActivity extends LFScanProcessing {
80
             }
77
             }
81
         });
78
         });
82
     }
79
     }
80
+
81
+    @Override
82
+    protected void onDestroy() {
83
+        super.onDestroy();
84
+        binding = null;
85
+    }
83
 }
86
 }

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

@@ -3,15 +3,12 @@ package com.fusi24.rfid.ui.scanresult;
3
 import android.annotation.SuppressLint;
3
 import android.annotation.SuppressLint;
4
 import android.content.Intent;
4
 import android.content.Intent;
5
 import android.os.Bundle;
5
 import android.os.Bundle;
6
-import android.widget.Button;
7
-import android.widget.LinearLayout;
8
-import android.widget.TextView;
6
+import android.view.View;
9
 import android.widget.Toast;
7
 import android.widget.Toast;
10
 
8
 
11
 import androidx.recyclerview.widget.DefaultItemAnimator;
9
 import androidx.recyclerview.widget.DefaultItemAnimator;
12
 import androidx.recyclerview.widget.DividerItemDecoration;
10
 import androidx.recyclerview.widget.DividerItemDecoration;
13
 import androidx.recyclerview.widget.LinearLayoutManager;
11
 import androidx.recyclerview.widget.LinearLayoutManager;
14
-import androidx.recyclerview.widget.RecyclerView;
15
 
12
 
16
 import com.bumptech.glide.Glide;
13
 import com.bumptech.glide.Glide;
17
 import com.fusi24.rfid.MainActivity;
14
 import com.fusi24.rfid.MainActivity;
@@ -21,47 +18,17 @@ import com.fusi24.rfid.base.BaseActivity;
21
 import com.fusi24.rfid.config.Constant;
18
 import com.fusi24.rfid.config.Constant;
22
 import com.fusi24.rfid.data.entity.DataProblems;
19
 import com.fusi24.rfid.data.entity.DataProblems;
23
 import com.fusi24.rfid.data.entity.DataResultRfid;
20
 import com.fusi24.rfid.data.entity.DataResultRfid;
21
+import com.fusi24.rfid.databinding.ActivityScanResultBinding;
24
 
22
 
25
 import java.util.ArrayList;
23
 import java.util.ArrayList;
26
 import java.util.List;
24
 import java.util.List;
27
 
25
 
28
-import butterknife.BindView;
29
-import butterknife.ButterKnife;
30
-import de.hdodenhof.circleimageview.CircleImageView;
31
-
32
 public class ScanResultActivity extends BaseActivity implements ScanResultView {
26
 public class ScanResultActivity extends BaseActivity implements ScanResultView {
33
 
27
 
34
     public static final String ID_SITE = "id_site";
28
     public static final String ID_SITE = "id_site";
35
     public static final String ID_PERMIT = "id_permit";
29
     public static final String ID_PERMIT = "id_permit";
36
     public static final String RFID_CARD_NUMBER = "rfid_card_number";
30
     public static final String RFID_CARD_NUMBER = "rfid_card_number";
37
 
31
 
38
-    @BindView(R.id.tv_rfid_number)
39
-    TextView tvRfidNumber;
40
-
41
-    @BindView(R.id.iv_profile_image)
42
-    CircleImageView ivProfileImage;
43
-    @BindView(R.id.tv_profile_name)
44
-    TextView tvProfileName;
45
-    @BindView(R.id.tv_structural_position)
46
-    TextView tvStructuralPosition;
47
-    @BindView(R.id.tv_functional_position)
48
-    TextView tvFunctionalPosition;
49
-    @BindView(R.id.tv_company_name)
50
-    TextView tvCompanyName;
51
-
52
-    @BindView(R.id.ll_profile_status)
53
-    LinearLayout llProfileStatus;
54
-    @BindView(R.id.tv_profile_status)
55
-    TextView tvProfileStatus;
56
-
57
-    @BindView(R.id.rv_document_problem)
58
-    RecyclerView rvDocumentProblem;
59
-
60
-    @BindView(R.id.btn_home)
61
-    Button btnHome;
62
-    @BindView(R.id.btn_scan_again)
63
-    Button btnScanAgain;
64
-
65
     private ScanResultPresenter presenter;
32
     private ScanResultPresenter presenter;
66
     private ScanResultAdapter adapter;
33
     private ScanResultAdapter adapter;
67
     private List<DataProblems> problemsList;
34
     private List<DataProblems> problemsList;
@@ -70,12 +37,14 @@ public class ScanResultActivity extends BaseActivity implements ScanResultView {
70
     private String idPermit;
37
     private String idPermit;
71
     private String numberRfid;
38
     private String numberRfid;
72
     private String numberRfidTemp;
39
     private String numberRfidTemp;
40
+    private ActivityScanResultBinding binding;
73
 
41
 
74
     @Override
42
     @Override
75
     protected void onCreate(Bundle savedInstanceState) {
43
     protected void onCreate(Bundle savedInstanceState) {
76
         super.onCreate(savedInstanceState);
44
         super.onCreate(savedInstanceState);
77
-        setContentView(R.layout.activity_scan_result);
78
-        ButterKnife.bind(this);
45
+        binding = ActivityScanResultBinding.inflate(getLayoutInflater());
46
+        View view = binding.getRoot();
47
+        setContentView(view);
79
 
48
 
80
         presenter = new ScanResultPresenter(
49
         presenter = new ScanResultPresenter(
81
                 getManager(), getAndroidScheduler(), getProcessScheduler());
50
                 getManager(), getAndroidScheduler(), getProcessScheduler());
@@ -118,16 +87,16 @@ public class ScanResultActivity extends BaseActivity implements ScanResultView {
118
 
87
 
119
     @SuppressLint("SetTextI18n")
88
     @SuppressLint("SetTextI18n")
120
     private void initView(){
89
     private void initView(){
121
-        tvRfidNumber.setText("Nomor RFID : " + numberRfid);
90
+        binding.tvRfidNumber.setText("Nomor RFID : " + numberRfid);
122
 
91
 
123
         problemsList = new ArrayList<>();
92
         problemsList = new ArrayList<>();
124
         adapter = new ScanResultAdapter(this);
93
         adapter = new ScanResultAdapter(this);
125
 
94
 
126
         LinearLayoutManager layoutManager = new LinearLayoutManager(this);
95
         LinearLayoutManager layoutManager = new LinearLayoutManager(this);
127
-        rvDocumentProblem.setLayoutManager(layoutManager);
128
-        rvDocumentProblem.setItemAnimator(new DefaultItemAnimator());
129
-        rvDocumentProblem.addItemDecoration(new DividerItemDecoration(this, DividerItemDecoration.VERTICAL));
130
-        rvDocumentProblem.setAdapter(adapter);
96
+        binding.rvDocumentProblem.setLayoutManager(layoutManager);
97
+        binding.rvDocumentProblem.setItemAnimator(new DefaultItemAnimator());
98
+        binding.rvDocumentProblem.addItemDecoration(new DividerItemDecoration(this, DividerItemDecoration.VERTICAL));
99
+        binding.rvDocumentProblem.setAdapter(adapter);
131
     }
100
     }
132
 
101
 
133
     private void loadingdata(){
102
     private void loadingdata(){
@@ -137,13 +106,13 @@ public class ScanResultActivity extends BaseActivity implements ScanResultView {
137
     }
106
     }
138
 
107
 
139
     private void initEvent(){
108
     private void initEvent(){
140
-        btnHome.setOnClickListener(v -> {
109
+        binding.btnHome.setOnClickListener(v -> {
141
             final Intent intent = new Intent(this, MainActivity.class);
110
             final Intent intent = new Intent(this, MainActivity.class);
142
             intent.setFlags(Intent.FLAG_ACTIVITY_CLEAR_TOP);
111
             intent.setFlags(Intent.FLAG_ACTIVITY_CLEAR_TOP);
143
             startActivity(intent);
112
             startActivity(intent);
144
         });
113
         });
145
 
114
 
146
-        btnScanAgain.setOnClickListener(v -> finish());
115
+        binding.btnScanAgain.setOnClickListener(v -> finish());
147
     }
116
     }
148
 
117
 
149
     @Override
118
     @Override
@@ -152,43 +121,41 @@ public class ScanResultActivity extends BaseActivity implements ScanResultView {
152
         if (dataResultRfid.getEmployee() != null){
121
         if (dataResultRfid.getEmployee() != null){
153
             dataUrl = Constant.URL_PHOTO + dataResultRfid.getEmployee().getUrlPhoto().substring(14);
122
             dataUrl = Constant.URL_PHOTO + dataResultRfid.getEmployee().getUrlPhoto().substring(14);
154
 
123
 
155
-            tvProfileName.setText(dataResultRfid.getEmployee().getName());
156
-            tvStructuralPosition.setText(dataResultRfid.getEmployee().getStructuralPosition().getName());
157
-            tvFunctionalPosition.setText(dataResultRfid.getEmployee().getFunctionalPosition().getName());
158
-            tvCompanyName.setText(dataResultRfid.getEmployee().getCompany().getName());
124
+            binding.tvProfileName.setText(dataResultRfid.getEmployee().getName());
125
+            binding.tvStructuralPosition.setText(dataResultRfid.getEmployee().getStructuralPosition().getName());
126
+            binding.tvFunctionalPosition.setText(dataResultRfid.getEmployee().getFunctionalPosition().getName());
127
+            binding.tvCompanyName.setText(dataResultRfid.getEmployee().getCompany().getName());
159
         } else {
128
         } else {
160
-            tvProfileName.setText("-");
161
-            tvStructuralPosition.setText("-");
162
-            tvFunctionalPosition.setText("-");
163
-            tvCompanyName.setText("-");
129
+            binding.tvProfileName.setText("-");
130
+            binding.tvStructuralPosition.setText("-");
131
+            binding.tvFunctionalPosition.setText("-");
132
+            binding.tvCompanyName.setText("-");
164
         }
133
         }
165
 
134
 
166
         Glide.with(this)
135
         Glide.with(this)
167
                 .load(dataUrl)
136
                 .load(dataUrl)
168
                 .placeholder(R.drawable.ic_profile_default)
137
                 .placeholder(R.drawable.ic_profile_default)
169
                 .error(R.drawable.ic_profile_default)
138
                 .error(R.drawable.ic_profile_default)
170
-                .into(ivProfileImage);
139
+                .into(binding.ivProfileImage);
171
 
140
 
172
         if (dataResultRfid.getPassed()){
141
         if (dataResultRfid.getPassed()){
173
-            tvProfileStatus.setText(R.string.label_status_passed);
174
-            llProfileStatus.setBackgroundColor(getResources().getColor(R.color.colorPrimary));
142
+            binding.tvProfileStatus.setText(R.string.label_status_passed);
143
+            binding.llProfileStatus.setBackgroundColor(getResources().getColor(R.color.colorPrimary));
175
         } else {
144
         } else {
176
-
177
             if (dataResultRfid.getAlertType() != null){
145
             if (dataResultRfid.getAlertType() != null){
178
-
179
                 if (dataResultRfid.getAlertType().equalsIgnoreCase("ERROR")){
146
                 if (dataResultRfid.getAlertType().equalsIgnoreCase("ERROR")){
180
-                    tvProfileStatus.setText(R.string.label_status_not_passed);
181
-                    llProfileStatus.setBackgroundColor(getResources().getColor(R.color.colorRedDark));
147
+                    binding.tvProfileStatus.setText(R.string.label_status_not_passed);
148
+                    binding.llProfileStatus.setBackgroundColor(getResources().getColor(R.color.colorRedDark));
182
                 }
149
                 }
183
 
150
 
184
                 if (dataResultRfid.getAlertType().equalsIgnoreCase("WARNING")){
151
                 if (dataResultRfid.getAlertType().equalsIgnoreCase("WARNING")){
185
-                    tvProfileStatus.setText(R.string.label_status_not_valid);
186
-                    llProfileStatus.setBackgroundColor(getResources().getColor(R.color.colorRedDark));
152
+                    binding.tvProfileStatus.setText(R.string.label_status_not_valid);
153
+                    binding.llProfileStatus.setBackgroundColor(getResources().getColor(R.color.colorRedDark));
187
                 }
154
                 }
188
 
155
 
189
             } else {
156
             } else {
190
-                tvProfileStatus.setText(R.string.label_status_not_passed);
191
-                llProfileStatus.setBackgroundColor(getResources().getColor(R.color.colorRedDark));
157
+                binding.tvProfileStatus.setText(R.string.label_status_not_passed);
158
+                binding.llProfileStatus.setBackgroundColor(getResources().getColor(R.color.colorRedDark));
192
             }
159
             }
193
         }
160
         }
194
 
161
 
@@ -210,5 +177,6 @@ public class ScanResultActivity extends BaseActivity implements ScanResultView {
210
     protected void onDestroy() {
177
     protected void onDestroy() {
211
         super.onDestroy();
178
         super.onDestroy();
212
         presenter.detachView();
179
         presenter.detachView();
180
+        binding = null;
213
     }
181
     }
214
 }
182
 }

+ 1 - 1
build.gradle

@@ -7,7 +7,7 @@ buildscript {
7
         
7
         
8
     }
8
     }
9
     dependencies {
9
     dependencies {
10
-        classpath 'com.android.tools.build:gradle:3.5.3'
10
+        classpath 'com.android.tools.build:gradle:3.6.1'
11
         
11
         
12
         // NOTE: Do not place your application dependencies here; they belong
12
         // NOTE: Do not place your application dependencies here; they belong
13
         // in the individual module build.gradle files
13
         // in the individual module build.gradle files