Fixed some bugs with formatting and message handling

Signed-off-by: Julius Linus <julius.linus@nextcloud.com>

Signed-off-by: Marcel Hibbe <dev@mhibbe.de>

[skip ci]
This commit is contained in:
Julius Linus 2024-03-21 12:59:08 -05:00 committed by backportbot[bot]
parent d6bb746ac6
commit f0d9afef59
2 changed files with 481 additions and 484 deletions

View file

@ -819,14 +819,6 @@ class ChatActivity :
Snackbar.LENGTH_LONG
).show()
}
chatViewModel.refreshChatParams(
setupFieldsForPullChatMessages(
true,
globalLastKnownFutureMessageId,
true
)
)
}
is ChatViewModel.DeleteChatMessageErrorState -> {
@ -906,10 +898,11 @@ class ChatActivity :
}
var lastAdapterId = getLastAdapterId()
val oneNewMessage = (lastAdapterId != 0 || chatMessageList.size == 1)
if (
state.lookIntoFuture &&
lastAdapterId != 0 &&
oneNewMessage &&
chatMessageList[0].jsonMessageId > lastAdapterId
) {
processMessagesFromTheFuture(chatMessageList)
@ -943,8 +936,7 @@ class ChatActivity :
true,
globalLastKnownFutureMessageId,
true
),
true
)
)
}
@ -954,8 +946,7 @@ class ChatActivity :
true,
globalLastKnownFutureMessageId,
true
),
true
)
)
}
@ -1077,7 +1068,7 @@ class ChatActivity :
binding.popupBubbleView.setRecyclerView(binding.messagesListView)
binding.popupBubbleView.setPopupBubbleListener { context ->
binding.popupBubbleView.setPopupBubbleListener { _ ->
if (newMessagesCount != 0) {
val scrollPosition = if (newMessagesCount - 1 < 0) {
0
@ -1557,8 +1548,8 @@ class ChatActivity :
var sliderInitX = 0F
var downX = 0f
var originY = 0f
var deltaX = 0f
var deltaY = 0f
var deltaX: Float
var deltaY: Float
var voiceRecordStartTime = 0L
var voiceRecordEndTime = 0L
@ -3583,11 +3574,12 @@ class ChatActivity :
for (i in mentionSpans.indices) {
mentionSpan = mentionSpans[i]
var mentionId = mentionSpan.id
if (mentionId.contains(" ") ||
val needsQuotes = mentionId.contains(" ") ||
mentionId.contains("@") ||
mentionId.startsWith("guest/") ||
mentionId.startsWith("group/")
) {
if (needsQuotes) {
mentionId = "\"" + mentionId + "\""
}
editable.replace(editable.getSpanStart(mentionSpan), editable.getSpanEnd(mentionSpan), "@$mentionId")
@ -3973,7 +3965,8 @@ class ChatActivity :
}
override fun onLoadMore(page: Int, totalItemsCount: Int) {
if (page > 1) {
val calculatedPage = page / MESSAGE_PULL_LIMIT
if (calculatedPage > 0) {
chatViewModel.refreshChatParams(
setupFieldsForPullChatMessages(
false,

View file

@ -121,6 +121,10 @@
android:paddingEnd="@dimen/standard_padding" />
</LinearLayout>
<androidx.core.widget.NestedScrollView
android:layout_width="match_parent"
android:layout_height="wrap_content">
<LinearLayout
android:id="@+id/message_actions"
android:layout_width="match_parent"
@ -141,14 +145,14 @@
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_gravity="start|center_vertical"
android:ellipsize="end"
android:maxLines="1"
android:paddingStart="16dp"
android:paddingEnd="@dimen/standard_padding"
tools:text="@string/nc_edited_by_admin"
android:textAlignment="viewStart"
android:maxLines="1"
android:ellipsize="end"
android:textColor="@color/grey_600"
android:textSize="15sp"
android:textColor = "@color/grey_600"/>
tools:text="@string/nc_edited_by_admin" />
<TextView
android:id="@+id/edited_time"
@ -157,10 +161,10 @@
android:layout_gravity="start|center_vertical"
android:paddingStart="16dp"
android:paddingEnd="@dimen/standard_padding"
tools:text="12:30 AM"
android:textAlignment="viewStart"
android:textColor="@color/grey_600"
android:textSize="15sp"
android:textColor ="@color/grey_600"/>
tools:text="12:30 AM" />
</LinearLayout>
@ -495,7 +499,6 @@
</LinearLayout>
<LinearLayout
android:id="@+id/menu_edit_message"
android:layout_width="match_parent"
@ -596,5 +599,6 @@
</LinearLayout>
</LinearLayout>
</androidx.core.widget.NestedScrollView>
</LinearLayout>