In my project using PagedListAdapter
for pagination and the app also able to search by keyword.
DAO.kt
@Query("SELECT * FROM Item WHERE name LIKE :keyword")
fun getItems(keyword: String): DataSource.Factory<Int, ItemEntity>
Create
lateinit var itemLivePagedList: LiveData<PagedList<Item>>
.
.
.
val dataSourceFactory = itemUseCase.getItems(keyword)
val boundaryCallback = MyBoundaryCallback(itemUseCase, compositeDisposable, PAGE_SIZE)
itemLivePagedList = LivePagedListBuilder(dataSourceFactory, pagedListConfig)
.setBoundaryCallback(boundaryCallback)
.build()
How can I update the list when keyword changed?