onItemAtEndLoaded not always called
See original GitHub issueI’m using the PagingNetworkExample (room + network) where onItemAtEndLoaded is not called when i fast scroll down the list and to make it load more data from the network i have to scroll up a little and scroll back down.
This is my list:
val config = PagedList.Config.Builder()
.setPageSize(20)
.setInitialLoadSizeHint(20)
// .setPrefetchDistance(10)
.setEnablePlaceholders(false)
.build()
runBlocking {
moviesList = LivePagedListBuilder(
CinemaDatabase.getInstance(application)
.popularMoviesDao()
.getMoviesDataSource(), config)
.setBackgroundThreadExecutor(BackgroundThreadExecutor())
.setBoundaryCallback(PopularMoviesBoundaryCallback(application))
.build()
}
The Room part:
@Query(...)
fun getMoviesDataSource(): DataSource.Factory<Int, MoviesEntity>
The BoundaryCallback:
class PopularMoviesBoundaryCallback(val context: Context) : PagedList.BoundaryCallback<MoviesEntity>() {
override fun onZeroItemsLoaded() = SyncUtils.initialize(context)
override fun onItemAtEndLoaded(itemAtEnd: MoviesEntity) {
val prefs = defaultPrefs(context)
fetchPopularMoviesData(context = context, page = prefs[KEY_PAGE_POPULAR, 1] + 1)
prefs[KEY_PAGE_POPULAR] = prefs[KEY_PAGE_POPULAR, 1] + 1
}
}
Issue Analytics
- State:
- Created 6 years ago
- Comments:16 (2 by maintainers)
Top Results From Across the Web
onItemAtEndLoaded not always called · Issue #307 - GitHub
I'm using the PagingNetworkExample (room + network) where onItemAtEndLoaded is not called when i fast scroll down the list and to make it ......
Read more >OnItemAtEndLoaded() called infinitely even when not at ...
In my implementation of Android paging library 2.0, the OnItemAtEndLoaded() is called numerous times even when not scrolled to the bottom of ...
Read more >PagedList.BoundaryCallback - Android Developers
If for example onItemAtEndLoaded(Object) triggers a network load, ... Keys are not known because the BoundaryCallback is independent of the ...
Read more >OnItemAtEndLoaded called only once [135966530]
After it loads new items, when you scroll down to the end of the page, it will not be called again. Here is...
Read more >OnItemAtEndLoaded() called infinitely even when not at ...
[Solved]-OnItemAtEndLoaded() called infinitely even when not at bottom of list-kotlin. Search. score:0. Apparently this was an issue with my recycler view ...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
@msayan Did changing placeholders help you? I think this bug is related to the paging library, as the link you provided claims to have been fixed on Jan 18th, 2018, but we are experiencing this bug with the latest provided code sample, still.
Thanks for all the replies here - appreciate filing against our issuetracker as well. As noted in the bug, this v2 api has been superseded by
RemoteMediator
in v3, so I don’t really anticipate fixes as there is still a lot to do and realistically this won’t make it before v3 goes stable 😦