From 70f1082bba185b7e86220c1d332a4a8fdf173ca3 Mon Sep 17 00:00:00 2001 From: kunfei Date: Wed, 28 Aug 2019 17:03:10 +0800 Subject: [PATCH] up --- .../app/ui/readbook/config/PaddingConfigDialog.java | 4 ++++ .../java/io/legado/app/ui/widget/page/ContentTextView.kt | 8 ++++---- 2 files changed, 8 insertions(+), 4 deletions(-) create mode 100644 app/src/main/java/io/legado/app/ui/readbook/config/PaddingConfigDialog.java diff --git a/app/src/main/java/io/legado/app/ui/readbook/config/PaddingConfigDialog.java b/app/src/main/java/io/legado/app/ui/readbook/config/PaddingConfigDialog.java new file mode 100644 index 000000000..dfbfbb641 --- /dev/null +++ b/app/src/main/java/io/legado/app/ui/readbook/config/PaddingConfigDialog.java @@ -0,0 +1,4 @@ +package io.legado.app.ui.readbook.config; + +public class PaddingConfigDialog { +} diff --git a/app/src/main/java/io/legado/app/ui/widget/page/ContentTextView.kt b/app/src/main/java/io/legado/app/ui/widget/page/ContentTextView.kt index 680627567..0e7a7bea8 100644 --- a/app/src/main/java/io/legado/app/ui/widget/page/ContentTextView.kt +++ b/app/src/main/java/io/legado/app/ui/widget/page/ContentTextView.kt @@ -10,21 +10,21 @@ class ContentTextView : AppCompatTextView { constructor(context: Context, attrs: AttributeSet?) : super(context, attrs) - constructor(context: Context, attrs: AttributeSet?, defStyleAttr: Int) : super(context, attrs, defStyleAttr) + constructor(context: Context, attrs: AttributeSet?, defStyleAttr: Int) + : super(context, attrs, defStyleAttr) /** * 获取当前页总字数 */ fun getCharNum(): Int { - return layout.getLineEnd(getLineNum()) + return layout?.getLineEnd(getLineNum()) ?: 0 } /** * 获取当前页总行数 */ fun getLineNum(): Int { - val layout = layout val topOfLastLine = height - paddingTop - paddingBottom - lineHeight - return layout.getLineForVertical(topOfLastLine) + return layout?.getLineForVertical(topOfLastLine) ?: 0 } }