fix: fixed refresh Issue
This commit is contained in:
parent
ed49946fb3
commit
ca0734e977
2
TODO.md
2
TODO.md
|
@ -30,7 +30,7 @@ Issues:
|
|||
- Memory issue on explore list
|
||||
- Word "Subscribe" too long in app bar
|
||||
- VideoList meta bar can't be dynamic height, causes scroll back issue.
|
||||
- Refreshing video list causes odd loading order of video items
|
||||
x Refreshing video list causes odd loading order of video items
|
||||
- playback rotate on click doesn't re-hide buttons
|
||||
- Explore list is memory intensive, leak??
|
||||
- Access Token refresh circular injection problem
|
||||
|
|
|
@ -53,10 +53,12 @@ class SearchPagingSource (
|
|||
// We need to get the previous key (or next key if previous is null) of the page
|
||||
// that was closest to the most recently accessed index.
|
||||
// Anchor position is the most recently accessed index
|
||||
return state.anchorPosition?.let { anchorPosition ->
|
||||
state.closestPageToPosition(anchorPosition)?.prevKey?.plus(1)
|
||||
?: state.closestPageToPosition(anchorPosition)?.nextKey?.minus(1)
|
||||
}
|
||||
// return state.anchorPosition?.let { anchorPosition ->
|
||||
// state.closestPageToPosition(anchorPosition)?.prevKey?.plus(1)
|
||||
// ?: state.closestPageToPosition(anchorPosition)?.nextKey?.minus(1)
|
||||
// }
|
||||
//
|
||||
return 0
|
||||
}
|
||||
|
||||
|
||||
|
|
|
@ -49,13 +49,15 @@ class VideoPagingSource (
|
|||
}
|
||||
// The refresh key is used for subsequent refresh calls to PagingSource.load after the initial load
|
||||
override fun getRefreshKey(state: PagingState<Int, Video>): Int? {
|
||||
Log.v("video1", "getRefreshKey")
|
||||
// We need to get the previous key (or next key if previous is null) of the page
|
||||
// that was closest to the most recently accessed index.
|
||||
// Anchor position is the most recently accessed index
|
||||
return state.anchorPosition?.let { anchorPosition ->
|
||||
state.closestPageToPosition(anchorPosition)?.prevKey?.plus(1)
|
||||
?: state.closestPageToPosition(anchorPosition)?.nextKey?.minus(1)
|
||||
}
|
||||
// return state.anchorPosition?.let { anchorPosition ->
|
||||
// state.closestPageToPosition(anchorPosition)?.prevKey?.plus(1)
|
||||
// ?: state.closestPageToPosition(anchorPosition)?.nextKey?.minus(1)
|
||||
// }
|
||||
return 0
|
||||
}
|
||||
|
||||
|
||||
|
|
|
@ -180,7 +180,7 @@ fun VideoListScreen(
|
|||
} else {
|
||||
itemsIndexed(lazyVideoItems) { item, video ->
|
||||
if (video != null) {
|
||||
// Log.v("VLV", video.id.toString() + "-" + item.toString())
|
||||
Log.v("VLV", video.id.toString() + "-" + item.toString())
|
||||
VideoListItem(
|
||||
video = video,
|
||||
onItemClick = {
|
||||
|
|
Loading…
Reference in New Issue