// Path: MensaApp/src/main/java/de/lukasniemeier/mensa/model/Meal.java
// public class Meal implements Serializable {
// 
//     private final Menu menu;
//     private final String name;
//     private final String description;
//     private final Collection<MealType> types;
//     private final Collection<String> additives;
//     private final String price;
// 
//     public Meal(Menu menu, String name, String description, Collection<MealType> types,
//                 Collection<String> additives, String price) {
//         this.menu = menu;
//         this.name = name;
//         this.description = description;
//         this.types = types;
//         this.additives = additives;
//         this.price = price;
//     }
// 
//     public Menu getMenu() {
//         return menu;
//     }
// 
//     public String getName() {
//         return name;
//     }
// 
//     public String getDescription() {
//         return description;
//     }
// 
//     public Collection<MealType> getTypes() {
//         return types;
//     }
// 
//     public Collection<String> getAdditives() {
//         return additives;
//     }
// 
//     public String getPrice() {
//         return price;
//     }
// 
//     @Override
//     public String toString() {
//         return "Meal{" +
//                 "name='" + name + '\'' +
//                 ", description='" + description + '\'' +
//                 ", types='" + types + '\'' +
//                 ", additives='" + additives + '\'' +
//                 ", price='" + price + '\'' +
//                 '}';
//     }
// }
// 
// Path: MensaApp/src/main/java/de/lukasniemeier/mensa/model/MealType.java
// public enum MealType {
//     UNKNOWN(R.string.meal_type_unknown, R.drawable.unknown, ""),
//     FISH(R.string.meal_type_fish, R.drawable.fish, "mit Fisch"),
//     PORK(R.string.meal_type_pork, R.drawable.pork, "mit Schweinefleisch"),
//     CHICKEN(R.string.meal_type_chicken, R.drawable.chicken, "mit Geflügelfleisch"),
//     BEEF(R.string.meal_type_beef, R.drawable.beef, "mit Rindfleisch"),
//     VEGAN(R.string.meal_type_vegan, R.drawable.vegan, "vegan"),
//     OVOLACTOVEGETABIL(R.string.meal_type_ovolactovegetabil, R.drawable.lacto, "ovo-lacto-vegetabil"),
//     MENSAVITAL(R.string.meal_type_mensavital, R.drawable.vital, "mensaVital");
// 
//     private final String name;
//     private final Bitmap icon;
//     private final String parseString;
// 
//     private MealType(int nameId, int iconId, String displayName) {
//         ResourceService service = MensaApplication.getResourceService();
//         this.name = service.localizeString(nameId);
//         this.icon = BitmapFactory.decodeResource(service.getResources(), iconId);
//         this.parseString = displayName;
//     }
// 
//     public String getParseString() {
//         return parseString;
//     }
// 
//     public String getName() {
//         return name;
//     }
// 
//     public Bitmap getIcon() {
//         return icon;
//     }
// 
//     @Override
//     public String toString() {
//         return getName();
//     }
// }


import android.text.TextUtils;
import android.widget.Filter;
import android.widget.TextView;
import com.google.common.base.Function;
import com.google.common.base.Predicate;
import com.google.common.collect.Collections2;
import java.util.Collection;
import java.util.Collections;
import java.util.EnumSet;
import java.util.List;
import de.lukasniemeier.mensa.model.Meal;
import de.lukasniemeier.mensa.model.MealType;

    public void filter() {
        filter(filterQuery);
    }

    @Override
    protected FilterResults performFiltering(CharSequence charSequence) {
        FilterResults results = new FilterResults();
        List<CardState<Meal>> allItems = adapter.getAllItems();
        if (EnumSet.complementOf(filterQuery).isEmpty()) {
            results.values = allItems;
            results.count = allItems.size();
        } else {
            Collection<CardState<Meal>> filteredItems = Collections2.filter(allItems,
                    new Predicate<CardState<Meal>>() {
                        @Override
                        public boolean apply(CardState<Meal> mealCardState) {
                            return !Collections.disjoint(mealCardState.getValue().getTypes(),
                                    filterQuery);
                        }
                    });
            results.values = filteredItems;
            results.count = filteredItems.size();
        }
        return results;
    }

    @SuppressWarnings("unchecked")
    @Override
    protected void publishResults(CharSequence charSequence, FilterResults filterResults) {
// Path: MensaApp/src/main/java/de/lukasniemeier/mensa/model/Meal.java
// public class Meal implements Serializable {
// 
//     private final Menu menu;
//     private final String name;
//     private final String description;
//     private final Collection<MealType> types;
//     private final Collection<String> additives;
//     private final String price;
// 
//     public Meal(Menu menu, String name, String description, Collection<MealType> types,
//                 Collection<String> additives, String price) {
//         this.menu = menu;
//         this.name = name;
//         this.description = description;
//         this.types = types;
//         this.additives = additives;
//         this.price = price;
//     }
// 
//     public Menu getMenu() {
//         return menu;
//     }
// 
//     public String getName() {
//         return name;
//     }
// 
//     public String getDescription() {
//         return description;
//     }
// 
//     public Collection<MealType> getTypes() {
//         return types;
//     }
// 
//     public Collection<String> getAdditives() {
//         return additives;
//     }
// 
//     public String getPrice() {
//         return price;
//     }
// 
//     @Override
//     public String toString() {
//         return "Meal{" +
//                 "name='" + name + '\'' +
//                 ", description='" + description + '\'' +
//                 ", types='" + types + '\'' +
//                 ", additives='" + additives + '\'' +
//                 ", price='" + price + '\'' +
//                 '}';
//     }
// }
// 
// Path: MensaApp/src/main/java/de/lukasniemeier/mensa/model/MealType.java
// public enum MealType {
//     UNKNOWN(R.string.meal_type_unknown, R.drawable.unknown, ""),
//     FISH(R.string.meal_type_fish, R.drawable.fish, "mit Fisch"),
//     PORK(R.string.meal_type_pork, R.drawable.pork, "mit Schweinefleisch"),
//     CHICKEN(R.string.meal_type_chicken, R.drawable.chicken, "mit Geflügelfleisch"),
//     BEEF(R.string.meal_type_beef, R.drawable.beef, "mit Rindfleisch"),
//     VEGAN(R.string.meal_type_vegan, R.drawable.vegan, "vegan"),
//     OVOLACTOVEGETABIL(R.string.meal_type_ovolactovegetabil, R.drawable.lacto, "ovo-lacto-vegetabil"),
//     MENSAVITAL(R.string.meal_type_mensavital, R.drawable.vital, "mensaVital");
// 
//     private final String name;
//     private final Bitmap icon;
//     private final String parseString;
// 
//     private MealType(int nameId, int iconId, String displayName) {
//         ResourceService service = MensaApplication.getResourceService();
//         this.name = service.localizeString(nameId);
//         this.icon = BitmapFactory.decodeResource(service.getResources(), iconId);
//         this.parseString = displayName;
//     }
// 
//     public String getParseString() {
//         return parseString;
//     }
// 
//     public String getName() {
//         return name;
//     }
// 
//     public Bitmap getIcon() {
//         return icon;
//     }
// 
//     @Override
//     public String toString() {
//         return getName();
//     }
// }


// Path: MensaApp/src/main/java/de/lukasniemeier/mensa/ui/adapter/MealAdapterMealTypeFilter.java
import android.text.TextUtils;
import android.widget.Filter;
import android.widget.TextView;
import com.google.common.base.Function;
import com.google.common.base.Predicate;
import com.google.common.collect.Collections2;
import java.util.Collection;
import java.util.Collections;
import java.util.EnumSet;
import java.util.List;
import de.lukasniemeier.mensa.model.Meal;
import de.lukasniemeier.mensa.model.MealType;


    public void filter() {
        filter(filterQuery);
    }

    @Override
    protected FilterResults performFiltering(CharSequence charSequence) {
        FilterResults results = new FilterResults();
        List<CardState<Meal>> allItems = adapter.getAllItems();
        if (EnumSet.complementOf(filterQuery).isEmpty()) {
            results.values = allItems;
            results.count = allItems.size();
        } else {
            Collection<CardState<Meal>> filteredItems = Collections2.filter(allItems,
                    new Predicate<CardState<Meal>>() {
                        @Override
                        public boolean apply(CardState<Meal> mealCardState) {
                            return !Collections.disjoint(mealCardState.getValue().getTypes(),
                                    filterQuery);
                        }
                    });
            results.values = filteredItems;
            results.count = filteredItems.size();
        }
        return results;
    }

    @SuppressWarnings("unchecked")
    @Override
    protected void publishResults(CharSequence charSequence, FilterResults filterResults) {
        List<CardState<Meal>> filteredItems = adapter.getFilteredItems();