/** * additional data; * * @param newData */ public void addData(List<T> newData) { this.mData.addAll(newData); notifyItemRangeInserted(mData.size() - newData.size() + getHeaderLayoutCount(), newData.size()); }
/** * add new data in to certain location * * @param position */ public void addData(int position, List<T> data) { if (isEmpty()) { return; } position = getPosition(position); mData.addAll(position, data); notifyItemRangeInserted(position + getHeaderLayoutCount(), data.size()); }
if (animate) { notifyItemChanged(parentPos); notifyItemRangeInserted(parentPos + 1, subItemCount); } else { notifyDataSetChanged();
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; }