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

View File

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