[优化] 可调整下划线离字体距离
This commit is contained in:
@@ -415,6 +415,12 @@ object ReadBookConfig {
|
||||
config.underlineHeight = value
|
||||
}
|
||||
|
||||
var underlinePadding: Int
|
||||
get() = config.underlinePadding
|
||||
set(value) {
|
||||
config.underlinePadding = value
|
||||
}
|
||||
|
||||
var dottedLine: Boolean
|
||||
get() = config.dottedLine
|
||||
set(value) {
|
||||
@@ -593,6 +599,7 @@ object ReadBookConfig {
|
||||
exportConfig.paragraphIndent = shareConfig.paragraphIndent
|
||||
exportConfig.underline = shareConfig.underline
|
||||
exportConfig.underlineHeight = shareConfig.underlineHeight
|
||||
exportConfig.underlinePadding = shareConfig.underlinePadding
|
||||
exportConfig.dottedLine = shareConfig.dottedLine
|
||||
exportConfig.dottedBase = shareConfig.dottedBase
|
||||
exportConfig.dottedRatio = shareConfig.dottedRatio
|
||||
@@ -710,6 +717,7 @@ object ReadBookConfig {
|
||||
var titleSegFlag: String = "",//分段判断,碰到指定值时分段
|
||||
var paragraphIndent: String = " ",//段落缩进
|
||||
var underline: Boolean = false, //下划线
|
||||
var underlinePadding: Int = 10,
|
||||
var underlineHeight: Int = 1,
|
||||
var underlineColor: String = "#3E3D3B",
|
||||
var underlineColorNight: String = "#ADADAD",
|
||||
|
||||
@@ -2,12 +2,12 @@ package io.legado.app.ui.book.read.config
|
||||
|
||||
import android.os.Bundle
|
||||
import android.view.View
|
||||
import io.legado.app.help.config.ReadBookConfig
|
||||
import com.jaredrummler.android.colorpicker.ColorPickerDialog
|
||||
import io.legado.app.R
|
||||
import io.legado.app.base.BaseBottomSheetDialogFragment
|
||||
import io.legado.app.constant.EventBus
|
||||
import io.legado.app.databinding.DialogUnderlineConfigBinding
|
||||
import io.legado.app.help.config.ReadBookConfig
|
||||
import io.legado.app.help.config.ReadBookConfig.dottedLine
|
||||
import io.legado.app.help.config.ReadBookConfig.underline
|
||||
import io.legado.app.utils.observeEvent
|
||||
@@ -87,6 +87,14 @@ class UnderlineConfigDialog : BaseBottomSheetDialogFragment(R.layout.dialog_unde
|
||||
postEvent(EventBus.UP_CONFIG, arrayListOf(8, 9, 6))
|
||||
}
|
||||
}
|
||||
|
||||
binding.btnUnderlinePadding.apply {
|
||||
progress = ReadBookConfig.underlinePadding
|
||||
onChanged = {
|
||||
ReadBookConfig.underlinePadding = it
|
||||
postEvent(EventBus.UP_CONFIG, arrayListOf(8, 9, 6))
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
@@ -220,7 +220,7 @@ data class TextLine(
|
||||
* 绘制下划线
|
||||
*/
|
||||
private fun drawUnderline(canvas: Canvas, dottedLine: Boolean) {
|
||||
val paint = ChapterProvider.linePaint
|
||||
val paint = ChapterProvider.contentPaint
|
||||
paint.color = ReadBookConfig.durConfig.curUnderlineColor()
|
||||
paint.strokeWidth = ReadBookConfig.underlineHeight.toFloat()
|
||||
paint.pathEffect = if (dottedLine && !AppConfig.isEInkMode)
|
||||
@@ -228,7 +228,7 @@ data class TextLine(
|
||||
else
|
||||
null
|
||||
|
||||
val lineY = height - 1.dpToPx()
|
||||
val lineY = height + (ReadBookConfig.durConfig.underlinePadding - 10).dpToPx()
|
||||
canvas.drawLine(lineStart + indentWidth, lineY, lineEnd, lineY, paint)
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user