From bb8ff27b07b1019539bc587f6d4e33ea71a19557 Mon Sep 17 00:00:00 2001 From: gedoor Date: Wed, 4 Aug 2021 23:41:18 +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 --- app/build.gradle | 3 --- app/src/main/java/io/legado/app/help/ThemeConfig.kt | 3 +-- app/src/main/java/io/legado/app/utils/BitmapUtils.kt | 4 ++-- 3 files changed, 3 insertions(+), 7 deletions(-) diff --git a/app/build.gradle b/app/build.gradle index e49b041a2..58ce975d7 100644 --- a/app/build.gradle +++ b/app/build.gradle @@ -213,9 +213,6 @@ dependencies { implementation("io.noties.markwon:ext-tables:$markwonVersion") implementation("io.noties.markwon:html:$markwonVersion") - // 谷歌RenderScript库 - implementation('com.github.android:renderscript-intrinsics-replacement-toolkit:b6363490c3') - //转换繁体 implementation('com.github.liuyueyi.quick-chinese-transfer:quick-transfer-core:0.2.1') diff --git a/app/src/main/java/io/legado/app/help/ThemeConfig.kt b/app/src/main/java/io/legado/app/help/ThemeConfig.kt index 506082c9d..1da67c7cb 100644 --- a/app/src/main/java/io/legado/app/help/ThemeConfig.kt +++ b/app/src/main/java/io/legado/app/help/ThemeConfig.kt @@ -6,7 +6,6 @@ import android.graphics.Color import android.util.DisplayMetrics import androidx.annotation.Keep import androidx.appcompat.app.AppCompatDelegate -import com.google.android.renderscript.Toolkit import io.legado.app.R import io.legado.app.constant.EventBus import io.legado.app.constant.PreferKey @@ -60,7 +59,7 @@ object ThemeConfig { val bgImage = BitmapUtils .decodeBitmap(bgCfg.first!!, metrics.widthPixels, metrics.heightPixels) ?: return null - return Toolkit.blur(bgImage, bgCfg.second) + return BitmapUtils.stackBlur(bgImage, bgCfg.second.toFloat()) } fun upConfig() { diff --git a/app/src/main/java/io/legado/app/utils/BitmapUtils.kt b/app/src/main/java/io/legado/app/utils/BitmapUtils.kt index 2e7ae06ba..c200980c2 100644 --- a/app/src/main/java/io/legado/app/utils/BitmapUtils.kt +++ b/app/src/main/java/io/legado/app/utils/BitmapUtils.kt @@ -249,7 +249,7 @@ object BitmapUtils { /** * 高斯模糊 */ - fun stackBlur(srcBitmap: Bitmap?): Bitmap? { + fun stackBlur(srcBitmap: Bitmap?, radius: Float = 8f): Bitmap? { if (srcBitmap == null) return null val rs = RenderScript.create(appCtx) val blurredBitmap = srcBitmap.copy(Config.ARGB_8888, true) @@ -268,7 +268,7 @@ object BitmapUtils { script.setInput(input) //设置模糊半径 - script.setRadius(8f) + script.setRadius(radius) //启动 ScriptIntrinsicBlur script.forEach(output)