private Filter exampleFilter = new Filter() {
@Override
protected FilterResults performFiltering(CharSequence constraint) {
constraint = constraint.toString().toLowerCase();
List<Etaloni> filteredList = new ArrayList<>();
//filteredList.clear();
if (constraint.toString().isEmpty()){
filteredList.addAll(mProductListFull);
}else {
for (Etaloni movie : mProductListFull){
if (movie.getEtaloni().toLowerCase().contains(constraint)){
filteredList.add(movie);
}
}
}
FilterResults filterResults = new FilterResults();
filterResults.values = filteredList;
return filterResults;
}
@Override
protected void publishResults(CharSequence constraint, FilterResults results) {
mProductList.clear(); //ეს კოდი - ფილტრაციის დროს შლის-არ აჩვენებს სხვა მონაცემებს
mProductList.addAll((List) results.values);
notifyDataSetChanged();
}