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

我想马上停止刷新,而不是等动画结束,可以吗,我不知道该怎么调用 #212

Closed
shanyaodan opened this issue Oct 18, 2017 · 8 comments

Comments

@shanyaodan
Copy link

我想马上停止下拉刷新或加载更多,而不是等动画结束,可以吗,我不知道该怎么调用。因为我一个recycleview要马上相应屏幕上不同的按钮

@shanyaodan
Copy link
Author

响应

@scwang90
Copy link
Owner

finishRefresh(0)

@shanyaodan
Copy link
Author

我试过了,但是还是有等待时间,不能立刻停止

@shanyaodan
Copy link
Author

我想立刻停止进行下一次刷新

@shanyaodan
Copy link
Author

finish完成立刻执行autorefresh

@shanyaodan
Copy link
Author

假设屏幕上有两个按钮和一个recyclerview,这时快速点击按钮切换,让recyclerview快速刷新,好像finishRefresh(0)不行吧

@scwang90
Copy link
Owner

动画执行时需要时间的,你可以把回弹动画时间设置为 0

@AvatarQing
Copy link

AvatarQing commented Dec 4, 2017

分享一个解决的办法:

    private void reloadData() {
        if (refreshLayout.getState() == RefreshState.None) {
            refreshLayout.autoRefresh(0);
        } else {
            refreshLayout.setReboundDuration(0);
            refreshLayout.finishRefresh(0);
            refreshLayout.setOnMultiPurposeListener(new SimpleMultiPurposeListener() {
                @Override
                public void onStateChanged(RefreshLayout refreshLayout, RefreshState oldState, RefreshState newState) {
                    if (oldState == RefreshState.RefreshFinish && newState == RefreshState.None) {
                        refreshLayout.setOnMultiPurposeListener(null);
                        refreshLayout.setReboundDuration(250);
                        refreshLayout.autoRefresh(0);
                    }
                }
            });
        }
    }

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

3 participants