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 <dev@mhibbe.de>
This commit is contained in:
Marcel Hibbe 2025-05-21 16:56:22 +02:00
parent 0b40e06f46
commit 971cc79b76
No known key found for this signature in database
GPG Key ID: C793F8B59F43CE7B

View File

@ -2180,7 +2180,7 @@ class ChatActivity :
if (position != null && position >= 0) { if (position != null && position >= 0) {
binding.messagesListView.scrollToPosition(position) binding.messagesListView.scrollToPosition(position)
} else { } 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 binding.messagesListView.height / 2
) )
} else { } else {
Log.d( startContextChatWindowForMessage(messageId)
TAG,
"message $messageId that should be scrolled to was not found " +
"(scrollToAndCenterMessageWithId)"
)
} }
} ?: run {
startContextChatWindowForMessage(messageId)
} }
} }
@ -3190,9 +3188,11 @@ class ChatActivity :
context.resources.getString(R.string.nc_tomorrow_meeting), context.resources.getString(R.string.nc_tomorrow_meeting),
startDateTime.format(DateTimeFormatter.ofPattern("HH:mm")) startDateTime.format(DateTimeFormatter.ofPattern("HH:mm"))
) )
else -> startDateTime.format(DateTimeFormatter.ofPattern("MMM d, yyyy, HH:mm")) else -> startDateTime.format(DateTimeFormatter.ofPattern("MMM d, yyyy, HH:mm"))
} }
} }
currentTime.isAfter(endDateTime) -> context.resources.getString(R.string.nc_meeting_ended) currentTime.isAfter(endDateTime) -> context.resources.getString(R.string.nc_meeting_ended)
else -> context.resources.getString(R.string.nc_ongoing_meeting) else -> context.resources.getString(R.string.nc_ongoing_meeting)
} }
@ -3655,6 +3655,7 @@ class ChatActivity :
) )
showSnackBar(roomToken) showSnackBar(roomToken)
} }
else -> {} else -> {}
} }
} }
@ -3675,6 +3676,7 @@ class ChatActivity :
chatIntent.addFlags(Intent.FLAG_ACTIVITY_CLEAR_TOP) chatIntent.addFlags(Intent.FLAG_ACTIVITY_CLEAR_TOP)
startActivity(chatIntent) startActivity(chatIntent)
} }
fun openInFilesApp(message: ChatMessage) { fun openInFilesApp(message: ChatMessage) {
val keyID = message.selectedIndividualHashMap!![PreviewMessageViewHolder.KEY_ID] val keyID = message.selectedIndividualHashMap!![PreviewMessageViewHolder.KEY_ID]
val link = message.selectedIndividualHashMap!!["link"] val link = message.selectedIndividualHashMap!!["link"]