Browse Source

hide status NOT FOUND in ProblemDocumentAdapter when no available status NON-AKTIF or AKTIF

lukirokudaime 1 year ago
parent
commit
454219a620

+ 19 - 1
app/src/main/java/com/fusi24/entryPermitScanner/adapter/ProblemDocumentAdapter.java

@@ -3,6 +3,7 @@ package com.fusi24.entryPermitScanner.adapter;
3
 import android.content.Context;
3
 import android.content.Context;
4
 import android.text.TextUtils;
4
 import android.text.TextUtils;
5
 import android.view.LayoutInflater;
5
 import android.view.LayoutInflater;
6
+import android.view.View;
6
 import android.view.ViewGroup;
7
 import android.view.ViewGroup;
7
 import android.widget.Filter;
8
 import android.widget.Filter;
8
 import android.widget.Filterable;
9
 import android.widget.Filterable;
@@ -23,6 +24,7 @@ public class ProblemDocumentAdapter extends RecyclerView.Adapter<ProblemDocument
23
     private Context context;
24
     private Context context;
24
     private List<DataProblems> problemsList;
25
     private List<DataProblems> problemsList;
25
     private List<DataProblems> problemsListFiltered;
26
     private List<DataProblems> problemsListFiltered;
27
+    private Boolean isVisibility = false;
26
 
28
 
27
     public ProblemDocumentAdapter(Context context, List<DataProblems> problemsList) {
29
     public ProblemDocumentAdapter(Context context, List<DataProblems> problemsList) {
28
         this.context = context;
30
         this.context = context;
@@ -30,6 +32,14 @@ public class ProblemDocumentAdapter extends RecyclerView.Adapter<ProblemDocument
30
         this.problemsListFiltered = problemsList;
32
         this.problemsListFiltered = problemsList;
31
     }
33
     }
32
 
34
 
35
+    public void setVisibility(Boolean visibility) {
36
+        if (visibility != null){
37
+            isVisibility = visibility;
38
+        }else {
39
+            isVisibility = false;
40
+        }
41
+    }
42
+
33
     static class ViewHolder extends RecyclerView.ViewHolder {
43
     static class ViewHolder extends RecyclerView.ViewHolder {
34
         private RowDocumentBinding binding;
44
         private RowDocumentBinding binding;
35
 
45
 
@@ -53,7 +63,15 @@ public class ProblemDocumentAdapter extends RecyclerView.Adapter<ProblemDocument
53
         DataProblems problems = problemsListFiltered.get(position);
63
         DataProblems problems = problemsListFiltered.get(position);
54
 
64
 
55
         holder.binding.tvDocumentName.setText(problems.getDataDocumentType().getName());
65
         holder.binding.tvDocumentName.setText(problems.getDataDocumentType().getName());
56
-        holder.binding.tvDocumentStatus.setText(problems.getReason());
66
+        if (isVisibility){
67
+            if (problems.getReason().equals("NOT FOUND")){
68
+                holder.binding.tvDocumentStatus.setVisibility(View.GONE);
69
+            }else {
70
+                holder.binding.tvDocumentStatus.setText(problems.getReason());
71
+            }
72
+        }else {
73
+            holder.binding.tvDocumentStatus.setText(problems.getReason());
74
+        }
57
         if (problems.getExpiryDate() != null){
75
         if (problems.getExpiryDate() != null){
58
             holder.binding.tvDocumentDate.setText(DateHelper.convertStringToMyPattern(problems.getExpiryDate(), "yyyy-MM-dd", "dd MMM yyyy"));
76
             holder.binding.tvDocumentDate.setText(DateHelper.convertStringToMyPattern(problems.getExpiryDate(), "yyyy-MM-dd", "dd MMM yyyy"));
59
         } else {
77
         } else {

+ 5 - 0
app/src/main/java/com/fusi24/entryPermitScanner/adapter/ProblemGroupAdapter.java

@@ -78,6 +78,11 @@ public class ProblemGroupAdapter extends RecyclerView.Adapter<ProblemGroupAdapte
78
 
78
 
79
         //Create Sub Item View Adapter
79
         //Create Sub Item View Adapter
80
         ProblemDocumentAdapter documentAdapter = new ProblemDocumentAdapter(context, problemsList);
80
         ProblemDocumentAdapter documentAdapter = new ProblemDocumentAdapter(context, problemsList);
81
+        for (DataProblems dataProblems : problemsList){
82
+            if (!dataProblems.getReason().equals("NOT FOUND")){
83
+                documentAdapter.setVisibility(true);
84
+            }
85
+        }
81
         holder.binding.rvSubGroup.setLayoutManager(layoutManager);
86
         holder.binding.rvSubGroup.setLayoutManager(layoutManager);
82
         holder.binding.rvSubGroup.setAdapter(documentAdapter);
87
         holder.binding.rvSubGroup.setAdapter(documentAdapter);
83
         holder.binding.rvSubGroup.setRecycledViewPool(viewPool);
88
         holder.binding.rvSubGroup.setRecycledViewPool(viewPool);