From 7f548b9ac6313462b50e76c6820ad05a9e2821a0 Mon Sep 17 00:00:00 2001 From: kunfei Date: Tue, 17 May 2022 22:58:13 +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 --- .../legado/app/help/config/ReadBookConfig.kt | 20 +++++++------------ 1 file changed, 7 insertions(+), 13 deletions(-) diff --git a/app/src/main/java/io/legado/app/help/config/ReadBookConfig.kt b/app/src/main/java/io/legado/app/help/config/ReadBookConfig.kt index 1a53a2956..ace52897c 100644 --- a/app/src/main/java/io/legado/app/help/config/ReadBookConfig.kt +++ b/app/src/main/java/io/legado/app/help/config/ReadBookConfig.kt @@ -570,20 +570,14 @@ object ReadBookConfig { bgDrawable = when (curBgType()) { 0 -> ColorDrawable(Color.parseColor(curBgStr())) 1 -> { - BitmapDrawable( - resources, - BitmapUtils.decodeAssetsBitmap( - appCtx, - "bg" + File.separator + curBgStr(), - width, - height - ) - ) + val path = "bg" + File.separator + curBgStr() + val bitmap = BitmapUtils.decodeAssetsBitmap(appCtx, path, width, height) + BitmapDrawable(resources, bitmap) + } + else -> { + val bitmap = BitmapUtils.decodeBitmap(curBgStr(), width, height) + BitmapDrawable(resources, bitmap) } - else -> BitmapDrawable( - resources, - BitmapUtils.decodeBitmap(curBgStr(), width, height) - ) } } catch (e: OutOfMemoryError) { e.printOnDebug()