From 174e383d70b1e0cd0d8ec37a87b8b036077b2b59 Mon Sep 17 00:00:00 2001 From: kunfei Date: Mon, 28 Mar 2022 23:02:17 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BC=98=E5=8C=96?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../java/io/legado/app/help/glide/BlurTransformation.kt | 7 +++---- app/src/main/java/io/legado/app/model/BookCover.kt | 5 +++-- 2 files changed, 6 insertions(+), 6 deletions(-) diff --git a/app/src/main/java/io/legado/app/help/glide/BlurTransformation.kt b/app/src/main/java/io/legado/app/help/glide/BlurTransformation.kt index 2519adb2d..ebe209dcf 100644 --- a/app/src/main/java/io/legado/app/help/glide/BlurTransformation.kt +++ b/app/src/main/java/io/legado/app/help/glide/BlurTransformation.kt @@ -3,7 +3,7 @@ package io.legado.app.help.glide import android.graphics.Bitmap import androidx.annotation.IntRange import com.bumptech.glide.load.engine.bitmap_recycle.BitmapPool -import com.bumptech.glide.load.resource.bitmap.CenterCrop +import com.bumptech.glide.load.resource.bitmap.BitmapTransformation import io.legado.app.utils.stackBlur import java.security.MessageDigest @@ -13,7 +13,7 @@ import java.security.MessageDigest */ class BlurTransformation( @IntRange(from = 0, to = 25) private val radius: Int -) : CenterCrop() { +) : BitmapTransformation() { override fun transform( pool: BitmapPool, @@ -21,8 +21,7 @@ class BlurTransformation( outWidth: Int, outHeight: Int ): Bitmap { - val transform = super.transform(pool, toTransform, outWidth, outHeight) - return transform.stackBlur(radius) + return toTransform.stackBlur(radius) } override fun updateDiskCacheKey(messageDigest: MessageDigest) { diff --git a/app/src/main/java/io/legado/app/model/BookCover.kt b/app/src/main/java/io/legado/app/model/BookCover.kt index be7aa4972..73fe7bec9 100644 --- a/app/src/main/java/io/legado/app/model/BookCover.kt +++ b/app/src/main/java/io/legado/app/model/BookCover.kt @@ -5,6 +5,7 @@ import android.content.Context import android.graphics.drawable.BitmapDrawable import android.graphics.drawable.Drawable import com.bumptech.glide.RequestBuilder +import com.bumptech.glide.load.resource.bitmap.CenterCrop import com.bumptech.glide.load.resource.drawable.DrawableTransitionOptions import com.bumptech.glide.request.RequestOptions import io.legado.app.R @@ -86,14 +87,14 @@ object BookCover { loadOnlyWifi: Boolean = false ): RequestBuilder { val loadBlur = ImageLoader.load(context, defaultDrawable) - .transform(BlurTransformation(25)) + .transform(BlurTransformation(25), CenterCrop()) return if (AppConfig.useDefaultCover) { loadBlur } else { val options = RequestOptions().set(OkHttpModelLoader.loadOnlyWifiOption, loadOnlyWifi) ImageLoader.load(context, path) .apply(options) - .transform(BlurTransformation(25)) + .transform(BlurTransformation(25), CenterCrop()) .transition(DrawableTransitionOptions.withCrossFade(1500)) .thumbnail(loadBlur) }