pull/32/head
kunfei 5 years ago
parent c8466bc214
commit b1187f0463
  1. 19
      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.Dispatchers.IO
import kotlinx.coroutines.GlobalScope import kotlinx.coroutines.GlobalScope
import kotlinx.coroutines.launch import kotlinx.coroutines.launch
import okhttp3.internal.toHexString
import java.io.BufferedWriter import java.io.BufferedWriter
import java.io.File import java.io.File
import java.io.FileWriter import java.io.FileWriter
@ -111,6 +112,24 @@ object ReadBookConfig {
var textColorNight: String = "#adadad", var textColorNight: String = "#adadad",
var textSize: Int = 15 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 { fun textColor(): Int {
return if (App.INSTANCE.isNightTheme) Color.parseColor(textColorNight) return if (App.INSTANCE.isNightTheme) Color.parseColor(textColorNight)
else Color.parseColor(textColor) else Color.parseColor(textColor)

Loading…
Cancel
Save