From 41732477d62b7025fc2be4ffcc43e2f59873e2fa Mon Sep 17 00:00:00 2001 From: kunfei Date: Tue, 19 Jul 2022 22:02:25 +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 --- .../io/legado/app/help/config/ReadBookConfig.kt | 14 +++++++------- 1 file changed, 7 insertions(+), 7 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 34ef3ab3c..27b166949 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 @@ -88,14 +88,14 @@ object ReadBookConfig { } fun upBg(width: Int, height: Int) { - val tmp = bg - bg = durConfig.curBgDrawable(width, height).apply { - if (this is BitmapDrawable) { - bgMeanColor = bitmap.getMeanColor() - } else if (this is ColorDrawable) { - bgMeanColor = color - } + val drawable = durConfig.curBgDrawable(width, height) + if (drawable is BitmapDrawable && drawable.bitmap != null) { + bgMeanColor = drawable.bitmap.getMeanColor() + } else if (drawable is ColorDrawable) { + bgMeanColor = drawable.color } + val tmp = bg + bg = drawable (tmp as? BitmapDrawable)?.bitmap?.recycle() }