fix to hide popupBubbleView for system messages like reactions

rename popupBubbleView to unreadMessagesPopup

Signed-off-by: Marcel Hibbe <dev@mhibbe.de>
This commit is contained in:
Marcel Hibbe 2024-08-08 15:07:21 +02:00
parent 299e8508c4
commit a13a53f7fd
No known key found for this signature in database
GPG key ID: C793F8B59F43CE7B
2 changed files with 18 additions and 18 deletions

View file

@ -698,8 +698,8 @@ class ChatActivity :
is MessageInputViewModel.SendChatMessageSuccessState -> {
myFirstMessage = state.message
if (binding.popupBubbleView.isShown == true) {
binding.popupBubbleView.hide()
if (binding.unreadMessagesPopup.isShown == true) {
binding.unreadMessagesPopup.hide()
}
binding.messagesListView.smoothScrollToPosition(0)
}
@ -710,8 +710,8 @@ class ChatActivity :
if (code.toString().startsWith("2")) {
myFirstMessage = state.message
if (binding.popupBubbleView.isShown == true) {
binding.popupBubbleView.hide()
if (binding.unreadMessagesPopup.isShown == true) {
binding.unreadMessagesPopup.hide()
}
binding.messagesListView.smoothScrollToPosition(0)
@ -955,9 +955,9 @@ class ChatActivity :
setupSwipeToReply()
binding.popupBubbleView.setRecyclerView(binding.messagesListView)
binding.unreadMessagesPopup.setRecyclerView(binding.messagesListView)
binding.popupBubbleView.setPopupBubbleListener { _ ->
binding.unreadMessagesPopup.setPopupBubbleListener { _ ->
if (newMessagesCount != 0) {
val scrollPosition = if (newMessagesCount - 1 < 0) {
0
@ -982,7 +982,7 @@ class ChatActivity :
binding.let { viewThemeUtils.material.themeFAB(it.voiceRecordingLock) }
binding.let { viewThemeUtils.material.colorMaterialButtonPrimaryFilled(it.popupBubbleView) }
binding.let { viewThemeUtils.material.colorMaterialButtonPrimaryFilled(it.unreadMessagesPopup) }
binding.messagesListView.addOnScrollListener(object : RecyclerView.OnScrollListener() {
override fun onScrollStateChanged(recyclerView: RecyclerView, newState: Int) {
@ -999,8 +999,8 @@ class ChatActivity :
if (layoutManager!!.findFirstCompletelyVisibleItemPosition() < newMessagesCount) {
newMessagesCount = 0
if (binding.popupBubbleView.isShown == true) {
binding.popupBubbleView.hide()
if (binding.unreadMessagesPopup.isShown == true) {
binding.unreadMessagesPopup.hide()
}
}
}
@ -2560,23 +2560,23 @@ class ChatActivity :
unreadChatMessage.timestamp = chatMessageList[0].timestamp
unreadChatMessage.message = context.getString(R.string.nc_new_messages)
adapter?.addToStart(unreadChatMessage, false)
}
if (!scrollToEndOnUpdate) {
binding.popupBubbleView.isShown.let {
if (it) {
if (scrollToEndOnUpdate) {
binding.scrollDownButton.visibility = View.GONE
newMessagesCount = 0
} else {
if (binding.unreadMessagesPopup.isShown) {
newMessagesCount++
} else {
newMessagesCount = 1
binding.scrollDownButton.visibility = View.GONE
binding.popupBubbleView.show()
binding.unreadMessagesPopup.show()
}
}
} else {
binding.scrollDownButton.visibility = View.GONE
newMessagesCount = 0
}
for (chatMessage in chatMessageList) {
chatMessage.activeUser = conversationUser

View file

@ -158,7 +158,7 @@
tools:visibility="visible" />
<com.nextcloud.ui.popupbubble.PopupBubble
android:id="@+id/popupBubbleView"
android:id="@+id/unreadMessagesPopup"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignBottom="@id/typing_indicator_wrapper"