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

BaseDifferAdapter+QuickAdapterHelper(尾部加载更多)会出现recyclerView默认直接自动滑倒底部BUG #3883

Open
jmhe1 opened this issue Aug 23, 2024 · 0 comments

Comments

@jmhe1
Copy link

jmhe1 commented Aug 23, 2024

private void initAdapter() {
linearLayoutManager = new LinearLayoutManager(getAttachActivity());
linearLayoutManager.setStackFromEnd(false);
recyclerView.setLayoutManager(linearLayoutManager);
recyclerView.addItemDecoration(new VerticalItemDecoration(getResources().getDimensionPixelSize(R.dimen.dp_2), getColor(R.color.common_line_color)));
mDiscoverAdapter = new DiscoverAdapter();

    helper = new QuickAdapterHelper.Builder(mDiscoverAdapter)
            .setTrailingLoadStateAdapter(new TrailingLoadStateAdapter.OnTrailingListener() {
                @Override
                public void onLoad() {
                    request();
                }

                @Override
                public void onFailRetry() {
                    request();
                }

                @Override
                public boolean isAllowLoading() {
                    return !refreshLayout.isRefreshing();
                }
            }).build();
    recyclerView.setItemAnimator(null);
    recyclerView.setAdapter(helper.getAdapter());
}

public void onHttpSuccess(HttpData<List> result) {
if (refreshLayout.isRefreshing()) {
refreshLayout.setRefreshing(false);
}
if (result.isRequestSucceed()) {
List resultList = result.getContent();
if (resultList.isEmpty()) {
helper.setTrailingLoadState(new LoadState.NotLoading(true));
if (pageInfo.isFirstPage()) {
showEmpty();
} else {
showComplete();
}
return;
}
dynamicList.addAll(resultList);
mDiscoverAdapter.submitList(dynamicList);
helper.setTrailingLoadState(new LoadState.NotLoading(false));
showComplete();
pageInfo.nextPage();
}
}

implementation "io.github.cymchad:BaseRecyclerViewAdapterHelper4:4.1.4"

出现的问题是:
执行helper.setTrailingLoadState(new LoadState.NotLoading(false));之后会执行onLoad方法,而且会出现自动滑动到底部

@jmhe1 jmhe1 changed the title BaseDifferAdapter+尾部加载更多会出现recyclerView默认直接滑动到了底部 BaseDifferAdapter+尾部加载更多会出现recyclerView默认直接自动滑倒底部 Aug 23, 2024
@jmhe1 jmhe1 changed the title BaseDifferAdapter+尾部加载更多会出现recyclerView默认直接自动滑倒底部 BaseDifferAdapter+QuickAdapterHelper(尾部加载更多)会出现recyclerView默认直接自动滑倒底部BUG Aug 23, 2024
@jmhe1 jmhe1 changed the title BaseDifferAdapter+QuickAdapterHelper(尾部加载更多)会出现recyclerView默认直接自动滑倒底部BUG BaseDifferAdapter+QuickAdapterHelper(尾部加载更多)会出现recyclerView默认直接自动滑倒底部BUG Aug 23, 2024
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