Zhuinden / realm-monarchy

[ACTIVE-ISH] A wrapper over Realm which exposes it as LiveData, managing Realm lifecycle internally.
Apache License 2.0
88 stars 11 forks source link

BoundaryCallback with Monarchy #31

Closed stevepham closed 4 years ago

stevepham commented 4 years ago

Does Monarchy support BoundaryCallback? I add boundary into LivePagedListBuilder but not received any trigger from them.

Zhuinden commented 4 years ago

Theoretically onZeroItemsLoaded should trigger when you've reached the end, as the behavior itself is directly copied from PositionalDataSource in Room. 🤔

stevepham commented 4 years ago

@Zhuinden , could you please give me advice if I implement monarchy the right way. Here is my implementation: val realmSource = monarchy.createDataSourceFactory(....) // query realm val dataSource = realmSource.map { } // Some mapper between entity and model // Set some config and boundary here val pageList = LivePagedListBuilder<Int, Model>(dataSource, PagedList.Config.Build() monarchy.findAllPagedWithChanged(realmSource, pagedList) // Is it correct for get paging data from realm ` Thanks.

Zhuinden commented 4 years ago

That sounds right, so if I find some free time I'll try to look at whether newer versions of Room implement some magic tricks to manually get an instance of a boundary callback to invoke it or something, I expected this to be handled internally within Paging though.

stevepham commented 4 years ago

Hopefully looking forward you 👍 for this case

Zhuinden commented 4 years ago

I'm sorry, I never figured out why it doesn't work. :/

stevepham commented 4 years ago

So I'll close this