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 {
|
runOnUiThread {
|
||||||
refreshMenuItems()
|
refreshMenuItems()
|
||||||
getOrCreateThreadAdapter().apply {
|
getOrCreateThreadAdapter().apply {
|
||||||
|
val layoutManager = thread_messages_list.layoutManager as LinearLayoutManager
|
||||||
val lastPosition = itemCount - 1
|
val lastPosition = itemCount - 1
|
||||||
val lastVisiblePosition = (thread_messages_list.layoutManager as LinearLayoutManager).findLastVisibleItemPosition()
|
val lastVisiblePosition = layoutManager.findLastVisibleItemPosition()
|
||||||
val scrollPosition = if (currentList.lastOrNull() != threadItems.lastOrNull() && lastPosition - lastVisiblePosition <= 2) {
|
val shouldScrollToBottom = currentList.lastOrNull() != threadItems.lastOrNull() && lastPosition - lastVisiblePosition == 1
|
||||||
lastPosition
|
updateMessages(threadItems, if (shouldScrollToBottom) lastPosition else -1)
|
||||||
} else {
|
|
||||||
-1
|
|
||||||
}
|
|
||||||
updateMessages(threadItems, scrollPosition)
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue