一些自定义下划线与阅读顶栏的前提工作
This commit is contained in:
@@ -382,6 +382,12 @@ object ReadBookConfig {
|
||||
config.underline = value
|
||||
}
|
||||
|
||||
var underlineHeight: Int
|
||||
get() = config.underlineHeight
|
||||
set(value) {
|
||||
config.underlineHeight = value
|
||||
}
|
||||
|
||||
var dottedLine: Boolean
|
||||
get() = config.dottedLine
|
||||
set(value) {
|
||||
@@ -622,6 +628,9 @@ object ReadBookConfig {
|
||||
var titleSegFlag: String = "",//分段判断,碰到指定值时分段
|
||||
var paragraphIndent: String = " ",//段落缩进
|
||||
var underline: Boolean = false, //下划线
|
||||
var underlineHeight: Int = 1,
|
||||
var underlineColor: String = "#3E3D3B",
|
||||
var underlineColorNight: String = "#ADADAD",
|
||||
var dottedLine: Boolean = false, //虚线
|
||||
var dottedBase: Float = 6f, //长度
|
||||
var dottedRatio: Float = 6f,
|
||||
@@ -678,6 +687,12 @@ object ReadBookConfig {
|
||||
@Transient
|
||||
private var menuAcColorNightInt = -1
|
||||
|
||||
@Transient
|
||||
private var underlineColorInt = -1
|
||||
|
||||
@Transient
|
||||
private var underlineColorNightInt = -1
|
||||
|
||||
@Transient
|
||||
private var initColorInt = false
|
||||
|
||||
@@ -691,6 +706,8 @@ object ReadBookConfig {
|
||||
menuBgColorNightInt = menuBgColorNight.toColorInt()
|
||||
menuAcColorInt = menuAcColor.toColorInt()
|
||||
menuAcColorNightInt = menuAcColorNight.toColorInt()
|
||||
underlineColorInt = underlineColor.toColorInt()
|
||||
underlineColorNightInt = underlineColorNight.toColorInt()
|
||||
initColorInt = true
|
||||
}
|
||||
|
||||
@@ -846,6 +863,27 @@ object ReadBookConfig {
|
||||
}
|
||||
}
|
||||
|
||||
fun curUnderlineColor(): Int {
|
||||
return when {
|
||||
AppConfig.isNightTheme -> underlineColorNightInt
|
||||
else -> underlineColorInt
|
||||
}
|
||||
}
|
||||
|
||||
fun setUnderlineColor(bg: Int) {
|
||||
when {
|
||||
AppConfig.isNightTheme -> {
|
||||
underlineColorNight = "#${bg.hexString}"
|
||||
underlineColorNightInt = bg
|
||||
}
|
||||
|
||||
else -> {
|
||||
underlineColor = "#${bg.hexString}"
|
||||
underlineColorInt = bg
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
fun curBgType(): Int {
|
||||
return when {
|
||||
AppConfig.isEInkMode -> bgTypeEInk
|
||||
|
||||
@@ -61,7 +61,7 @@ object ChapterProvider {
|
||||
Paint(contentPaint).apply {
|
||||
clearShadowLayer()
|
||||
isAntiAlias = true
|
||||
strokeWidth = 1.dpToPx().toFloat()
|
||||
strokeWidth = ReadBookConfig.underlineHeight.toFloat()
|
||||
style = Paint.Style.STROKE
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user