From 72d599354683d07f74f55e9142ca45b9f78adc91 Mon Sep 17 00:00:00 2001 From: gedoor Date: Fri, 3 Jul 2020 20:26:59 +0800 Subject: [PATCH] =?UTF-8?q?feat:=20=E6=B7=BB=E5=8A=A0=E6=96=87=E5=AD=97?= =?UTF-8?q?=E5=BA=95=E9=83=A8=E5=AF=B9=E9=BD=90=E5=BC=80=E5=85=B3?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/src/main/java/io/legado/app/constant/PreferKey.kt | 1 + app/src/main/java/io/legado/app/help/ReadBookConfig.kt | 1 + .../io/legado/app/ui/book/read/config/MoreConfigDialog.kt | 3 ++- .../io/legado/app/ui/book/read/page/entities/TextPage.kt | 2 ++ app/src/main/res/values-zh-rHK/strings.xml | 1 + app/src/main/res/values-zh-rTW/strings.xml | 1 + app/src/main/res/values/strings.xml | 1 + app/src/main/res/xml/pref_config_read.xml | 6 ++++++ 8 files changed, 15 insertions(+), 1 deletion(-) diff --git a/app/src/main/java/io/legado/app/constant/PreferKey.kt b/app/src/main/java/io/legado/app/constant/PreferKey.kt index 93ea963ca..4d0194d38 100644 --- a/app/src/main/java/io/legado/app/constant/PreferKey.kt +++ b/app/src/main/java/io/legado/app/constant/PreferKey.kt @@ -44,6 +44,7 @@ object PreferKey { const val systemTypefaces = "system_typefaces" const val readBodyToLh = "readBodyToLh" const val textFullJustify = "textFullJustify" + const val textBottomJustify = "textBottomJustify" const val autoReadSpeed = "autoReadSpeed" const val barElevation = "barElevation" const val transparentStatusBar = "transparentStatusBar" diff --git a/app/src/main/java/io/legado/app/help/ReadBookConfig.kt b/app/src/main/java/io/legado/app/help/ReadBookConfig.kt index 823ddee55..761946347 100644 --- a/app/src/main/java/io/legado/app/help/ReadBookConfig.kt +++ b/app/src/main/java/io/legado/app/help/ReadBookConfig.kt @@ -144,6 +144,7 @@ object ReadBookConfig { var isScroll = pageAnim == 3 val clickTurnPage get() = App.INSTANCE.getPrefBoolean(PreferKey.clickTurnPage, true) val textFullJustify get() = App.INSTANCE.getPrefBoolean(PreferKey.textFullJustify, true) + val textBottomJustify get() = App.INSTANCE.getPrefBoolean(PreferKey.textBottomJustify, true) var bodyIndentCount = App.INSTANCE.getPrefInt(PreferKey.bodyIndent, 2) set(value) { field = value diff --git a/app/src/main/java/io/legado/app/ui/book/read/config/MoreConfigDialog.kt b/app/src/main/java/io/legado/app/ui/book/read/config/MoreConfigDialog.kt index 7033b82d0..37d30f3d0 100644 --- a/app/src/main/java/io/legado/app/ui/book/read/config/MoreConfigDialog.kt +++ b/app/src/main/java/io/legado/app/ui/book/read/config/MoreConfigDialog.kt @@ -111,7 +111,8 @@ class MoreConfigDialog : DialogFragment() { Help.setOrientation(it) } } - PreferKey.textFullJustify -> { + PreferKey.textFullJustify, + PreferKey.textBottomJustify -> { postEvent(EventBus.UP_CONFIG, true) } } diff --git a/app/src/main/java/io/legado/app/ui/book/read/page/entities/TextPage.kt b/app/src/main/java/io/legado/app/ui/book/read/page/entities/TextPage.kt index e81af6986..773fb6150 100644 --- a/app/src/main/java/io/legado/app/ui/book/read/page/entities/TextPage.kt +++ b/app/src/main/java/io/legado/app/ui/book/read/page/entities/TextPage.kt @@ -4,6 +4,7 @@ import android.text.Layout import android.text.StaticLayout import io.legado.app.App import io.legado.app.R +import io.legado.app.help.ReadBookConfig import io.legado.app.ui.book.read.page.ChapterProvider import java.text.DecimalFormat @@ -19,6 +20,7 @@ data class TextPage( ) { fun upLinesPosition() = ChapterProvider.apply { + if (!ReadBookConfig.textBottomJustify) return@apply if (textLines.size <= 1) return@apply if (visibleHeight - height >= with(textLines.last()) { lineBottom - lineTop }) return@apply val surplus = (visibleBottom - textLines.last().lineBottom) diff --git a/app/src/main/res/values-zh-rHK/strings.xml b/app/src/main/res/values-zh-rHK/strings.xml index 4f5ea6840..e1655852a 100644 --- a/app/src/main/res/values-zh-rHK/strings.xml +++ b/app/src/main/res/values-zh-rHK/strings.xml @@ -705,4 +705,5 @@ 選擇舊版備份文件夾 已啓用 已禁用 + 文字底部對齊 diff --git a/app/src/main/res/values-zh-rTW/strings.xml b/app/src/main/res/values-zh-rTW/strings.xml index 672ad5e4d..3b228acc2 100644 --- a/app/src/main/res/values-zh-rTW/strings.xml +++ b/app/src/main/res/values-zh-rTW/strings.xml @@ -705,5 +705,6 @@ 選擇舊版備份文件夾 已啓用 已禁用 + 文字底部對齊 diff --git a/app/src/main/res/values/strings.xml b/app/src/main/res/values/strings.xml index ab9bdaa15..909721105 100644 --- a/app/src/main/res/values/strings.xml +++ b/app/src/main/res/values/strings.xml @@ -698,6 +698,7 @@ 夜间,底栏色 自动换源 文字两端对齐 + 文字底部对齐 自动翻页速度 地址排序 本地和WebDav一起备份 diff --git a/app/src/main/res/xml/pref_config_read.xml b/app/src/main/res/xml/pref_config_read.xml index 3b1e81f3c..6125aba08 100644 --- a/app/src/main/res/xml/pref_config_read.xml +++ b/app/src/main/res/xml/pref_config_read.xml @@ -42,6 +42,12 @@ android:key="textFullJustify" app:iconSpaceReserved="false" /> + +