/** * notifies the fastAdapter about new / removed items within a sub hierarchy * NOTE this currently only works for sub items with only 1 level * * @param position the global position of the parent item * @param previousCount the previous count of sub items * @return the new count of subItems */ public int notifyAdapterSubItemsChanged(int position, int previousCount) { Item item = mFastAdapter.getItem(position); if (item != null && item instanceof IExpandable) { IExpandable expandable = (IExpandable) item; IAdapter adapter = mFastAdapter.getAdapter(position); if (adapter != null && adapter instanceof IItemAdapter) { ((IItemAdapter) adapter).removeRange(position + 1, previousCount); ((IItemAdapter) adapter).add(position + 1, expandable.getSubItems()); } return expandable.getSubItems().size(); } return 0; }
((IItemAdapter) adapter).removeRange(position + 1, expandedItemsCount[0]);