From 34ae056826948b31e75635cdf8b45129b878c80a Mon Sep 17 00:00:00 2001 From: Ossama Date: Fri, 3 Apr 2020 01:43:37 +0200 Subject: [PATCH] #73 --- .../vue/adapter/ExpandableListAdapter.java | 24 +++++++++++-------- 1 file changed, 14 insertions(+), 10 deletions(-) diff --git a/AndroidApp/app/src/main/java/com/androidapp/vue/adapter/ExpandableListAdapter.java b/AndroidApp/app/src/main/java/com/androidapp/vue/adapter/ExpandableListAdapter.java index f761e8b..e0f868b 100644 --- a/AndroidApp/app/src/main/java/com/androidapp/vue/adapter/ExpandableListAdapter.java +++ b/AndroidApp/app/src/main/java/com/androidapp/vue/adapter/ExpandableListAdapter.java @@ -8,6 +8,7 @@ import android.app.Activity; import android.content.Context; import android.graphics.Typeface; +import android.util.Log; import android.view.LayoutInflater; import android.view.View; import android.view.ViewGroup; @@ -37,11 +38,18 @@ public class ExpandableListAdapter extends BaseExpandableListAdapter { public ExpandableListAdapter(Activity context , List UE , Map> UECollections) { this.context = context; - this.UE = UE; - this.UECollections = UECollections; + //this.UE = UE; + //this.UECollections = UECollections; + this.UE =new ArrayList<>(); + this.UE.addAll(UE); + this.UECollections =new HashMap<>(); + this.UECollections.putAll(UECollections); - this.UEOriginal =UE; - this.UeCollectionsOriginal =UECollections; + + this.UEOriginal =new ArrayList<>(); + UEOriginal.addAll(UE); + this.UeCollectionsOriginal =new HashMap<>(); + UeCollectionsOriginal.putAll(UECollections); AdapterCollection = new LinkedHashMap<>(getGroupCount()); //On crée une collection de RecyclerViewAdapter pour récupérer la séléction de l'utilisateur (un adaptateur pour chaque discipline sur laquelle l'utilisateur clique) } @@ -145,13 +153,10 @@ public void filterData(String query) { UE.clear(); UECollections.clear(); - if (query.isEmpty()) { UE.addAll(UEOriginal); UECollections.putAll(UeCollectionsOriginal); - } else { - Map> newUECollections = new HashMap<>(); for (String s : UEOriginal) { ArrayList ueDes = new ArrayList<>(); for (String ue : UeCollectionsOriginal.get(s)) { @@ -160,9 +165,8 @@ public void filterData(String query) { } } if (ueDes.size() > 0) { - newUECollections.put(s, ueDes); UE.add(s); - UECollections.putAll(newUECollections); + UECollections.put(s,ueDes); } } } @@ -171,4 +175,4 @@ public void filterData(String query) { } -} \ No newline at end of file +}