/** * Expand an expandable item * * @param position position of the item, which includes the header layout count. * @param animate expand items with animation * @return the number of items that have been added. */ public int expand(@IntRange(from = 0) int position, boolean animate) { return expand(position, animate, true); }
/** * Expand an expandable item with animation. * * @param position position of the item, which includes the header layout count. * @return the number of items that have been added. */ public int expand(@IntRange(from = 0) int position) { return expand(position, true, true); }
public int expandAll(int position, boolean animate, boolean notify) { position -= getHeaderLayoutCount(); T endItem = null; if (position + 1 < this.mData.size()) { endItem = getItem(position + 1); } IExpandable expandable = getExpandableItem(position); if (!hasSubItems(expandable)) { return 0; } int count = expand(position + getHeaderLayoutCount(), false, false); for (int i = position + 1; i < this.mData.size(); i++) { T item = getItem(i); if (item == endItem) { break; } if (isExpandable(item)) { count += expand(i + getHeaderLayoutCount(), false, false); } } if (notify) { if (animate) { notifyItemRangeInserted(position + getHeaderLayoutCount() + 1, count); } else { notifyDataSetChanged(); } } return count; }