Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

executeLoadMore()逻辑问题,会造成lcok始终为true,不能加载,一直显示加载动画。 #20

Open
L444m opened this issue Nov 20, 2017 · 0 comments

Comments

@L444m
Copy link

L444m commented Nov 20, 2017

RecyclerViewFinal中executeLoadMore():

void executeLoadMore() {
    if(!mLoadMoreLock && mHasLoadMore) {
        if (mOnLoadMoreListener != null) {
            mOnLoadMoreListener.loadMore();
        }
        mLoadMoreLock = true;//上锁
        showLoadingUI();
    }
}

loadMore()是数据加载业务,在完成数据加载后,一般会调用RecyclerViewFinal.setHasLoadMore(true)去释放锁。但是如果 loadMore() 很快就结束,那么 mLoadMoreLock 就始终为 true.
下次再 load more 的时候,就会只显示加载动画,不会执行。

建议更改:

mLoadMoreLock = true;//上锁
if (mOnLoadMoreListener != null) {
    mOnLoadMoreListener.loadMore();
}
showLoadingUI();
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant