mirror of
https://github.com/msfjarvis/compose-lobsters
synced 2025-08-15 02:57:04 +05:30
chore: minor formatting tweak
This commit is contained in:
parent
f2f3319ac4
commit
1ef6b2bf91
1 changed files with 6 additions and 5 deletions
|
@ -39,11 +39,6 @@ constructor(
|
||||||
private val savedPostsRepository: SavedPostsRepository,
|
private val savedPostsRepository: SavedPostsRepository,
|
||||||
private val readPostsRepository: ReadPostsRepository,
|
private val readPostsRepository: ReadPostsRepository,
|
||||||
) : PagingSource<Int, UIPost>() {
|
) : PagingSource<Int, UIPost>() {
|
||||||
override fun getRefreshKey(state: PagingState<Int, UIPost>): Int? {
|
|
||||||
return state.anchorPosition?.let { anchorPosition ->
|
|
||||||
(anchorPosition / PAGE_SIZE).coerceAtLeast(STARTING_PAGE_INDEX)
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
override suspend fun load(params: LoadParams<Int>): LoadResult<Int, UIPost> {
|
override suspend fun load(params: LoadParams<Int>): LoadResult<Int, UIPost> {
|
||||||
val searchQuery = queryProvider()
|
val searchQuery = queryProvider()
|
||||||
|
@ -81,6 +76,12 @@ constructor(
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
override fun getRefreshKey(state: PagingState<Int, UIPost>): Int? {
|
||||||
|
return state.anchorPosition?.let { anchorPosition ->
|
||||||
|
(anchorPosition / PAGE_SIZE).coerceAtLeast(STARTING_PAGE_INDEX)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
@AssistedFactory
|
@AssistedFactory
|
||||||
interface Factory {
|
interface Factory {
|
||||||
fun create(queryProvider: () -> String): SearchPagingSource
|
fun create(queryProvider: () -> String): SearchPagingSource
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue