From c5042bd89d1bc05fb71399d004ec0f44cac31c25 Mon Sep 17 00:00:00 2001 From: tibbi Date: Tue, 2 Jun 2020 12:30:30 +0200 Subject: [PATCH] use caching at the ImageDecoder for faster fullscreen image loading --- .../gallery/pro/helpers/MyGlideImageDecoder.kt | 16 +++++++--------- 1 file changed, 7 insertions(+), 9 deletions(-) diff --git a/app/src/main/kotlin/com/simplemobiletools/gallery/pro/helpers/MyGlideImageDecoder.kt b/app/src/main/kotlin/com/simplemobiletools/gallery/pro/helpers/MyGlideImageDecoder.kt index b1a3461eb..c1bd9b3a0 100644 --- a/app/src/main/kotlin/com/simplemobiletools/gallery/pro/helpers/MyGlideImageDecoder.kt +++ b/app/src/main/kotlin/com/simplemobiletools/gallery/pro/helpers/MyGlideImageDecoder.kt @@ -5,7 +5,6 @@ import android.graphics.Bitmap import android.net.Uri import com.bumptech.glide.Glide import com.bumptech.glide.load.DecodeFormat -import com.bumptech.glide.load.engine.DiskCacheStrategy import com.bumptech.glide.request.RequestOptions import com.bumptech.glide.request.target.Target import com.davemorrissey.labs.subscaleview.ImageDecoder @@ -14,16 +13,15 @@ class MyGlideImageDecoder(val degrees: Int) : ImageDecoder { override fun decode(context: Context, uri: Uri): Bitmap { val options = RequestOptions() - .format(DecodeFormat.PREFER_ARGB_8888) - .diskCacheStrategy(DiskCacheStrategy.NONE) - .fitCenter() + .format(DecodeFormat.PREFER_ARGB_8888) + .fitCenter() val builder = Glide.with(context) - .asBitmap() - .load(uri) - .apply(options) - .transform(RotateTransformation(-degrees)) - .into(Target.SIZE_ORIGINAL, Target.SIZE_ORIGINAL) + .asBitmap() + .load(uri) + .apply(options) + .transform(RotateTransformation(-degrees)) + .into(Target.SIZE_ORIGINAL, Target.SIZE_ORIGINAL) return builder.get() }