From 971cc79b76ea2b784cd7ae971a54130e832f2d75 Mon Sep 17 00:00:00 2001 From: Marcel Hibbe Date: Wed, 21 May 2025 16:56:22 +0200 Subject: [PATCH] open context search when message was not found or adapter was null Opening it when adapter was null is a bit hacky but it works (better would be to make sure adapter is not null of course) Signed-off-by: Marcel Hibbe --- .../java/com/nextcloud/talk/chat/ChatActivity.kt | 14 ++++++++------ 1 file changed, 8 insertions(+), 6 deletions(-) diff --git a/app/src/main/java/com/nextcloud/talk/chat/ChatActivity.kt b/app/src/main/java/com/nextcloud/talk/chat/ChatActivity.kt index 3f0479beb..726e3abe9 100644 --- a/app/src/main/java/com/nextcloud/talk/chat/ChatActivity.kt +++ b/app/src/main/java/com/nextcloud/talk/chat/ChatActivity.kt @@ -2180,7 +2180,7 @@ class ChatActivity : if (position != null && position >= 0) { binding.messagesListView.scrollToPosition(position) } else { - Log.d(TAG, "message $messageId that should be scrolled to was not found (scrollToMessageWithId)") + startContextChatWindowForMessage(messageId) } } @@ -2193,12 +2193,10 @@ class ChatActivity : binding.messagesListView.height / 2 ) } else { - Log.d( - TAG, - "message $messageId that should be scrolled to was not found " + - "(scrollToAndCenterMessageWithId)" - ) + startContextChatWindowForMessage(messageId) } + } ?: run { + startContextChatWindowForMessage(messageId) } } @@ -3190,9 +3188,11 @@ class ChatActivity : context.resources.getString(R.string.nc_tomorrow_meeting), startDateTime.format(DateTimeFormatter.ofPattern("HH:mm")) ) + else -> startDateTime.format(DateTimeFormatter.ofPattern("MMM d, yyyy, HH:mm")) } } + currentTime.isAfter(endDateTime) -> context.resources.getString(R.string.nc_meeting_ended) else -> context.resources.getString(R.string.nc_ongoing_meeting) } @@ -3655,6 +3655,7 @@ class ChatActivity : ) showSnackBar(roomToken) } + else -> {} } } @@ -3675,6 +3676,7 @@ class ChatActivity : chatIntent.addFlags(Intent.FLAG_ACTIVITY_CLEAR_TOP) startActivity(chatIntent) } + fun openInFilesApp(message: ChatMessage) { val keyID = message.selectedIndividualHashMap!![PreviewMessageViewHolder.KEY_ID] val link = message.selectedIndividualHashMap!!["link"]