CymChad / CymChad/BaseRecyclerViewAdapterHelper

版本: 2.9.40 上拉加载刷新不会触发回调onLoadMoreRequested

Open
#3,434 1 comment 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
Kotlin
Stars
24.6k
Forks
5.2k
PR merge metrics
No merged PRs in 30d

Description

场景: 一个父Fragment中界面组成:Tablayout+viewpager+fragment

Fragment中的列表需要根据父Fragment中选择的城市,返回不同的tablayout类目数据,fragment也重新实例(ARouter方式实例Fragment)展示不同的数据. (其实就是切换城市整个界面重新绘制)。 这个时候上啦加载的View 是展示出来的,但是没有触发onLoadMoreRequested回调。

    private void autoLoadMore(int position) {
        if (getLoadMoreViewCount() == 0) {
            return;
        }
        if (position < getItemCount() - mPreLoadNumber) {
            return;
        }
        if (mLoadMoreView.getLoadMoreStatus() != LoadMoreView.STATUS_DEFAULT) {
            return;
        }
        mLoadMoreView.setLoadMoreStatus(LoadMoreView.STATUS_LOADING);
        if (!mLoading) {
            mLoading = true;
            if (getRecyclerView() != null) {
//断点进入了这里
                getRecyclerView().post(new Runnable() {
                    @Override
                    public void run() {
// 但是run 没有执行
                        mRequestLoadMoreListener.onLoadMoreRequested();
                    }
                });
            } else {
                mRequestLoadMoreListener.onLoadMoreRequested();
            }
        }
    }

Contributor guide

No contributing guide indexed for this repository

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start with the autoLoadMore method shown in the report, especially the RecyclerView.post call, and reproduce the parent Fragment, ViewPager, and recreated Fragment scenario. Determine why the posted runnable does not invoke onLoadMoreRequested; done means upward loading reliably triggers the callback. No file or test is named in the issue.

Written by the indexing model from the issue text.

Assessment

Tech stack
android, java
Domain
mobile
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Needs clarification
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.