From 9ebc828c6dd8abd911e0c8952817aa4d6b63b204 Mon Sep 17 00:00:00 2001 From: youlookwhat <770413277@qq.com> Date: Sun, 23 Oct 2022 10:28:18 +0800 Subject: [PATCH] =?UTF-8?q?fix=20=E4=BC=98=E5=8C=96=E5=88=A4=E6=96=AD?= =?UTF-8?q?=E6=98=AF=E5=90=A6=E8=83=BD=E5=8A=A0=E8=BD=BD=E6=9B=B4=E5=A4=9A?= =?UTF-8?q?=E9=80=BB=E8=BE=91?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../src/main/java/me/jingbin/library/ByRecyclerView.java | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/ByRecyclerview/src/main/java/me/jingbin/library/ByRecyclerView.java b/ByRecyclerview/src/main/java/me/jingbin/library/ByRecyclerView.java index 06106e6..b2680aa 100644 --- a/ByRecyclerview/src/main/java/me/jingbin/library/ByRecyclerView.java +++ b/ByRecyclerview/src/main/java/me/jingbin/library/ByRecyclerView.java @@ -188,7 +188,7 @@ public void loadMoreEnd() { * Load more failures. Continue to pull up or click load. */ public void loadMoreFail() { - if (getLoadMoreSize() == 0 || mLoadMore.getFailureView() == null || mLoadMoreListener == null) { + if (getLoadMoreSize() == 0 || mLoadMore.getFailureView() == null) { return; } mLoadMore.setState(BaseLoadMore.STATE_FAILURE); @@ -791,7 +791,7 @@ public boolean isRefreshHeader(int position) { * Is it a LoadMoreView layout */ public boolean isLoadMoreView(int position) { - if (mLoadMoreEnabledStatus == 1 || mLoadMoreEnabledStatus == 2) { + if (isLoadMoreEnabled()) { return position == mWrapAdapter.getItemCount() - 1; } else { return false; @@ -1047,7 +1047,7 @@ public int getPullHeaderSize() { * If a pull-up refresh is used, position needs to be counted */ public int getLoadMoreSize() { - if (mLoadMoreEnabledStatus == 1 || mLoadMoreEnabledStatus == 2) { + if (isLoadMoreEnabled()) { return 1; } else { return 0; @@ -1408,7 +1408,7 @@ public boolean isRefreshEnabled() { } public boolean isLoadMoreEnabled() { - return mLoadMoreEnabledStatus == 1 || mLoadMoreEnabledStatus == 2; + return mLoadMoreListener != null && (mLoadMoreEnabledStatus == 1 || mLoadMoreEnabledStatus == 2); } public boolean isHeaderViewEnabled() {