Add compose divider to CFV2.

This commit is contained in:
Alex Hart
2023-06-30 14:36:40 -03:00
committed by Greyson Parrelli
parent 42fe827cb3
commit 27e7383db6
2 changed files with 30 additions and 4 deletions

View File

@@ -1949,6 +1949,9 @@ class ConversationFragment :
}
private inner class ScrollListener : RecyclerView.OnScrollListener() {
private var wasAtBottom = true
override fun onScrolled(recyclerView: RecyclerView, dx: Int, dy: Int) {
if (isScrolledToBottom()) {
viewModel.setShowScrollButtons(false)
@@ -1956,9 +1959,22 @@ class ConversationFragment :
viewModel.setShowScrollButtons(true)
}
presentComposeDivider()
val timestamp = MarkReadHelper.getLatestTimestamp(adapter, layoutManager)
timestamp.ifPresent(markReadHelper::onViewsRevealed)
}
private fun presentComposeDivider() {
val isAtBottom = isScrolledToBottom()
if (isAtBottom && !wasAtBottom) {
ViewUtil.fadeOut(binding.composeDivider, 50, View.INVISIBLE)
} else if (wasAtBottom && !isAtBottom) {
ViewUtil.fadeIn(binding.composeDivider, 500)
}
wasAtBottom = isAtBottom
}
}
private inner class DataObserver(