/** * @param listPosition An {@link ExpandableListPosition} representing either a child or group * @return the total number of children within the group associated with the @param listPosition */ public int getExpandableGroupItemCount(ExpandableListPosition listPosition) { return groups.get(listPosition.groupPos).getItemCount(); }
/** * @param group the index of the {@link ExpandableGroup} in the full collection {@link #groups} * @return the number of visible row items for the particular group. If the group is collapsed, * return 1 for the group header. If the group is expanded return total number of children in the * group + 1 for the group header */ private int numberOfVisibleItemsInGroup(int group) { if (expandedGroupIndexes[group]) { return groups.get(group).getItemCount() + 1; } else { return 1; } }
/** * Expand a group * * @param listPosition the group to be expanded */ private void expandGroup(ExpandableListPosition listPosition) { expandableList.expandedGroupIndexes[listPosition.groupPos] = true; if (listener != null) { listener.onGroupExpanded(expandableList.getFlattenedGroupIndex(listPosition) + 1, expandableList.groups.get(listPosition.groupPos).getItemCount()); } }
/** * Collapse a group * * @param listPosition position of the group to collapse */ private void collapseGroup(ExpandableListPosition listPosition) { expandableList.expandedGroupIndexes[listPosition.groupPos] = false; if (listener != null) { listener.onGroupCollapsed(expandableList.getFlattenedGroupIndex(listPosition) + 1, expandableList.groups.get(listPosition.groupPos).getItemCount()); } }
public void clearChoices() { childCheckController.clearCheckStates(); //only update the child views that are visible (i.e. their group is expanded) for (int i = 0; i < getGroups().size(); i++) { ExpandableGroup group = getGroups().get(i); if (isGroupExpanded(group)) { notifyItemRangeChanged(expandableList.getFlattenedFirstChildIndex(i), group.getItemCount()); } } }
/** * Clear any choices previously checked */ public void clearChoices() { childCheckController.clearCheckStates(); //only update the child views that are visible (i.e. their group is expanded) for (int i = 0; i < getGroups().size(); i++) { ExpandableGroup group = getGroups().get(i); if (isGroupExpanded(group)) { notifyItemRangeChanged(expandableList.getFlattenedFirstChildIndex(i), group.getItemCount()); } } }