优化
This commit is contained in:
@@ -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 {
|
||||
|
||||
@@ -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<AppLogDialog>()
|
||||
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)
|
||||
}
|
||||
|
||||
@@ -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
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user