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 7ef56460e..0dbd518af 100644 --- a/app/src/main/java/io/legado/app/constant/PreferKey.kt +++ b/app/src/main/java/io/legado/app/constant/PreferKey.kt @@ -21,7 +21,6 @@ object PreferKey { const val processText = "process_text" const val cleanCache = "cleanCache" const val saveTabPosition = "saveTabPosition" - const val pageAnim = "pageAnim" const val fontFolder = "fontFolder" const val backupPath = "backupUri" const val restoreIgnore = "restoreIgnore" @@ -40,7 +39,6 @@ object PreferKey { const val launcherIcon = "launcherIcon" const val textSelectAble = "selectText" const val lastBackup = "lastBackup" - const val bodyIndent = "textIndent" const val shareLayout = "shareLayout" const val readStyleSelect = "readStyleSelect" const val systemTypefaces = "system_typefaces" diff --git a/app/src/main/java/io/legado/app/help/BookHelp.kt b/app/src/main/java/io/legado/app/help/BookHelp.kt index f52252f0b..36a193fa0 100644 --- a/app/src/main/java/io/legado/app/help/BookHelp.kt +++ b/app/src/main/java/io/legado/app/help/BookHelp.kt @@ -327,10 +327,10 @@ object BookHelp { if (contents.isEmpty()) { contents.add(title) if (str != title && it.isNotEmpty()) { - contents.add("${ReadBookConfig.bodyIndent}$str") + contents.add("${ReadBookConfig.paragraphIndent}$str") } } else if (str.isNotEmpty()) { - contents.add("${ReadBookConfig.bodyIndent}$str") + contents.add("${ReadBookConfig.paragraphIndent}$str") } } return contents 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 118f5b6ca..6e3557231 100644 --- a/app/src/main/java/io/legado/app/help/ReadBookConfig.kt +++ b/app/src/main/java/io/legado/app/help/ReadBookConfig.kt @@ -162,15 +162,6 @@ object ReadBookConfig { 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 - bodyIndent = " ".repeat(value) - if (App.INSTANCE.getPrefInt(PreferKey.bodyIndent, 2) != value) { - App.INSTANCE.putPrefInt(PreferKey.bodyIndent, value) - } - } - var bodyIndent = " ".repeat(bodyIndentCount) var hideStatusBar = App.INSTANCE.getPrefBoolean(PreferKey.hideStatusBar) var hideNavigationBar = App.INSTANCE.getPrefBoolean(PreferKey.hideNavigationBar) @@ -242,6 +233,12 @@ object ReadBookConfig { config.titleBottomSpacing = value } + var paragraphIndent: String + get() = config.paragraphIndent + set(value) { + config.paragraphIndent = value + } + var paddingBottom: Int get() = config.paddingBottom set(value) { @@ -392,6 +389,7 @@ object ReadBookConfig { var titleSize: Int = 0, var titleTopSpacing: Int = 0, var titleBottomSpacing: Int = 0, + var paragraphIndent: String = "  ",//段落缩进 var paddingBottom: Int = 6, var paddingLeft: Int = 16, var paddingRight: Int = 16, diff --git a/app/src/main/java/io/legado/app/help/storage/Restore.kt b/app/src/main/java/io/legado/app/help/storage/Restore.kt index b98a248d1..7b0e7636d 100644 --- a/app/src/main/java/io/legado/app/help/storage/Restore.kt +++ b/app/src/main/java/io/legado/app/help/storage/Restore.kt @@ -63,7 +63,6 @@ object Restore { PreferKey.shareLayout, PreferKey.hideStatusBar, PreferKey.hideNavigationBar, - PreferKey.bodyIndent, PreferKey.autoReadSpeed ) @@ -216,7 +215,6 @@ object Restore { shareLayout = App.INSTANCE.getPrefBoolean(PreferKey.shareLayout) hideStatusBar = App.INSTANCE.getPrefBoolean(PreferKey.hideStatusBar) hideNavigationBar = App.INSTANCE.getPrefBoolean(PreferKey.hideNavigationBar) - bodyIndentCount = App.INSTANCE.getPrefInt(PreferKey.bodyIndent, 2) autoReadSpeed = App.INSTANCE.getPrefInt(PreferKey.autoReadSpeed, 46) } ChapterProvider.upStyle() diff --git a/app/src/main/java/io/legado/app/ui/book/read/config/ReadStyleDialog.kt b/app/src/main/java/io/legado/app/ui/book/read/config/ReadStyleDialog.kt index a791e6939..7a0915ddd 100644 --- a/app/src/main/java/io/legado/app/ui/book/read/config/ReadStyleDialog.kt +++ b/app/src/main/java/io/legado/app/ui/book/read/config/ReadStyleDialog.kt @@ -126,7 +126,7 @@ class ReadStyleDialog : BaseDialogFragment(), FontSelectDialog.CallBack { title = getString(R.string.text_indent), items = resources.getStringArray(R.array.indent).toList() ) { _, index -> - ReadBookConfig.bodyIndentCount = index + ReadBookConfig.paragraphIndent = " ".repeat(index) postEvent(EventBus.UP_CONFIG, true) } } diff --git a/app/src/main/java/io/legado/app/ui/book/read/page/provider/ChapterProvider.kt b/app/src/main/java/io/legado/app/ui/book/read/page/provider/ChapterProvider.kt index a8cf1482d..4c59a4202 100644 --- a/app/src/main/java/io/legado/app/ui/book/read/page/provider/ChapterProvider.kt +++ b/app/src/main/java/io/legado/app/ui/book/read/page/provider/ChapterProvider.kt @@ -272,7 +272,7 @@ object ChapterProvider { ) return } - val bodyIndent = ReadBookConfig.bodyIndent + val bodyIndent = ReadBookConfig.paragraphIndent val icw = StaticLayout.getDesiredWidth(bodyIndent, textPaint) / bodyIndent.length bodyIndent.toStringArray().forEach { val x1 = x + icw