优化
This commit is contained in:
@@ -88,9 +88,6 @@ object ReadBookConfig {
|
|||||||
configList.clear()
|
configList.clear()
|
||||||
configList.addAll(it)
|
configList.addAll(it)
|
||||||
}
|
}
|
||||||
for (i in configList.indices) {
|
|
||||||
configList[i].initColorInt()
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
fun initShareConfig() {
|
fun initShareConfig() {
|
||||||
@@ -539,14 +536,23 @@ object ReadBookConfig {
|
|||||||
var footerMode: Int = 0
|
var footerMode: Int = 0
|
||||||
) {
|
) {
|
||||||
|
|
||||||
|
@Transient
|
||||||
private var textColorIntEInk = -1
|
private var textColorIntEInk = -1
|
||||||
|
|
||||||
|
@Transient
|
||||||
private var textColorIntNight = -1
|
private var textColorIntNight = -1
|
||||||
|
|
||||||
|
@Transient
|
||||||
private var textColorInt = -1
|
private var textColorInt = -1
|
||||||
|
|
||||||
fun initColorInt() {
|
@Transient
|
||||||
|
private var initColorInt = false
|
||||||
|
|
||||||
|
private fun initColorInt() {
|
||||||
textColorIntEInk = Color.parseColor(textColorEInk)
|
textColorIntEInk = Color.parseColor(textColorEInk)
|
||||||
textColorIntNight = Color.parseColor(textColorNight)
|
textColorIntNight = Color.parseColor(textColorNight)
|
||||||
textColorInt = Color.parseColor(textColor)
|
textColorInt = Color.parseColor(textColor)
|
||||||
|
initColorInt = true
|
||||||
}
|
}
|
||||||
|
|
||||||
fun setCurTextColor(color: Int) {
|
fun setCurTextColor(color: Int) {
|
||||||
@@ -569,6 +575,9 @@ object ReadBookConfig {
|
|||||||
}
|
}
|
||||||
|
|
||||||
fun curTextColor(): Int {
|
fun curTextColor(): Int {
|
||||||
|
if (!initColorInt) {
|
||||||
|
initColorInt()
|
||||||
|
}
|
||||||
return when {
|
return when {
|
||||||
AppConfig.isEInkMode -> textColorIntEInk
|
AppConfig.isEInkMode -> textColorIntEInk
|
||||||
AppConfig.isNightTheme -> textColorIntNight
|
AppConfig.isNightTheme -> textColorIntNight
|
||||||
|
|||||||
@@ -188,7 +188,7 @@ class BgTextConfigDialog : BaseDialogFragment(R.layout.dialog_read_bg_text) {
|
|||||||
val layoutNames = defaultConfigs.map { it.name }
|
val layoutNames = defaultConfigs.map { it.name }
|
||||||
context?.selector("选择预设布局", layoutNames) { _, i ->
|
context?.selector("选择预设布局", layoutNames) { _, i ->
|
||||||
if (i >= 0) {
|
if (i >= 0) {
|
||||||
ReadBookConfig.durConfig = defaultConfigs[i].copy().apply { initColorInt() }
|
ReadBookConfig.durConfig = defaultConfigs[i].copy()
|
||||||
initData()
|
initData()
|
||||||
postEvent(EventBus.UP_CONFIG, arrayListOf(1, 2, 5))
|
postEvent(EventBus.UP_CONFIG, arrayListOf(1, 2, 5))
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user