This commit is contained in:
kunfei
2022-07-19 22:02:25 +08:00
parent cc1452caa9
commit 1b3e280fdb
@@ -88,14 +88,14 @@ object ReadBookConfig {
} }
fun upBg(width: Int, height: Int) { fun upBg(width: Int, height: Int) {
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 val tmp = bg
bg = durConfig.curBgDrawable(width, height).apply { bg = drawable
if (this is BitmapDrawable) {
bgMeanColor = bitmap.getMeanColor()
} else if (this is ColorDrawable) {
bgMeanColor = color
}
}
(tmp as? BitmapDrawable)?.bitmap?.recycle() (tmp as? BitmapDrawable)?.bitmap?.recycle()
} }