@Override public void onClick(View v) { if (mLoadMoreView.getLoadMoreStatus() == LoadMoreView.STATUS_FAIL) { mLoadMoreView.setLoadMoreStatus(LoadMoreView.STATUS_DEFAULT); notifyItemChanged(getHeaderLayoutCount() + mData.size() + getFooterLayoutCount()); } } });
/** * Refresh complete */ public void loadMoreComplete() { if (getLoadMoreViewCount() == 0) { return; } mLoading = false; mLoadMoreView.setLoadMoreStatus(LoadMoreView.STATUS_DEFAULT); notifyItemChanged(getHeaderLayoutCount() + mData.size() + getFooterLayoutCount()); }
/** * Refresh failed */ public void loadMoreFail() { if (getLoadMoreViewCount() == 0) { return; } mLoading = false; mLoadMoreView.setLoadMoreStatus(LoadMoreView.STATUS_FAIL); notifyItemChanged(getHeaderLayoutCount() + mData.size() + getFooterLayoutCount()); }
/** * @param position */ public void setItemChecked(int position) { if (mLastCheckedPosition == position) return; mBooleanArray.put(position, true); if (mLastCheckedPosition > -1) { mBooleanArray.put(mLastCheckedPosition, false); mAdapter.notifyItemChanged(mLastCheckedPosition); } mAdapter.notifyDataSetChanged(); mLastCheckedPosition = position; }
/** * Refresh end, no more data * * @param gone if true gone the load more view */ public void loadMoreEnd(boolean gone) { if (getLoadMoreViewCount() == 0) { return; } mLoading = false; mNextLoadEnable = false; mLoadMoreView.setLoadMoreEndGone(gone); if (gone) { notifyItemRemoved(getHeaderLayoutCount() + mData.size() + getFooterLayoutCount()); } else { mLoadMoreView.setLoadMoreStatus(LoadMoreView.STATUS_END); notifyItemChanged(getHeaderLayoutCount() + mData.size() + getFooterLayoutCount()); } }
/** * 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; }
if (shouldNotify) { if (animate) { notifyItemChanged(parentPos); notifyItemRangeInserted(parentPos + 1, subItemCount); } else {