Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -1155,11 +1155,19 @@ class ConversationActivityV2 : ScreenLockActionBarActivity(), InputBarDelegate,
liveData.observe(this@ConversationActivityV2) { state ->
val recipients = state?.typists ?: emptyList()

// Quick-fix behavior kept as-is
val viewContainer = binding.typingIndicatorViewContainer
viewContainer.isVisible =
recipients.isNotEmpty() && isScrolledToBottom
viewContainer.setTypists(recipients)
val shouldShowTypingIndicator = recipients.isNotEmpty() &&
isScrolledToBottom

if (shouldShowTypingIndicator) {
binding.typingIndicatorViewContainer.isVisible = true
binding.typingIndicatorViewContainer.startAnimation()

// Make sure we are actually at the end
gotoConversationEnd(smoothScroll = false)
} else {
binding.typingIndicatorViewContainer.stopAnimation()
binding.typingIndicatorViewContainer.isVisible = false
}
}
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,6 @@ import android.util.AttributeSet
import android.view.LayoutInflater
import android.widget.LinearLayout
import network.loki.messenger.databinding.ViewConversationTypingContainerBinding
import org.session.libsession.utilities.Address

class TypingIndicatorViewContainer : LinearLayout {
private lateinit var binding: ViewConversationTypingContainerBinding
Expand All @@ -18,11 +17,6 @@ class TypingIndicatorViewContainer : LinearLayout {
binding = ViewConversationTypingContainerBinding.inflate(LayoutInflater.from(context), this, true)
}

fun setTypists(typists: List<Address>) {
if (typists.isEmpty()) { stopAnimation(); return }
startAnimation()
}

fun startAnimation() = binding.typingIndicator.root.startAnimation()
fun stopAnimation() = binding.typingIndicator.root.stopAnimation()
}