Improve paging behaviour in TimelineTab

This commit is contained in:
Shinokuni 2024-07-12 16:35:17 +02:00
parent 7be074f759
commit fdf6c4f5c1
3 changed files with 5 additions and 4 deletions

View File

@ -63,8 +63,9 @@ class TimelineScreenModel(
it.copy( it.copy(
itemState = Pager( itemState = Pager(
config = PagingConfig( config = PagingConfig(
pageSize = 10, initialLoadSize = 50,
prefetchDistance = 10 pageSize = 50,
prefetchDistance = 15
), ),
pagingSourceFactory = { pagingSourceFactory = {
database.itemDao().selectAll(query) database.itemDao().selectAll(query)

View File

@ -396,7 +396,7 @@ object TimelineTab : Tab {
fun <T : Any> LazyPagingItems<T>.isLoading(): Boolean { fun <T : Any> LazyPagingItems<T>.isLoading(): Boolean {
return loadState.append is LoadState.Loading //|| loadState.refresh is LoadState.Loading return loadState.refresh is LoadState.Loading
} }
fun <T : Any> LazyPagingItems<T>.isError(): Boolean { fun <T : Any> LazyPagingItems<T>.isError(): Boolean {

View File

@ -11,7 +11,7 @@ coil = "2.4.0"
coroutines = "1.8.0" coroutines = "1.8.0"
room = "2.6.1" room = "2.6.1"
koin-bom = "3.5.0" koin-bom = "3.5.0"
paging = "3.2.1" paging = "3.3.0"
okhttp = "4.11.0" okhttp = "4.11.0"
retrofit = "2.9.0" retrofit = "2.9.0"
about_libraries = "11.2.2" about_libraries = "11.2.2"