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 8913956d3..6542640c8 100644
--- a/app/src/main/java/io/legado/app/constant/PreferKey.kt
+++ b/app/src/main/java/io/legado/app/constant/PreferKey.kt
@@ -43,4 +43,5 @@ object PreferKey {
const val readStyleSelect = "readStyleSelect"
const val systemTypefaces = "system_typefaces"
const val readBodyToLh = "readBodyToLh"
+ const val textFullJustify = "textFullJustify"
}
\ No newline at end of file
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 ff4180081..6bc3bd5af 100644
--- a/app/src/main/java/io/legado/app/help/ReadBookConfig.kt
+++ b/app/src/main/java/io/legado/app/help/ReadBookConfig.kt
@@ -127,6 +127,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)
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 5d8ec5d82..7033b82d0 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,6 +111,9 @@ class MoreConfigDialog : DialogFragment() {
Help.setOrientation(it)
}
}
+ PreferKey.textFullJustify -> {
+ postEvent(EventBus.UP_CONFIG, true)
+ }
}
}
diff --git a/app/src/main/java/io/legado/app/ui/book/read/page/ChapterProvider.kt b/app/src/main/java/io/legado/app/ui/book/read/page/ChapterProvider.kt
index e0cee0b5c..b988ba782 100644
--- a/app/src/main/java/io/legado/app/ui/book/read/page/ChapterProvider.kt
+++ b/app/src/main/java/io/legado/app/ui/book/read/page/ChapterProvider.kt
@@ -161,6 +161,10 @@ object ChapterProvider {
desiredWidth: Float
) {
var x = 0f
+ if (!ReadBookConfig.textFullJustify) {
+ addCharsToLineLast(textLine, words, textPaint, x)
+ return
+ }
val bodyIndent = ReadBookConfig.bodyIndent
val icw = StaticLayout.getDesiredWidth(bodyIndent, textPaint) / bodyIndent.length
bodyIndent.toStringArray().forEach {
@@ -186,6 +190,10 @@ object ChapterProvider {
desiredWidth: Float,
startX: Float
) {
+ if (!ReadBookConfig.textFullJustify) {
+ addCharsToLineLast(textLine, words, textPaint, startX)
+ return
+ }
val gapCount: Int = words.length - 1
val d = (visibleWidth - desiredWidth) / gapCount
var x = startX
diff --git a/app/src/main/res/values-zh-rHK/strings.xml b/app/src/main/res/values-zh-rHK/strings.xml
index 84b579b55..edcfe8a08 100644
--- a/app/src/main/res/values-zh-rHK/strings.xml
+++ b/app/src/main/res/values-zh-rHK/strings.xml
@@ -691,4 +691,5 @@
隱藏頁脚
自動換源
置底
+ 文字兩端對齊
diff --git a/app/src/main/res/values/strings.xml b/app/src/main/res/values/strings.xml
index 297a4c632..124663532 100644
--- a/app/src/main/res/values/strings.xml
+++ b/app/src/main/res/values/strings.xml
@@ -693,5 +693,6 @@
夜间,背景色
夜间,底栏色
自动换源
+ 文字两端对齐
diff --git a/app/src/main/res/xml/pref_config_read.xml b/app/src/main/res/xml/pref_config_read.xml
index 377fef241..3b1e81f3c 100644
--- a/app/src/main/res/xml/pref_config_read.xml
+++ b/app/src/main/res/xml/pref_config_read.xml
@@ -2,79 +2,85 @@
-
+
-
+
-
+
-
+
-
+
-
+
-
+
-
+
-
+
-
+
-
+
-
+
+
+
\ No newline at end of file