Skip to content

Commit

Permalink
fix 优化判断是否能加载更多逻辑
Browse files Browse the repository at this point in the history
  • Loading branch information
youlookwhat committed Oct 23, 2022
1 parent d334931 commit 9ebc828
Showing 1 changed file with 4 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down Expand Up @@ -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;
Expand Down Expand Up @@ -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;
Expand Down Expand Up @@ -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() {
Expand Down

0 comments on commit 9ebc828

Please sign in to comment.