From 6349d18c624388e956e8c678a32cd5524b772365 Mon Sep 17 00:00:00 2001 From: tibbi Date: Sun, 6 Mar 2022 22:48:52 +0100 Subject: [PATCH] use a transparent placeholder at loading mms images --- .../smsmessenger/adapters/ThreadAdapter.kt | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/app/src/main/kotlin/com/simplemobiletools/smsmessenger/adapters/ThreadAdapter.kt b/app/src/main/kotlin/com/simplemobiletools/smsmessenger/adapters/ThreadAdapter.kt index fc560136..2f04181d 100644 --- a/app/src/main/kotlin/com/simplemobiletools/smsmessenger/adapters/ThreadAdapter.kt +++ b/app/src/main/kotlin/com/simplemobiletools/smsmessenger/adapters/ThreadAdapter.kt @@ -3,6 +3,8 @@ package com.simplemobiletools.smsmessenger.adapters import android.annotation.SuppressLint import android.content.ActivityNotFoundException import android.content.Intent +import android.graphics.Color +import android.graphics.drawable.ColorDrawable import android.graphics.drawable.Drawable import android.net.Uri import android.telephony.SubscriptionManager @@ -277,10 +279,12 @@ class ThreadAdapter( val imageView = layoutInflater.inflate(R.layout.item_attachment_image, null) thread_mesage_attachments_holder.addView(imageView) + val placeholderDrawable = ColorDrawable(Color.TRANSPARENT) val isTallImage = attachment.height > attachment.width val transformation = if (isTallImage) CenterCrop() else FitCenter() val options = RequestOptions() - .diskCacheStrategy(DiskCacheStrategy.NONE) + .diskCacheStrategy(DiskCacheStrategy.RESOURCE) + .placeholder(placeholderDrawable) .transform(transformation, RoundedCorners(roundedCornersRadius)) var builder = Glide.with(context)