Reduce minimum scroll distance to 1
This commit is contained in:
parent
bdafa4b847
commit
fce31b7bcf
1 changed files with 4 additions and 7 deletions
|
|
@ -394,14 +394,11 @@ class ThreadActivity : SimpleActivity() {
|
|||
runOnUiThread {
|
||||
refreshMenuItems()
|
||||
getOrCreateThreadAdapter().apply {
|
||||
val layoutManager = thread_messages_list.layoutManager as LinearLayoutManager
|
||||
val lastPosition = itemCount - 1
|
||||
val lastVisiblePosition = (thread_messages_list.layoutManager as LinearLayoutManager).findLastVisibleItemPosition()
|
||||
val scrollPosition = if (currentList.lastOrNull() != threadItems.lastOrNull() && lastPosition - lastVisiblePosition <= 2) {
|
||||
lastPosition
|
||||
} else {
|
||||
-1
|
||||
}
|
||||
updateMessages(threadItems, scrollPosition)
|
||||
val lastVisiblePosition = layoutManager.findLastVisibleItemPosition()
|
||||
val shouldScrollToBottom = currentList.lastOrNull() != threadItems.lastOrNull() && lastPosition - lastVisiblePosition == 1
|
||||
updateMessages(threadItems, if (shouldScrollToBottom) lastPosition else -1)
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue