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 <dev@mhibbe.de>
This commit is contained in:
Marcel Hibbe 2023-01-17 13:49:28 +01:00
parent 2ddb0782f3
commit 5ba6148273
No known key found for this signature in database
GPG key ID: C793F8B59F43CE7B

View file

@ -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
}
}