Browse Source

-fixing view binding in adapter

ilhamitubagoes 4 years ago
parent
commit
78ba52af0a
1 changed files with 5 additions and 10 deletions
  1. 5 10
      app/src/main/java/com/fusi24/rfid/adapter/ScanResultAdapter.java

+ 5 - 10
app/src/main/java/com/fusi24/rfid/adapter/ScanResultAdapter.java

@@ -3,7 +3,6 @@ package com.fusi24.rfid.adapter;
3
 import android.content.Context;
3
 import android.content.Context;
4
 import android.view.LayoutInflater;
4
 import android.view.LayoutInflater;
5
 import android.view.ViewGroup;
5
 import android.view.ViewGroup;
6
-import android.widget.TextView;
7
 
6
 
8
 import androidx.annotation.NonNull;
7
 import androidx.annotation.NonNull;
9
 import androidx.recyclerview.widget.RecyclerView;
8
 import androidx.recyclerview.widget.RecyclerView;
@@ -34,15 +33,11 @@ public class ScanResultAdapter extends RecyclerView.Adapter<ScanResultAdapter.Vi
34
     }
33
     }
35
 
34
 
36
     static class ViewHolder extends RecyclerView.ViewHolder {
35
     static class ViewHolder extends RecyclerView.ViewHolder {
37
-        private TextView tvDocumentName;
38
-        private TextView tvDocumentStatus;
39
-        private TextView tvDocumentDate;
36
+        private RowDocumentBinding binding;
40
 
37
 
41
         ViewHolder(RowDocumentBinding itemBinding) {
38
         ViewHolder(RowDocumentBinding itemBinding) {
42
             super(itemBinding.getRoot());
39
             super(itemBinding.getRoot());
43
-            tvDocumentName = itemBinding.tvDocumentName;
44
-            tvDocumentStatus = itemBinding.tvDocumentStatus;
45
-            tvDocumentDate = itemBinding.tvDocumentStatus;
40
+            this.binding = itemBinding;
46
         }
41
         }
47
     }
42
     }
48
 
43
 
@@ -59,9 +54,9 @@ public class ScanResultAdapter extends RecyclerView.Adapter<ScanResultAdapter.Vi
59
 
54
 
60
         DataProblems problems = problemsList.get(position);
55
         DataProblems problems = problemsList.get(position);
61
 
56
 
62
-        holder.tvDocumentName.setText(problems.getDataDocumentType().getName());
63
-        holder.tvDocumentStatus.setText(problems.getReason());
64
-        holder.tvDocumentDate.setText(DateHelper.convertDateToReadableDate(problems.getDataDocumentType().getUpdateDate()));
57
+        holder.binding.tvDocumentName.setText(problems.getDataDocumentType().getName());
58
+        holder.binding.tvDocumentStatus.setText(problems.getReason());
59
+        holder.binding.tvDocumentDate.setText(DateHelper.convertDateToReadableDate(problems.getDataDocumentType().getUpdateDate()));
65
 
60
 
66
     }
61
     }
67
 
62