mirror of
https://github.com/SimpleMobileTools/Simple-SMS-Messenger.git
synced 2025-06-05 21:49:22 +02:00
Reduce minimum scroll distance to 1
This commit is contained in:
@ -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)
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user