Skip to content

Commit

Permalink
#73
Browse files Browse the repository at this point in the history
  • Loading branch information
Ossama98 committed Apr 2, 2020
1 parent 5bbc4e9 commit 34ae056
Showing 1 changed file with 14 additions and 10 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down Expand Up @@ -37,11 +38,18 @@ public class ExpandableListAdapter extends BaseExpandableListAdapter {
public ExpandableListAdapter(Activity context , List<String> UE , Map<String, List<String>> 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)
}
Expand Down Expand Up @@ -145,13 +153,10 @@ public void filterData(String query) {

UE.clear();
UECollections.clear();

if (query.isEmpty()) {
UE.addAll(UEOriginal);
UECollections.putAll(UeCollectionsOriginal);

} else {
Map<String, List<String>> newUECollections = new HashMap<>();
for (String s : UEOriginal) {
ArrayList<String> ueDes = new ArrayList<>();
for (String ue : UeCollectionsOriginal.get(s)) {
Expand All @@ -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);
}
}
}
Expand All @@ -171,4 +175,4 @@ public void filterData(String query) {

}

}
}

0 comments on commit 34ae056

Please sign in to comment.