fix: comment navigation at list ends (#982)
This commit is contained in:
parent
dd2f6432a5
commit
fe55a626b3
@ -959,7 +959,7 @@ class PostDetailViewModel(
|
|||||||
}
|
}
|
||||||
val viewIndex =
|
val viewIndex =
|
||||||
if (newIndex == lastCommentNavigateIndex) {
|
if (newIndex == lastCommentNavigateIndex) {
|
||||||
((lastCommentNavigateIndex ?: newIndex) - 1).coerceAtLeast(0)
|
((lastCommentNavigateIndex ?: newIndex) - 1).coerceAtLeast(1)
|
||||||
} else {
|
} else {
|
||||||
newIndex
|
newIndex
|
||||||
}
|
}
|
||||||
@ -992,7 +992,7 @@ class PostDetailViewModel(
|
|||||||
if (newIndex == lastCommentNavigateIndex) {
|
if (newIndex == lastCommentNavigateIndex) {
|
||||||
(lastCommentNavigateIndex ?: newIndex) + 1
|
(lastCommentNavigateIndex ?: newIndex) + 1
|
||||||
} else {
|
} else {
|
||||||
newIndex
|
newIndex.coerceAtLeast(lastCommentNavigateIndex ?: 0)
|
||||||
}
|
}
|
||||||
// save last scrolled index to make function strictly increasing
|
// save last scrolled index to make function strictly increasing
|
||||||
lastCommentNavigateIndex = viewIndex
|
lastCommentNavigateIndex = viewIndex
|
||||||
|
Loading…
x
Reference in New Issue
Block a user