diff --git a/app/src/main/java/io/legado/app/data/entities/Book.kt b/app/src/main/java/io/legado/app/data/entities/Book.kt index 42104094e..7010adef2 100644 --- a/app/src/main/java/io/legado/app/data/entities/Book.kt +++ b/app/src/main/java/io/legado/app/data/entities/Book.kt @@ -154,12 +154,16 @@ data class Book( return config().useReplaceRule ?: AppConfig.replaceEnableDefault } + fun setReSegment(reSegment: Boolean) { + config().reSegment = reSegment + } + fun getReSegment(): Boolean { return config().reSegment } - fun setReSegment(reSegment: Boolean) { - config().reSegment = reSegment + fun setPageAnim(pageAnim: Int?) { + config().pageAnim = pageAnim } fun getPageAnim(): Int { @@ -170,18 +174,14 @@ data class Book( return pageAnim } - fun setPageAnim(pageAnim: Int?) { - config().pageAnim = pageAnim + fun setImageStyle(imageStyle: String?) { + config().imageStyle = imageStyle } fun getImageStyle(): String? { return config().imageStyle } - fun setImageStyle(imageStyle: String?) { - config().imageStyle = imageStyle - } - fun setTtsEngine(ttsEngine: String?) { config().ttsEngine = ttsEngine } @@ -190,6 +190,14 @@ data class Book( return config().ttsEngine } + fun setSplitLongChapter(limitLongContent: Boolean) { + config().splitLongChapter = limitLongContent + } + + fun getSplitLongChapter(): Boolean { + return config().splitLongChapter + } + fun getDelTag(tag: Long): Boolean { return config().delTag and tag == tag } @@ -288,6 +296,7 @@ data class Book( var useReplaceRule: Boolean? = null,// 正文使用净化替换规则 var delTag: Long = 0L,//去除标签 var ttsEngine: String? = null, + var splitLongChapter: Boolean = true ) : Parcelable class Converters { diff --git a/app/src/main/java/io/legado/app/ui/book/info/BookInfoActivity.kt b/app/src/main/java/io/legado/app/ui/book/info/BookInfoActivity.kt index 9c32c9cb7..23e5d0a6a 100644 --- a/app/src/main/java/io/legado/app/ui/book/info/BookInfoActivity.kt +++ b/app/src/main/java/io/legado/app/ui/book/info/BookInfoActivity.kt @@ -119,6 +119,8 @@ class BookInfoActivity : override fun onMenuOpened(featureId: Int, menu: Menu): Boolean { menu.findItem(R.id.menu_can_update)?.isChecked = viewModel.bookData.value?.canUpdate ?: true + menu.findItem(R.id.menu_split_long_chapter)?.isChecked = + viewModel.bookData.value?.getSplitLongChapter() ?: true menu.findItem(R.id.menu_login)?.isVisible = !viewModel.bookSource?.loginUrl.isNullOrBlank() menu.findItem(R.id.menu_set_source_variable)?.isVisible = @@ -127,6 +129,8 @@ class BookInfoActivity : viewModel.bookSource != null menu.findItem(R.id.menu_can_update)?.isVisible = viewModel.bookSource != null + menu.findItem(R.id.menu_split_long_chapter)?.isVisible = + viewModel.bookData.value?.isLocalTxt() ?: false return super.onMenuOpened(featureId, menu) } @@ -186,6 +190,16 @@ class BookInfoActivity : } R.id.menu_clear_cache -> viewModel.clearCache() R.id.menu_log -> showDialogFragment() + R.id.menu_split_long_chapter -> { + upLoading(true) + tocChanged = true + viewModel.bookData.value?.let { + it.setSplitLongChapter(!item.isChecked) + viewModel.loadBookInfo(it, false) + } + item.isChecked = !item.isChecked + if (!item.isChecked) longToastOnUi(R.string.need_more_time_load_content) + } } return super.onCompatOptionsItemSelected(item) } diff --git a/app/src/main/java/io/legado/app/ui/book/read/config/TocRegexDialog.kt b/app/src/main/java/io/legado/app/ui/book/read/config/TocRegexDialog.kt index 9fd994bde..26d6ec9c0 100644 --- a/app/src/main/java/io/legado/app/ui/book/read/config/TocRegexDialog.kt +++ b/app/src/main/java/io/legado/app/ui/book/read/config/TocRegexDialog.kt @@ -24,6 +24,7 @@ import io.legado.app.databinding.ItemTocRegexBinding import io.legado.app.lib.dialogs.alert import io.legado.app.lib.theme.backgroundColor import io.legado.app.lib.theme.primaryColor +import io.legado.app.model.ReadBook import io.legado.app.ui.widget.recycler.ItemTouchCallback import io.legado.app.ui.widget.recycler.VerticalDivider import io.legado.app.utils.* @@ -58,6 +59,8 @@ class TocRegexDialog() : BaseDialogFragment(R.layout.dialog_toc_regex), binding.toolBar.setTitle(R.string.txt_toc_regex) binding.toolBar.inflateMenu(R.menu.txt_toc_regex) binding.toolBar.menu.applyTint(requireContext()) + binding.toolBar.menu.findItem(R.id.menu_split_long_chapter) + ?.isChecked = ReadBook.book?.getSplitLongChapter() == true binding.toolBar.setOnMenuItemClickListener(this) initView() initData() @@ -112,6 +115,11 @@ class TocRegexDialog() : BaseDialogFragment(R.layout.dialog_toc_regex), R.id.menu_add -> editRule() R.id.menu_default -> viewModel.importDefault() R.id.menu_import -> showImportDialog() + R.id.menu_split_long_chapter -> { + ReadBook.book?.setSplitLongChapter(!item.isChecked) + item.isChecked = !item.isChecked + if (!item.isChecked) context?.longToastOnUi(R.string.need_more_time_load_content) + } } return false } diff --git a/app/src/main/res/menu/book_info.xml b/app/src/main/res/menu/book_info.xml index 99b8c39ca..911ba2332 100644 --- a/app/src/main/res/menu/book_info.xml +++ b/app/src/main/res/menu/book_info.xml @@ -55,6 +55,12 @@ android:checkable="true" app:showAsAction="never" /> + + + + \ No newline at end of file diff --git a/app/src/main/res/values-es-rES/strings.xml b/app/src/main/res/values-es-rES/strings.xml index 548a559bc..f30e93a85 100644 --- a/app/src/main/res/values-es-rES/strings.xml +++ b/app/src/main/res/values-es-rES/strings.xml @@ -332,7 +332,7 @@ Ajuste de margen Activar actualizaciones Desactivar actualizaciones - 限制正文长度 + 拆分超长章节 正文长度过长时,加载正文可能会花费更多时间 Invertir Buscar libro por nombre o autor diff --git a/app/src/main/res/values-ja-rJP/strings.xml b/app/src/main/res/values-ja-rJP/strings.xml index 65f7212d1..80096a670 100644 --- a/app/src/main/res/values-ja-rJP/strings.xml +++ b/app/src/main/res/values-ja-rJP/strings.xml @@ -336,7 +336,7 @@ Margin adjustment Enable update Disable update - 限制正文长度 + 拆分超长章节 正文长度过长时,加载正文可能会花费更多时间 Inverse Search book name/author diff --git a/app/src/main/res/values-pt-rBR/strings.xml b/app/src/main/res/values-pt-rBR/strings.xml index a175bdfd3..a1440b4d3 100644 --- a/app/src/main/res/values-pt-rBR/strings.xml +++ b/app/src/main/res/values-pt-rBR/strings.xml @@ -918,7 +918,7 @@ 选择保存书籍的文件夹 用户代理 背景透明度 - 限制正文长度 + 拆分超长章节 正文长度过长时,加载正文可能会花费更多时间 diff --git a/app/src/main/res/values-zh-rHK/strings.xml b/app/src/main/res/values-zh-rHK/strings.xml index 18c955c57..f9a1df69d 100644 --- a/app/src/main/res/values-zh-rHK/strings.xml +++ b/app/src/main/res/values-zh-rHK/strings.xml @@ -333,7 +333,7 @@ Tip 邊距跟隨邊距調整 允許更新 禁止更新 - 限制正文长度 + 拆分超长章节 正文长度过长时,加载正文可能会花费更多时间 反選 搜索書名、作者 diff --git a/app/src/main/res/values-zh-rTW/strings.xml b/app/src/main/res/values-zh-rTW/strings.xml index c173bf2c1..eb0a1b648 100644 --- a/app/src/main/res/values-zh-rTW/strings.xml +++ b/app/src/main/res/values-zh-rTW/strings.xml @@ -335,7 +335,7 @@ Tip邊距跟隨邊距調整 允許更新 禁止更新 - 限制正文长度 + 拆分超长章节 正文长度过长时,加载正文可能会花费更多时间 反選 搜尋書名、作者 diff --git a/app/src/main/res/values-zh/strings.xml b/app/src/main/res/values-zh/strings.xml index 400c9a194..ddb995495 100644 --- a/app/src/main/res/values-zh/strings.xml +++ b/app/src/main/res/values-zh/strings.xml @@ -335,7 +335,7 @@ Tip边距跟随边距调整 允许更新 禁止更新 - 限制正文长度 + 拆分超长章节 正文长度过长时,加载正文可能会花费更多时间 反选 搜索书名、作者 diff --git a/app/src/main/res/values/strings.xml b/app/src/main/res/values/strings.xml index 23a704a5f..360574d00 100644 --- a/app/src/main/res/values/strings.xml +++ b/app/src/main/res/values/strings.xml @@ -336,7 +336,7 @@ Margin adjustment Enable update Disable update - 限制正文长度 + 拆分超长章节 正文长度过长时,加载正文可能会花费更多时间 Inverse Search book name/author