Ver código fonte

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

lukirokudaime 1 ano atrás
pai
commit
454219a620

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

@@ -3,6 +3,7 @@ package com.fusi24.entryPermitScanner.adapter;
3 3
 import android.content.Context;
4 4
 import android.text.TextUtils;
5 5
 import android.view.LayoutInflater;
6
+import android.view.View;
6 7
 import android.view.ViewGroup;
7 8
 import android.widget.Filter;
8 9
 import android.widget.Filterable;
@@ -23,6 +24,7 @@ public class ProblemDocumentAdapter extends RecyclerView.Adapter<ProblemDocument
23 24
     private Context context;
24 25
     private List<DataProblems> problemsList;
25 26
     private List<DataProblems> problemsListFiltered;
27
+    private Boolean isVisibility = false;
26 28
 
27 29
     public ProblemDocumentAdapter(Context context, List<DataProblems> problemsList) {
28 30
         this.context = context;
@@ -30,6 +32,14 @@ public class ProblemDocumentAdapter extends RecyclerView.Adapter<ProblemDocument
30 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 43
     static class ViewHolder extends RecyclerView.ViewHolder {
34 44
         private RowDocumentBinding binding;
35 45
 
@@ -53,7 +63,15 @@ public class ProblemDocumentAdapter extends RecyclerView.Adapter<ProblemDocument
53 63
         DataProblems problems = problemsListFiltered.get(position);
54 64
 
55 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 75
         if (problems.getExpiryDate() != null){
58 76
             holder.binding.tvDocumentDate.setText(DateHelper.convertStringToMyPattern(problems.getExpiryDate(), "yyyy-MM-dd", "dd MMM yyyy"));
59 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 79
         //Create Sub Item View Adapter
80 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 86
         holder.binding.rvSubGroup.setLayoutManager(layoutManager);
82 87
         holder.binding.rvSubGroup.setAdapter(documentAdapter);
83 88
         holder.binding.rvSubGroup.setRecycledViewPool(viewPool);