优化
This commit is contained in:
@@ -23,10 +23,7 @@ import io.legado.app.ui.book.read.page.entities.column.*
|
||||
import io.legado.app.ui.book.read.page.provider.ChapterProvider
|
||||
import io.legado.app.ui.book.read.page.provider.ImageProvider
|
||||
import io.legado.app.ui.book.read.page.provider.TextPageFactory
|
||||
import io.legado.app.utils.activity
|
||||
import io.legado.app.utils.getCompatColor
|
||||
import io.legado.app.utils.getPrefBoolean
|
||||
import io.legado.app.utils.toastOnUi
|
||||
import io.legado.app.utils.*
|
||||
import kotlin.math.min
|
||||
|
||||
/**
|
||||
@@ -149,14 +146,15 @@ class ContentTextView(context: Context, attrs: AttributeSet?) : View(context, at
|
||||
val lineBottom = textLine.lineBottom + relativeOffset
|
||||
drawChars(canvas, textPage, textLine, lineTop, lineBase, lineBottom)
|
||||
if (ReadBookConfig.underline && ReadBook.book?.isImage != true) {
|
||||
drawUnderline(canvas, textLine, lineBottom)
|
||||
drawUnderline(canvas, textLine, relativeOffset)
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 绘制下划线
|
||||
*/
|
||||
private fun drawUnderline(canvas: Canvas, textLine: TextLine, lineY: Float) {
|
||||
private fun drawUnderline(canvas: Canvas, textLine: TextLine, relativeOffset: Float) {
|
||||
val lineY = relativeOffset + textLine.lineBottom - 1.dpToPx()
|
||||
canvas.drawLine(
|
||||
textLine.lineStart,
|
||||
lineY,
|
||||
|
||||
@@ -675,12 +675,12 @@ object ChapterProvider {
|
||||
}
|
||||
|
||||
/**
|
||||
* 更新View尺寸,height减去1dp防止下划线无法画全
|
||||
* 更新View尺寸
|
||||
*/
|
||||
fun upViewSize(width: Int, height: Int) {
|
||||
if (width > 0 && height > 0 && (width != viewWidth || height != viewHeight)) {
|
||||
viewWidth = width
|
||||
viewHeight = height - 1.dpToPx()
|
||||
viewHeight = height
|
||||
upLayout()
|
||||
postEvent(EventBus.UP_CONFIG, true)
|
||||
}
|
||||
@@ -713,6 +713,7 @@ object ChapterProvider {
|
||||
} else {
|
||||
viewWidth - paddingLeft - paddingRight
|
||||
}
|
||||
//留1dp画最后一行下划线
|
||||
visibleHeight = viewHeight - paddingTop - paddingBottom
|
||||
visibleRight = viewWidth - paddingRight
|
||||
visibleBottom = paddingTop + visibleHeight
|
||||
|
||||
Reference in New Issue
Block a user