From 5ba61482737548da03c93684f8b614e591c3eb23 Mon Sep 17 00:00:00 2001 From: Marcel Hibbe Date: Tue, 17 Jan 2023 13:49:28 +0100 Subject: [PATCH] fix to immediately view placeholder + set min height without this fix, "getPayloadForImageLoader" was called before the placeholder was set (so it was null until getPayloadForImageLoader was called again after ~30seconds.). This is fixed by calling the super method at the end of "onBind". min height was set to avoid very tiny previews (like for the placeholders) Signed-off-by: Marcel Hibbe --- .../talk/adapters/messages/PreviewMessageViewHolder.kt | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/app/src/main/java/com/nextcloud/talk/adapters/messages/PreviewMessageViewHolder.kt b/app/src/main/java/com/nextcloud/talk/adapters/messages/PreviewMessageViewHolder.kt index d2a41f1c1..e6d34a57b 100644 --- a/app/src/main/java/com/nextcloud/talk/adapters/messages/PreviewMessageViewHolder.kt +++ b/app/src/main/java/com/nextcloud/talk/adapters/messages/PreviewMessageViewHolder.kt @@ -105,7 +105,8 @@ abstract class PreviewMessageViewHolder(itemView: View?, payload: Any?) : @SuppressLint("SetTextI18n") @Suppress("NestedBlockDepth", "ComplexMethod", "LongMethod") override fun onBind(message: ChatMessage) { - super.onBind(message) + image.minimumHeight = DisplayUtils.convertDpToPixel(MIN_IMAGE_HEIGHT, context).toInt() + time.text = dateUtils.getLocalTimeStringFromTimestamp(message.timestamp) if (userAvatar != null) { if (message.isGrouped || message.isOneToOneConversation) { @@ -228,6 +229,8 @@ abstract class PreviewMessageViewHolder(itemView: View?, payload: Any?) : true, viewThemeUtils!! ) + + super.onBind(message) } private fun longClickOnReaction(chatMessage: ChatMessage) { @@ -341,5 +344,6 @@ abstract class PreviewMessageViewHolder(itemView: View?, payload: Any?) : const val ACTOR_TYPE_BOTS = "bots" const val ACTOR_ID_CHANGELOG = "changelog" const val KEY_NAME = "name" + const val MIN_IMAGE_HEIGHT = 100F } }