public int expand(@IntRange(from=0) int position,boolean animate,boolean shouldNotify){
  position-=getHeaderLayoutCount();
  IExpandable expandable=getExpandableItem(position);
  if (expandable == null) {
    return 0;
  }
  if (!hasSubItems(expandable)) {
    expandable.setExpanded(false);
    return 0;
  }
  int subItemCount=0;
  if (!expandable.isExpanded()) {
    List list=expandable.getSubItems();
    mData.addAll(position + 1,list);
    subItemCount+=recursiveExpand(position + 1,list);
    expandable.setExpanded(true);
    subItemCount+=list.size();
  }
  int parentPos=position + getHeaderLayoutCount();
  if (shouldNotify) {
    if (animate) {
      notifyItemChanged(parentPos);
      notifyItemRangeInserted(parentPos + 1,subItemCount);
    }
 else {
      notifyDataSetChanged();
    }
  }
  return subItemCount;
}

public int expand ( @ IntRange ( from = 0 ) int position , boolean animate , boolean shouldNotify ) { position -= getHeaderLayoutCount ( ) ; IExpandable expandable = getExpandableItem ( position ) ; if ( expandable == null ) { return 0 ; } if ( ! hasSubItems ( expandable ) ) { expandable . setExpanded ( false ) ; return 0 ; } int subItemCount = 0 ; if ( ! expandable . isExpanded ( ) ) { List list = expandable . getSubItems ( ) ; mData . addAll ( position + 1 , list ) ; subItemCount += recursiveExpand ( position + 1 , list ) ; expandable . setExpanded ( true ) ; subItemCount += list . size ( ) ; } int parentPos = position + getHeaderLayoutCount ( ) ; if ( shouldNotify ) { if ( animate ) { notifyItemChanged ( parentPos ) ; notifyItemRangeInserted ( parentPos + 1 , subItemCount ) ; } else { notifyDataSetChanged ( ) ; } } return subItemCount ; }
expand an expandable item
