mirror of
https://github.com/oxen-io/session-android.git
synced 2025-04-19 21:51:30 +00:00
Fix typing indicator overlaying recycler view
This commit is contained in:
parent
e147b3f5e9
commit
d3704a6905
@ -129,6 +129,12 @@ class ConversationActivityV2 : PassphraseRequiredActionBarActivity(), InputBarDe
|
|||||||
private var currentMentionStartIndex = -1
|
private var currentMentionStartIndex = -1
|
||||||
private var isShowingMentionCandidatesView = false
|
private var isShowingMentionCandidatesView = false
|
||||||
|
|
||||||
|
private val isScrolledToBottom: Boolean
|
||||||
|
get() {
|
||||||
|
val position = layoutManager.findFirstCompletelyVisibleItemPosition()
|
||||||
|
return position == 0
|
||||||
|
}
|
||||||
|
|
||||||
private val layoutManager: LinearLayoutManager
|
private val layoutManager: LinearLayoutManager
|
||||||
get() { return conversationRecyclerView.layoutManager as LinearLayoutManager }
|
get() { return conversationRecyclerView.layoutManager as LinearLayoutManager }
|
||||||
|
|
||||||
@ -302,7 +308,9 @@ class ConversationActivityV2 : PassphraseRequiredActionBarActivity(), InputBarDe
|
|||||||
private fun setUpTypingObserver() {
|
private fun setUpTypingObserver() {
|
||||||
ApplicationContext.getInstance(this).typingStatusRepository.getTypists(threadID).observe(this) { state ->
|
ApplicationContext.getInstance(this).typingStatusRepository.getTypists(threadID).observe(this) { state ->
|
||||||
val recipients = if (state != null) state.typists else listOf()
|
val recipients = if (state != null) state.typists else listOf()
|
||||||
typingIndicatorViewContainer.isVisible = recipients.isNotEmpty()
|
// FIXME: Also checking isScrolledToBottom is a quick fix for an issue where the
|
||||||
|
// typing indicator overlays the recycler view when scrolled up
|
||||||
|
typingIndicatorViewContainer.isVisible = recipients.isNotEmpty() && isScrolledToBottom
|
||||||
typingIndicatorViewContainer.setTypists(recipients)
|
typingIndicatorViewContainer.setTypists(recipients)
|
||||||
inputBarHeightChanged(inputBar.height)
|
inputBarHeightChanged(inputBar.height)
|
||||||
}
|
}
|
||||||
@ -580,8 +588,15 @@ class ConversationActivityV2 : PassphraseRequiredActionBarActivity(), InputBarDe
|
|||||||
}
|
}
|
||||||
|
|
||||||
private fun handleRecyclerViewScrolled() {
|
private fun handleRecyclerViewScrolled() {
|
||||||
val position = layoutManager.findFirstCompletelyVisibleItemPosition()
|
val alpha = if (!isScrolledToBottom) 1.0f else 0.0f
|
||||||
val alpha = if (position > 0) 1.0f else 0.0f
|
// FIXME: Checking isScrolledToBottom is a quick fix for an issue where the
|
||||||
|
// typing indicator overlays the recycler view when scrolled up
|
||||||
|
val wasTypingIndicatorVisibleBefore = typingIndicatorViewContainer.isVisible
|
||||||
|
typingIndicatorViewContainer.isVisible = wasTypingIndicatorVisibleBefore && isScrolledToBottom
|
||||||
|
val isTypingIndicatorVisibleAfter = typingIndicatorViewContainer.isVisible
|
||||||
|
if (isTypingIndicatorVisibleAfter != wasTypingIndicatorVisibleBefore) {
|
||||||
|
inputBarHeightChanged(inputBar.height)
|
||||||
|
}
|
||||||
scrollToBottomButton.alpha = alpha
|
scrollToBottomButton.alpha = alpha
|
||||||
unreadCount = min(unreadCount, layoutManager.findFirstVisibleItemPosition())
|
unreadCount = min(unreadCount, layoutManager.findFirstVisibleItemPosition())
|
||||||
updateUnreadCountIndicator()
|
updateUnreadCountIndicator()
|
||||||
|
Loading…
x
Reference in New Issue
Block a user