From b1187f04638351727deea8e58dd49e224912c9cb Mon Sep 17 00:00:00 2001 From: kunfei Date: Fri, 30 Aug 2019 16:06:54 +0800 Subject: [PATCH] up --- .../java/io/legado/app/help/ReadBookConfig.kt | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+) 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 d2a9565ed..01e199eb8 100644 --- a/app/src/main/java/io/legado/app/help/ReadBookConfig.kt +++ b/app/src/main/java/io/legado/app/help/ReadBookConfig.kt @@ -8,6 +8,7 @@ import io.legado.app.utils.* import kotlinx.coroutines.Dispatchers.IO import kotlinx.coroutines.GlobalScope import kotlinx.coroutines.launch +import okhttp3.internal.toHexString import java.io.BufferedWriter import java.io.File import java.io.FileWriter @@ -111,6 +112,24 @@ object ReadBookConfig { var textColorNight: String = "#adadad", var textSize: Int = 15 ) { + fun setBg(bgType: Int, bg: String) { + if (App.INSTANCE.isNightTheme) { + bgTypeNight = bgType + bgStrNight = bg + } else { + this.bgType = bgType + bgStr = bg + } + } + + fun setTextColor(color: Int) { + if (App.INSTANCE.isNightTheme) { + textColorNight = "#${color.toHexString()}" + } else { + textColor = "#${color.toHexString()}" + } + } + fun textColor(): Int { return if (App.INSTANCE.isNightTheme) Color.parseColor(textColorNight) else Color.parseColor(textColor)