@Override
        protected FilterResults performFiltering(CharSequence constraint) {
            List<DailyExpenseTagsWithPicsPojo> filteredListHelper = new ArrayList<>();
            List<DailyExpenseTagsWithPicsPojo> filteredList = new ArrayList<>();
            //----------- search = false, filter = false ----------------
            if ((constraint == null || constraint.length() == 0) && (categoriesForFilter == null || categoriesForFilter.size() == 0) && (tagsForFilter == null || tagsForFilter.size() == 0)) {
                filteredList.addAll(searchAllCosts);
                //----------- search = false, filter = true ----------------
            } else if ((constraint == null || constraint.length() == 0) && (categoriesForFilter != null || tagsForFilter != null)) {
                if (categoriesForFilter != null && tagsForFilter == null) {
                    for (DailyExpenseTagsWithPicsPojo item : searchAllCosts) {
                        for (String category : categoriesForFilter) {
                            if (category.equals(item.getCostEntry().getCategory())) {
                                filteredList.add(item);
                            }
                        }
                    }
                } else if (categoriesForFilter == null && tagsForFilter != null) {   //todo bug
                    for (DailyExpenseTagsWithPicsPojo item : searchAllCosts) {
                        for (String tag : tagsForFilter) {
                            if (item.getTagNames().contains(tag)) {
                                if (!filteredList.contains(item)) {
                                    filteredList.add(item);
                                }
                            }
                        }
                    }
                } else if (categoriesForFilter != null && tagsForFilter != null) {
                    for (DailyExpenseTagsWithPicsPojo item : searchAllCosts) {
                        for (String category : categoriesForFilter) {
                            if (category.equals(item.getCostEntry().getCategory())) {
                                filteredListHelper.add(item);
                            }
                        }
                    }
                    for (DailyExpenseTagsWithPicsPojo item : filteredListHelper) {
                        for (String tag : tagsForFilter) {
                            if (item.getTagNames().contains(tag)) {
                                if (!filteredList.contains(item)) {
                                    filteredList.add(item);
                                }
                            }
                        }
                    }
                }
                //----------- search = true, filter = false ----------------
            } else if (constraint.length() != 0) {
                String filterPattern = constraint.toString().toLowerCase().trim();
                for (DailyExpenseTagsWithPicsPojo item : searchAllCosts) {
                    if (item.getCostEntry().getName().toLowerCase().contains(filterPattern)) {
                        filteredList.add(item);
                    }
                }
            }
            // TODO: simultaneously search what is filtered and filter what is searched
            FilterResults results = new FilterResults();
            results.values = filteredList;
            Log.d("kraj metode", "testt");
            return results;
        }
@Override
        protected FilterResults performFiltering(CharSequence constraint) {
            List<DailyExpenseTagsWithPicsPojo> filteredListHelper = new ArrayList<>();
            List<DailyExpenseTagsWithPicsPojo> filteredList = new ArrayList<>();
           
            if ((constraint == null || constraint.length() == 0) && (categoriesForFilter == null || categoriesForFilter.size() == 0) && (tagsForFilter == null || tagsForFilter.size() == 0)) {
                filteredList.addAll(searchAllCosts);
               
            } else if ((constraint == null || constraint.length() == 0) && (categoriesForFilter != null || tagsForFilter != null)) {
                if (categoriesForFilter != null && tagsForFilter == null) {
                    for (DailyExpenseTagsWithPicsPojo item : searchAllCosts) {
                        for (String category : categoriesForFilter) {
                            if (category.equals(item.getCostEntry().getCategory())) {
                                filteredList.add(item);
                            }
                        }
                    }
                } else if (categoriesForFilter == null && tagsForFilter != null) {  
                    for (DailyExpenseTagsWithPicsPojo item : searchAllCosts) {
                        for (String tag : tagsForFilter) {
                            if (item.getTagNames().contains(tag)) {
                                if (!filteredList.contains(item)) {
                                    filteredList.add(item);
                                }
                            }
                        }
                    }
                } else if (categoriesForFilter != null && tagsForFilter != null) {
                    for (DailyExpenseTagsWithPicsPojo item : searchAllCosts) {
                        for (String category : categoriesForFilter) {
                            if (category.equals(item.getCostEntry().getCategory())) {
                                filteredListHelper.add(item);
                            }
                        }
                    }
                    for (DailyExpenseTagsWithPicsPojo item : filteredListHelper) {
                        for (String tag : tagsForFilter) {
                            if (item.getTagNames().contains(tag)) {
                                if (!filteredList.contains(item)) {
                                    filteredList.add(item);
                                }
                            }
                        }
                    }
                }
               
            } else if (constraint.length() != 0) {
                String filterPattern = constraint.toString().toLowerCase().trim();
                for (DailyExpenseTagsWithPicsPojo item : searchAllCosts) {
                    if (item.getCostEntry().getName().toLowerCase().contains(filterPattern)) {
                        filteredList.add(item);
                    }
                }
            }
           
            FilterResults results = new FilterResults();
            results.values = filteredList;
            Log.d("kraj metode", "testt");
            return results;
        }
@override protected filterresults performfiltering(charsequence constraint) { list<dailyexpensetagswithpicspojo> filteredlisthelper = new arraylist<>(); list<dailyexpensetagswithpicspojo> filteredlist = new arraylist<>(); if ((constraint == null || constraint.length() == 0) && (categoriesforfilter == null || categoriesforfilter.size() == 0) && (tagsforfilter == null || tagsforfilter.size() == 0)) { filteredlist.addall(searchallcosts); } else if ((constraint == null || constraint.length() == 0) && (categoriesforfilter != null || tagsforfilter != null)) { if (categoriesforfilter != null && tagsforfilter == null) { for (dailyexpensetagswithpicspojo item : searchallcosts) { for (string category : categoriesforfilter) { if (category.equals(item.getcostentry().getcategory())) { filteredlist.add(item); } } } } else if (categoriesforfilter == null && tagsforfilter != null) { for (dailyexpensetagswithpicspojo item : searchallcosts) { for (string tag : tagsforfilter) { if (item.gettagnames().contains(tag)) { if (!filteredlist.contains(item)) { filteredlist.add(item); } } } } } else if (categoriesforfilter != null && tagsforfilter != null) { for (dailyexpensetagswithpicspojo item : searchallcosts) { for (string category : categoriesforfilter) { if (category.equals(item.getcostentry().getcategory())) { filteredlisthelper.add(item); } } } for (dailyexpensetagswithpicspojo item : filteredlisthelper) { for (string tag : tagsforfilter) { if (item.gettagnames().contains(tag)) { if (!filteredlist.contains(item)) { filteredlist.add(item); } } } } } } else if (constraint.length() != 0) { string filterpattern = constraint.tostring().tolowercase().trim(); for (dailyexpensetagswithpicspojo item : searchallcosts) { if (item.getcostentry().getname().tolowercase().contains(filterpattern)) { filteredlist.add(item); } } } filterresults results = new filterresults(); results.values = filteredlist; log.d("kraj metode", "testt"); return results; }