mirror of
https://github.com/signalapp/Signal-Android.git
synced 2025-12-20 02:58:45 +00:00
Work around off-by-one error causing thin line to display when it shouldn't.
This commit is contained in:
@@ -384,6 +384,7 @@ class ConversationFragment :
|
|||||||
|
|
||||||
private const val SCROLL_HEADER_ANIMATION_DURATION: Long = 100L
|
private const val SCROLL_HEADER_ANIMATION_DURATION: Long = 100L
|
||||||
private const val SCROLL_HEADER_CLOSE_DELAY: Long = SCROLL_HEADER_ANIMATION_DURATION * 4
|
private const val SCROLL_HEADER_CLOSE_DELAY: Long = SCROLL_HEADER_ANIMATION_DURATION * 4
|
||||||
|
private const val IS_SCROLLED_TO_BOTTOM_THRESHOLD: Int = 2
|
||||||
}
|
}
|
||||||
|
|
||||||
private val args: ConversationIntents.Args by lazy {
|
private val args: ConversationIntents.Args by lazy {
|
||||||
@@ -2608,8 +2609,17 @@ class ConversationFragment :
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* The methods used in this method are taken directly from View.canScrollVertically(-1)'s code path.
|
||||||
|
*/
|
||||||
private fun isScrolledToBottom(): Boolean {
|
private fun isScrolledToBottom(): Boolean {
|
||||||
return !binding.conversationItemRecycler.canScrollVertically(1)
|
return with(binding.conversationItemRecycler) {
|
||||||
|
val offset = computeVerticalScrollOffset()
|
||||||
|
val range = computeVerticalScrollRange() - computeVerticalScrollExtent()
|
||||||
|
val delta = range - offset
|
||||||
|
|
||||||
|
delta <= IS_SCROLLED_TO_BOTTOM_THRESHOLD
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private fun isScrolledPastButtonThreshold(): Boolean {
|
private fun isScrolledPastButtonThreshold(): Boolean {
|
||||||
|
|||||||
Reference in New Issue
Block a user