CymChad / CymChad/BaseRecyclerViewAdapterHelper

请问 BaseNodeAdapter 的Footer 可以动态显示隐藏吗?

Open
#3,430 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

形如以下java代码

public class RootNode extends BaseExpandNode implements NodeFooterImp {

    private List<BaseNode> childNode;
    private String title;
    public boolean expand;

    public RootNode(List<BaseNode> childNode, String title) {
        this.childNode = childNode;
        this.title = title;
        this.expand = false;
    }

    /**
     * {@link BaseNode}
     * 重写此方法,获取子节点。如果没有子节点,返回 null 或者 空数组
     *
     * @return child nodes
     */
    @Nullable
    @Override
    public List<BaseNode> getChildNode() {
        return childNode;
    }

    /**
     * {@link NodeFooterImp}
     * (可选实现)
     * 重写此方法,获取脚部节点
     *
     * @return
     */
    @Nullable
    @Override
    public BaseNode getFooterNode() {
        // 想通过model的一个变量控制是否显示footer,就是为了点击此处,收起节点
        if (expand) {
            return new RootFooterNode("收起"); 
        } else {
            return null;
        }
    }
}

image

感谢

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

The example centers on RootNode.getFooterNode(), BaseNodeAdapter, and NodeFooterImp. Start by tracing how BaseNodeAdapter reads getFooterNode() and handles node changes; verify whether changing expand can update the footer after binding. Done means a tested way to show and hide the footer dynamically.

Written by the indexing model from the issue text.

Assessment

Tech stack
android, java
Domain
mobile
Issue type
Feature
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.