fix: maybe fix scroll to bottom issue

This commit is contained in:
0x330a 2023-07-06 11:47:50 +10:00
parent 526e0e4562
commit 9778351006
No known key found for this signature in database
GPG Key ID: 267811D6E6A2698C
1 changed files with 5 additions and 5 deletions

View File

@ -396,11 +396,11 @@ class ConversationActivityV2 : PassphraseRequiredActionBarActivity(), InputBarDe
// instead we check the current position and if there are more than 10 items to scroll
// we jump instantly to the 10th item and scroll from there (this should happen quick
// enough to give a similar scroll effect without having to load everything)
val position = if (reverseMessageList) layoutManager.findFirstVisibleItemPosition() else layoutManager.findLastVisibleItemPosition()
val targetBuffer = if (reverseMessageList) 10 else Math.max(0, (adapter.itemCount - 1) - 10)
if (position > targetBuffer) {
binding?.conversationRecyclerView?.scrollToPosition(targetBuffer)
}
// val position = if (reverseMessageList) layoutManager.findFirstVisibleItemPosition() else layoutManager.findLastVisibleItemPosition()
// val targetBuffer = if (reverseMessageList) 10 else Math.max(0, (adapter.itemCount - 1) - 10)
// if (position > targetBuffer) {
// binding?.conversationRecyclerView?.scrollToPosition(targetBuffer)
// }
binding?.conversationRecyclerView?.post {
binding?.conversationRecyclerView?.smoothScrollToPosition(targetPosition)