Glide cache improvement for non encrypted files

This commit is contained in:
Sylvain Berfini 2021-04-07 09:08:14 +02:00
parent d2004978f3
commit 2215cb4621
2 changed files with 4 additions and 5 deletions

View file

@ -321,7 +321,7 @@ fun loadAvatarWithGlideFallback(imageView: ImageView, path: String?) {
@BindingAdapter("glidePath")
fun loadImageWithGlide(imageView: ImageView, path: String) {
if (path.isNotEmpty() && FileUtils.isExtensionImage(path)) {
if (corePreferences.vfsEnabled) {
if (corePreferences.vfsEnabled && path.endsWith(FileUtils.VFS_PLAIN_FILE_EXTENSION)) {
GlideApp.with(imageView)
.load(path)
.diskCacheStrategy(DiskCacheStrategy.NONE)
@ -347,9 +347,8 @@ fun loadAvatarWithGlide(imageView: ImageView, path: String?) {
.with(imageView)
.load(path)
.signature(ObjectKey(coreContext.contactsManager.latestContactFetch))
.apply(RequestOptions.circleCropTransform()).listener(
object :
RequestListener<Drawable?> {
.apply(RequestOptions.circleCropTransform())
.listener(object : RequestListener<Drawable?> {
override fun onLoadFailed(
e: GlideException?,
model: Any?,

View file

@ -43,7 +43,7 @@ import org.linphone.core.tools.Log
class FileUtils {
companion object {
private const val VFS_PLAIN_FILE_EXTENSION = ".bctbx_evfs_plain"
const val VFS_PLAIN_FILE_EXTENSION = ".bctbx_evfs_plain"
fun getNameFromFilePath(filePath: String): String {
var name = filePath