From 284fe6ce569db28c0c7f1fe02f473e5ac05b1e12 Mon Sep 17 00:00:00 2001 From: kunfei Date: Mon, 24 Feb 2020 16:07:41 +0800 Subject: [PATCH] =?UTF-8?q?feat:=20=E4=BC=98=E5=8C=96=E4=BB=A3=E7=A0=81?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/src/main/java/io/legado/app/help/BookHelp.kt | 10 ++++++++-- .../legado/app/ui/book/read/config/ReadStyleDialog.kt | 4 ++-- 2 files changed, 10 insertions(+), 4 deletions(-) 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 0e97cf940..c7560b819 100644 --- a/app/src/main/java/io/legado/app/help/BookHelp.kt +++ b/app/src/main/java/io/legado/app/help/BookHelp.kt @@ -237,8 +237,14 @@ object BookHelp { private var bookName: String? = null private var bookOrigin: String? = null private var replaceRules: List = arrayListOf() - val bodyIndent - get() = " ".repeat(App.INSTANCE.getPrefInt(PreferKey.bodyIndent, 2)) + var bodyIndentCount = App.INSTANCE.getPrefInt(PreferKey.bodyIndent, 2) + set(value) { + field = value + App.INSTANCE.putPrefInt(PreferKey.bodyIndent, value) + bodyIndent = " ".repeat(value) + } + var bodyIndent = " ".repeat(bodyIndentCount) + fun disposeContent( title: String, 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 590985d48..c78466569 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 @@ -11,6 +11,7 @@ import androidx.fragment.app.DialogFragment import io.legado.app.R import io.legado.app.constant.EventBus import io.legado.app.constant.PreferKey +import io.legado.app.help.BookHelp import io.legado.app.help.ImageLoader import io.legado.app.help.ReadBookConfig import io.legado.app.lib.dialogs.selector @@ -21,7 +22,6 @@ import io.legado.app.ui.book.read.ReadBookActivity import io.legado.app.ui.widget.font.FontSelectDialog import io.legado.app.utils.getPrefString import io.legado.app.utils.postEvent -import io.legado.app.utils.putPrefInt import io.legado.app.utils.putPrefString import kotlinx.android.synthetic.main.activity_book_read.* import kotlinx.android.synthetic.main.dialog_read_book_style.* @@ -116,7 +116,7 @@ class ReadStyleDialog : DialogFragment(), FontSelectDialog.CallBack { title = getString(R.string.text_indent), items = resources.getStringArray(R.array.indent).toList() ) { _, index -> - putPrefInt(PreferKey.bodyIndent, index) + BookHelp.bodyIndentCount = index postEvent(EventBus.UP_CONFIG, true) } }