use of com.mikepenz.fastadapter.IExpandable in project FastAdapter by mikepenz.
the class AdapterUtil method findSubItemSelections.
/**
* internal method to find all selections from subItems and sub sub items so we can save those inside our savedInstanceState
*
* @param item the parent item
* @param selections the ArrayList which will be stored in the savedInstanceState
*/
public static <Item extends IItem> void findSubItemSelections(Item item, List<String> selections) {
if (item instanceof IExpandable && !((IExpandable) item).isExpanded() && ((IExpandable) item).getSubItems() != null) {
List<Item> subItems = (List<Item>) ((IExpandable<Item, ?>) item).getSubItems();
Item subItem;
String id;
for (int i = 0, size = subItems.size(); i < size; i++) {
subItem = subItems.get(i);
id = String.valueOf(subItem.getIdentifier());
if (subItem.isSelected()) {
selections.add(id);
}
findSubItemSelections(subItem, selections);
}
}
}
Aggregations