This commit is contained in:
Niels Andriesse 2021-06-24 09:34:16 +10:00
parent 1b6ddc0c0b
commit 311a298c0c
2 changed files with 4 additions and 6 deletions

View File

@ -25,17 +25,15 @@ class ConversationRecyclerView : RecyclerView {
private fun initialize() {
disableClipping()
addOnScrollListener(object : RecyclerView.OnScrollListener() {
private var maxScrollOffset = 0
private var bottomOffset = 0
override fun onScrollStateChanged(recyclerView: RecyclerView, newState: Int) {
// Do nothing
}
override fun onScrolled(recyclerView: RecyclerView, dx: Int, dy: Int) {
val scrollOffset = recyclerView.computeVerticalScrollOffset()
maxScrollOffset = max(maxScrollOffset, scrollOffset)
val bottomOffset = (maxScrollOffset - scrollOffset)
delegate?.handleConversationRecyclerViewBottomOffsetChanged(bottomOffset)
bottomOffset += dy // FIXME: Not sure this is fully accurate, but it seems close enough
delegate?.handleConversationRecyclerViewBottomOffsetChanged(abs(bottomOffset))
}
})
}

View File

@ -156,7 +156,7 @@
android:gravity="center"
android:layout_alignParentEnd="true"
android:layout_alignParentBottom="true"
android:layout_marginEnd="16dp"
android:layout_marginEnd="14dp"
android:layout_marginBottom="72dp"
android:paddingVertical="8dp"
android:background="@drawable/view_lock_background">