Skip to content

Commit

Permalink
修改 load more 判断逻辑
Browse files Browse the repository at this point in the history
  • Loading branch information
yuluyao committed Apr 21, 2018
1 parent c98fa2e commit 1028bef
Showing 1 changed file with 14 additions and 7 deletions.
21 changes: 14 additions & 7 deletions chick/src/main/java/capsule/chick/ChickAdapter.java
Original file line number Diff line number Diff line change
Expand Up @@ -306,16 +306,23 @@ private void setupLoadMore(final OnLoadMoreListener listener) {
if (mData.size() > 0//有item
&& newState == RecyclerView.SCROLL_STATE_IDLE//没有在滑动
&& !(loadDecor.isLoading())) {//没有正在加载
View lastVisibleView = recyclerView.getChildAt(recyclerView.getChildCount() - 1);
int lastVisiblePosition = recyclerView.getChildLayoutPosition(lastVisibleView);
if (lastVisiblePosition >= layoutManager.getItemCount() - 1) {//到了最底部
//if (loadDecor.isAble()) {
// loadDecor.setBegin();
//} else {

boolean isBottom = recyclerView.canScrollVertically(-1);
if (isBottom) {
loadDecor.setLoading();
listener.onLoadMore();
//}
}

// View lastVisibleView = recyclerView.getChildAt(recyclerView.getChildCount() - 1);
// int lastVisiblePosition = recyclerView.getChildLayoutPosition(lastVisibleView);
// if (lastVisiblePosition >= layoutManager.getItemCount() - 1) {//到了最底部
// //if (loadDecor.isAble()) {
// // loadDecor.setBegin();
// //} else {
// loadDecor.setLoading();
// listener.onLoadMore();
// //}
// }
}
}
});
Expand Down

0 comments on commit 1028bef

Please sign in to comment.