CymChad / CymChad/BaseRecyclerViewAdapterHelper

BaseNodeAdapter树形列表上拉加载更多怎么刷新数据呢?根据官方的部分例子,我这样刷新不行

Open
#3,174 0 comments 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

在loadMore回调函数我这样处理的:
@Override
public void onLoadMore() {
new Handler().postDelayed(new Runnable() {
@Override
public void run() {
// mAdapter.nodeAddData(new FirstNode(),getEntity());
// mDatas.addAll(getEntity());
mAdapter.setList(getEntity());
mAdapter.getLoadMoreModule().loadMoreComplete();
}
},1000);
}

private List getEntity() {
//总的 list,里面放的是 FirstNode
List list = new ArrayList<>();

    for (int i = 0; i < 5; i++) {
        //SecondNode 的 list
        List<BaseNode> secondNodeList = new ArrayList<>();
        for (int n = 0; n <= 3; n++) {
            SecondNode seNode = new SecondNode("Second Node " + n);
            secondNodeList.add(seNode);
        }
        FirstNode entity = new FirstNode(secondNodeList, "First Node " + i);
        list.add(entity);
    }
    return list;
}

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 at the BaseNodeAdapter onLoadMore callback and compare the shown setList(getEntity()) call with the commented nodeAddData and mDatas.addAll approaches. Verify how the tree data is refreshed before loadMoreComplete() is called; done means newly loaded FirstNode and SecondNode entries appear in the list.

Written by the indexing model from the issue text.

Assessment

Tech stack
android, java
Domain
mobile
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 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.