github CymChad/BaseRecyclerViewAdapterHelper 4.4.2

4 hours ago

🎯 重点修复

修复 Maven 消费者无法编译的问题

recyclerview / annotation 依赖此前以 implementation 方式发布,POM 中为 runtime scope。如果使用方项目没有自行引入 recyclerview,编译时会报 Cannot access RecyclerView.ViewHolder。现已改为 api,无需任何手动处理。

🐛 Bug 修复

  • 修复 clearBeforeAdapters() / clearAfterAdapters() 后预加载失效的问题
    清空 Before/After Adapter 后,加载更多的预加载监听器没有恢复到 contentAdapter,导致预加载从此不再触发。

  • 修复 LoadStateAdapter 状态更新顺序
    先更新 loadState 再 notify,符合 Adapter 数据更新约定,notify 期间同步读取 getItemCount() 的观察者不再看到旧状态。

  • 修复 Kotlin K2 下的编译错误
    isEmptyViewHolder 扩展属性去掉 inline(public inline 声明访问 internal 类型在 K2 下为编译错误)。无 API 变化。

⚠️ 行为变更

BaseSingleItemAdapter 不再支持 stateView / emptyView

此前它的 items 恒为空列表,一旦开启 stateView,真实 item 会被空状态布局永久顶替且无任何报错。现在 stateView 设置将被忽略,真实 item 始终显示。如需占位效果,请在 onBindViewHolder 中自行处理 item == null 的情况。

另外,swap() / move() 现在与其它数据变更方法一致,调用将抛出异常(本来也不该对单 item 使用)。

📦 依赖

implementation("io.github.cymchad:BaseRecyclerViewAdapterHelper4:4.4.2")

升级无破坏性变更,直接替换版本号即可。


🎯 Highlight

Fix Maven consumers failing to compile

Previously recyclerview / annotation were published with implementation, which maps to runtime scope in the POM. Consumers whose projects did not declare recyclerview themselves failed to compile with Cannot access RecyclerView.ViewHolder. They are now exposed as api — no manual workaround needed.

🐛 Bug Fixes

  • Fixed preload silently stopping after clearBeforeAdapters() / clearAfterAdapters()
    The load-more preload listeners were not restored to the contentAdapter after clearing the Before/After adapters, so preload never triggered again.

  • Fixed LoadStateAdapter update order
    loadState is now updated before notifying, following the Adapter convention, so observers reading getItemCount() synchronously during a notify no longer see a stale state.

  • Fixed Kotlin K2 compilation error
    Removed inline from the isEmptyViewHolder extension (public inline declarations accessing internal types are compile errors under Kotlin K2). No API change.

⚠️ Behavior Change

BaseSingleItemAdapter no longer supports stateView / emptyView

Previously, enabling stateView on a BaseSingleItemAdapter permanently replaced the real item with the state layout, silently — because its items is always an empty list. The state view is now ignored and the real item always shows. To show a placeholder, handle item == null yourself in onBindViewHolder.

Also, swap() / move() now throw like the other mutation methods (they never made sense for a single-item adapter).

📦 Dependency

implementation("io.github.cymchad:BaseRecyclerViewAdapterHelper4:4.4.2")

Upgrading is non-breaking — just bump the version.

Don't miss a new BaseRecyclerViewAdapterHelper release

NewReleases is sending notifications on new releases.