BaseQuickAdapter.java 文件源码

java
阅读 56 收藏 0 点赞 0 评论 0

项目:ThreeExpandItem 作者:
/**
 * Collapse an expandable item that has been expanded..
 *
 * @param position the position of the item, which includes the header layout count.
 * @param animate  collapse with animation or not.
 * @param notify   notify the recyclerView refresh UI or not.
 * @return the number of subItems collapsed.
 */
public int collapse(@IntRange(from = 0) int position, boolean animate, boolean notify) {
    position -= getHeaderLayoutCount();

    IExpandable expandable = getExpandableItem(position);
    if (expandable == null) {
        return 0;
    }
    int subItemCount = recursiveCollapse(position);
    expandable.setExpanded(false);
    int parentPos = position + getHeaderLayoutCount();
    if (notify) {
        if (animate) {
            notifyItemChanged(parentPos);
            notifyItemRangeRemoved(parentPos + 1, subItemCount);
        } else {
            notifyDataSetChanged();
        }
    }
    return subItemCount;
}
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号