feat: 优化代码

pull/141/head
kunfei 5 years ago
parent af06cb384e
commit 4cb126f7b9
  1. 6
      app/src/main/java/io/legado/app/help/ReadBookConfig.kt
  2. 4
      app/src/main/java/io/legado/app/ui/book/read/page/ChapterProvider.kt

@ -169,7 +169,10 @@ object ReadBookConfig {
get() = if (shareLayout) shareConfig.titleMode else durConfig.titleMode
set(value) =
if (shareLayout) shareConfig.titleMode = value else durConfig.titleMode = value
var titleSize: Int
get() = if (shareLayout) shareConfig.titleSize else durConfig.titleSize
set(value) =
if (shareLayout) shareConfig.titleSize = value else durConfig.titleSize = value
var titleTopSpacing: Int
get() = if (shareLayout) shareConfig.titleTopSpacing else durConfig.titleTopSpacing
set(value) =
@ -271,6 +274,7 @@ object ReadBookConfig {
var lineSpacingExtra: Int = 12,//行间距
var paragraphSpacing: Int = 12,//段距
var titleMode: Int = 0,//标题居中
var titleSize: Int = 0,
var titleTopSpacing: Int = 0,
var titleBottomSpacing: Int = 0,
var paddingBottom: Int = 6,

@ -267,17 +267,17 @@ object ChapterProvider {
titlePaint.color = ReadBookConfig.durConfig.textColor()
titlePaint.letterSpacing = ReadBookConfig.letterSpacing
titlePaint.typeface = Typeface.create(typeface, Typeface.BOLD)
titlePaint.textSize = (ReadBookConfig.textSize + ReadBookConfig.titleSize).sp.toFloat()
//正文
contentPaint.isAntiAlias = true
contentPaint.color = ReadBookConfig.durConfig.textColor()
contentPaint.letterSpacing = ReadBookConfig.letterSpacing
val bold = if (ReadBookConfig.textBold) Typeface.BOLD else Typeface.NORMAL
contentPaint.typeface = Typeface.create(typeface, bold)
contentPaint.textSize = ReadBookConfig.textSize.sp.toFloat()
//间距
lineSpacingExtra = ReadBookConfig.lineSpacingExtra
paragraphSpacing = ReadBookConfig.paragraphSpacing
titlePaint.textSize = (ReadBookConfig.textSize + 2).sp.toFloat()
contentPaint.textSize = ReadBookConfig.textSize.sp.toFloat()
titleTopSpacing = ReadBookConfig.titleTopSpacing.dp
titleBottomSpacing = ReadBookConfig.titleBottomSpacing.dp
upSize()

Loading…
Cancel
Save