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" /> + +