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
|
- Memory issue on explore list
|
||||||
- Word "Subscribe" too long in app bar
|
- Word "Subscribe" too long in app bar
|
||||||
- VideoList meta bar can't be dynamic height, causes scroll back issue.
|
- 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
|
- playback rotate on click doesn't re-hide buttons
|
||||||
- Explore list is memory intensive, leak??
|
- Explore list is memory intensive, leak??
|
||||||
- Access Token refresh circular injection problem
|
- 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
|
// 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.
|
// that was closest to the most recently accessed index.
|
||||||
// Anchor position is the most recently accessed index
|
// Anchor position is the most recently accessed index
|
||||||
return state.anchorPosition?.let { anchorPosition ->
|
// return state.anchorPosition?.let { anchorPosition ->
|
||||||
state.closestPageToPosition(anchorPosition)?.prevKey?.plus(1)
|
// state.closestPageToPosition(anchorPosition)?.prevKey?.plus(1)
|
||||||
?: state.closestPageToPosition(anchorPosition)?.nextKey?.minus(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
|
// The refresh key is used for subsequent refresh calls to PagingSource.load after the initial load
|
||||||
override fun getRefreshKey(state: PagingState<Int, Video>): Int? {
|
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
|
// 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.
|
// that was closest to the most recently accessed index.
|
||||||
// Anchor position is the most recently accessed index
|
// Anchor position is the most recently accessed index
|
||||||
return state.anchorPosition?.let { anchorPosition ->
|
// return state.anchorPosition?.let { anchorPosition ->
|
||||||
state.closestPageToPosition(anchorPosition)?.prevKey?.plus(1)
|
// state.closestPageToPosition(anchorPosition)?.prevKey?.plus(1)
|
||||||
?: state.closestPageToPosition(anchorPosition)?.nextKey?.minus(1)
|
// ?: state.closestPageToPosition(anchorPosition)?.nextKey?.minus(1)
|
||||||
}
|
// }
|
||||||
|
return 0
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -180,7 +180,7 @@ fun VideoListScreen(
|
||||||
} else {
|
} else {
|
||||||
itemsIndexed(lazyVideoItems) { item, video ->
|
itemsIndexed(lazyVideoItems) { item, video ->
|
||||||
if (video != null) {
|
if (video != null) {
|
||||||
// Log.v("VLV", video.id.toString() + "-" + item.toString())
|
Log.v("VLV", video.id.toString() + "-" + item.toString())
|
||||||
VideoListItem(
|
VideoListItem(
|
||||||
video = video,
|
video = video,
|
||||||
onItemClick = {
|
onItemClick = {
|
||||||
|
|
Loading…
Reference in New Issue