android - Android Paging3 insertSeparators 无法按预期工作
问题描述
我正在尝试在我的列表中添加分隔符,例如 A、“Apple”、“Anaconda”、B“Boys”、“Bostwana”,但是,insertSeparators
似乎并没有表明我们何时处于开头或结尾。
adapter.submitData(pagingData.insertSeparators { before, after ->
val afterDate = DateItem().withDate(after?.transactionDate)
val beforeDate = DateItem().withDate(before?.transactionDate)
if (after != null && (before == null || afterDate.toString() != beforeDate?.toString())) {
return@insertSeparators afterDate
}
return@insertSeparators null
})
我的期望是before
在开始时after
为空,而在列表末尾为空。但它永远不会为空,因此很难知道我们何时处于开始或结束。
解决方案
显然这是 paging3 库 3.0.0alpha10 版本上的一个已知错误。
推荐阅读
- ember.js - Ember cli 分页 - 无法接收模型?
- python - 在向量场上变换一个 numpy 矩阵
- javascript - 使用 JSON.stringify 将所有内容存储在 localstorage 上
- node.js - 使用 mongoose find() 设置自定义条件以从模型中查找
- r - Choropleth 地图颜色缺失
- sql - 有没有办法在 Oracle 执行计划中用索引范围扫描替换索引快速全扫描?
- powershell - 无法显示使用 (New-Object -ComObject Microsoft.Update.AutoUpdate) 应用的最后一个 Windows 更新补丁
- javascript - 为什么对象中需要“this”关键字
- python - 将重复的行标签变成熊猫中的列标题
- html - 自定义垫选择下拉菜单以允许角度嵌套值