From 56d3acb6a0314da7071f8cca9d41cf7ad6ea02e4 Mon Sep 17 00:00:00 2001 From: kunfei Date: Sat, 31 Aug 2019 11:40:10 +0800 Subject: [PATCH] up --- .../java/io/legado/app/help/ReadBookConfig.kt | 22 ++++++++++--------- 1 file changed, 12 insertions(+), 10 deletions(-) diff --git a/app/src/main/java/io/legado/app/help/ReadBookConfig.kt b/app/src/main/java/io/legado/app/help/ReadBookConfig.kt index 196a88c36..df282cfb1 100644 --- a/app/src/main/java/io/legado/app/help/ReadBookConfig.kt +++ b/app/src/main/java/io/legado/app/help/ReadBookConfig.kt @@ -95,7 +95,7 @@ object ReadBookConfig { } data class Config( - var bgStr: String = "#015A86", + var bgStr: String = "#EEEEEE", var bgStrNight: String = "#000000", var bgType: Int = 0, var bgTypeNight: Int = 0, @@ -164,15 +164,17 @@ object ReadBookConfig { fun bgDrawable(): Drawable { var bgDrawable: Drawable? = null - when (bgType()) { - 0 -> bgDrawable = ColorDrawable(Color.parseColor(bgStr())) - 1 -> bgDrawable = - Drawable.createFromStream( - App.INSTANCE.assets.open("bg" + File.separator + bgStr), - "bg" - ) - else -> runCatching { - bgDrawable = Drawable.createFromPath(bgStr) + kotlin.runCatching { + when (bgType()) { + 0 -> bgDrawable = ColorDrawable(Color.parseColor(bgStr())) + 1 -> bgDrawable = + Drawable.createFromStream( + App.INSTANCE.assets.open("bg" + File.separator + bgStr), + "bg" + ) + else -> runCatching { + bgDrawable = Drawable.createFromPath(bgStr) + } } } return bgDrawable ?: ColorDrawable(Color.parseColor("#015A86"))