Skip to content

Commit 9ebc828

Browse files
committed
fix 优化判断是否能加载更多逻辑
1 parent d334931 commit 9ebc828

File tree

1 file changed

+4
-4
lines changed

1 file changed

+4
-4
lines changed

ByRecyclerview/src/main/java/me/jingbin/library/ByRecyclerView.java

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -188,7 +188,7 @@ public void loadMoreEnd() {
188188
* Load more failures. Continue to pull up or click load.
189189
*/
190190
public void loadMoreFail() {
191-
if (getLoadMoreSize() == 0 || mLoadMore.getFailureView() == null || mLoadMoreListener == null) {
191+
if (getLoadMoreSize() == 0 || mLoadMore.getFailureView() == null) {
192192
return;
193193
}
194194
mLoadMore.setState(BaseLoadMore.STATE_FAILURE);
@@ -791,7 +791,7 @@ public boolean isRefreshHeader(int position) {
791791
* Is it a LoadMoreView layout
792792
*/
793793
public boolean isLoadMoreView(int position) {
794-
if (mLoadMoreEnabledStatus == 1 || mLoadMoreEnabledStatus == 2) {
794+
if (isLoadMoreEnabled()) {
795795
return position == mWrapAdapter.getItemCount() - 1;
796796
} else {
797797
return false;
@@ -1047,7 +1047,7 @@ public int getPullHeaderSize() {
10471047
* If a pull-up refresh is used, position needs to be counted
10481048
*/
10491049
public int getLoadMoreSize() {
1050-
if (mLoadMoreEnabledStatus == 1 || mLoadMoreEnabledStatus == 2) {
1050+
if (isLoadMoreEnabled()) {
10511051
return 1;
10521052
} else {
10531053
return 0;
@@ -1408,7 +1408,7 @@ public boolean isRefreshEnabled() {
14081408
}
14091409

14101410
public boolean isLoadMoreEnabled() {
1411-
return mLoadMoreEnabledStatus == 1 || mLoadMoreEnabledStatus == 2;
1411+
return mLoadMoreListener != null && (mLoadMoreEnabledStatus == 1 || mLoadMoreEnabledStatus == 2);
14121412
}
14131413

14141414
public boolean isHeaderViewEnabled() {

0 commit comments

Comments
 (0)