private void reevaluateItemVisibility() {
        //VISIBILITY RULES
        //- An item is visible IF it is visible by its text filter AND its group is expanded
        //- A group is visible IF it has at least one visible contained item (subgroup or base item) AND  none of its PARENTS it REDUCED
        //  (note: group header of a reduced group MUST BE displayed (if none of the parents is reduced)
        //Attention: this method assumes that the item.visibleByFilter is correctly set for all ITEMs!

        //1. collect groups which are visible
        final Map<Object, Boolean> visibleGroups = new HashMap<>();
        for (ListItem item : listAdapter.getOriginalItems()) {
            if (item.type == ListItemType.ITEM && item.isVisibleByFilter) {
                determineGroupAndParentsVisibility(item.itemGroup, visibleGroups);
            }
        }

        //2. set visible flag for items and groupheaders
        for (ListItem item : listAdapter.getOriginalItems()) {
            final Object group = item.itemGroup == null ? null : item.itemGroup.getGroup();
            item.isVisible = item.isVisibleByFilter && (group == null || Boolean.TRUE.equals(visibleGroups.get(group)))
              && (item.type != ListItemType.ITEM || isGroupExpanded(group));
        }
    }
This view displays and maintains a list of simple view items, mainly for (single or multiple)
item selection lists. It provides special support for grouping, filtering and "select all" for such
lists.
main/src/main/java/cgeo/geocaching/ui/SimpleItemListView.java