feat: 优化代码

pull/190/head
kunfei 5 years ago
parent fd951844ff
commit 9022105955
  1. 4
      app/src/main/java/io/legado/app/ui/book/read/page/ChapterProvider.kt
  2. 2
      app/src/main/java/io/legado/app/ui/book/read/page/ContentTextView.kt

@ -279,13 +279,13 @@ object ChapterProvider {
paragraphSpacing = ReadBookConfig.paragraphSpacing paragraphSpacing = ReadBookConfig.paragraphSpacing
titleTopSpacing = ReadBookConfig.titleTopSpacing.dp titleTopSpacing = ReadBookConfig.titleTopSpacing.dp
titleBottomSpacing = ReadBookConfig.titleBottomSpacing.dp titleBottomSpacing = ReadBookConfig.titleBottomSpacing.dp
upSize() upViewSize()
} }
/** /**
* 更新View尺寸 * 更新View尺寸
*/ */
fun upSize() { fun upViewSize() {
paddingLeft = ReadBookConfig.paddingLeft.dp paddingLeft = ReadBookConfig.paddingLeft.dp
paddingTop = ReadBookConfig.paddingTop.dp paddingTop = ReadBookConfig.paddingTop.dp
visibleWidth = viewWidth - paddingLeft - ReadBookConfig.paddingRight.dp visibleWidth = viewWidth - paddingLeft - ReadBookConfig.paddingRight.dp

@ -61,7 +61,7 @@ class ContentTextView(context: Context, attrs: AttributeSet?) : View(context, at
super.onSizeChanged(w, h, oldw, oldh) super.onSizeChanged(w, h, oldw, oldh)
ChapterProvider.viewWidth = w ChapterProvider.viewWidth = w
ChapterProvider.viewHeight = h ChapterProvider.viewHeight = h
ChapterProvider.upSize() ChapterProvider.upViewSize()
upVisibleRect() upVisibleRect()
textPage.format() textPage.format()
} }

Loading…
Cancel
Save