我有一个领域数据库,并且正在从中加载一个庞大的列表,并使用君主制和PagedListAdapter进行显示。一切正常,但现在我想更新PagedList以插入一些标题项。
我的问题是PagedList的add
方法未实现。
我当前的代码:
val monarchy = Monarchy.Builder().build()
val realmDataSourceFactory = monarchy.createDataSourceFactory { realm -> realm.where<Customer>().sort(RealmCustomer::lastName.name) }
val dataSourceFactory = realmDataSourceFactory
.map { it.toCustomerListItem() }
customers = monarchy.findAllPagedWithChanges(realmDataSourceFactory, LivePagedListBuilder(dataSourceFactory, 50))
和“活动”中的
val adapter = CustomerAdapter()
viewModel.customers.observe(this, Observer { pagedList ->
pagedList?.let {
adapter.submitList(it)
}
})
customerListRecyclerView.adapter = adapter
我/我需要在哪里添加标题项?