mirror of
https://github.com/SimpleMobileTools/Simple-SMS-Messenger.git
synced 2025-02-19 21:20:39 +01:00
Reduce minimum scroll distance to 1
This commit is contained in:
parent
bdafa4b847
commit
fce31b7bcf
@ -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…
x
Reference in New Issue
Block a user