Skip to content

Commit 9826cac

Browse files
committed
修复数组越界bug
1 parent c9085e7 commit 9826cac

File tree

2 files changed

+5
-4
lines changed

2 files changed

+5
-4
lines changed

README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ RecyclerViewHelper是基于android 原生库RecyclerView的功能扩展,扩展
1717

1818
## 添加依赖
1919
```gradle
20-
compile 'com.cncoderx.recyclerviewhelper:library:1.2.2'
20+
compile 'com.github.CNCoderX:RecyclerViewHelper:1.2.3'
2121
2222
// 如果需要添加抽屉功能,添加依赖:
2323
compile "com.daimajia.swipelayout:library:1.2.0@aar"

library/src/main/java/com/cncoderx/recyclerviewhelper/adapter/DelegateAdapter.java

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -148,12 +148,13 @@ private boolean isFullSpan(int position) {
148148

149149
final int adjPosition = position - numHeaderView;
150150
final int itemCount = mAdapter.getItemCount();
151+
final int lastPosition = adjPosition - itemCount;
151152
if (mLoadViewHolder != null && mLoadViewHolder.getState() != ILoadingView.STATE_GONE
152-
&& adjPosition == itemCount + numFooterView) {
153+
&& lastPosition == numFooterView) {
153154
return mLoadViewHolder.isFullSpan;
154155
}
155-
if (adjPosition >= itemCount) {
156-
return mFooterViewHolders.get(adjPosition - itemCount).isFullSpan;
156+
if (lastPosition >= 0 && lastPosition < numFooterView) {
157+
return mFooterViewHolders.get(lastPosition).isFullSpan;
157158
}
158159
return false;
159160
}

0 commit comments

Comments
 (0)