pull/1625/head
kunfei 3 years ago
parent f928e4ed74
commit f3949a7773
  1. 9
      app/src/main/java/io/legado/app/data/entities/Book.kt
  2. 14
      app/src/main/java/io/legado/app/ui/book/info/BookInfoActivity.kt
  3. 8
      app/src/main/java/io/legado/app/ui/book/read/config/TocRegexDialog.kt
  4. 6
      app/src/main/res/menu/book_info.xml
  5. 6
      app/src/main/res/menu/txt_toc_regex.xml

@ -162,14 +162,6 @@ data class Book(
config().reSegment = reSegment config().reSegment = reSegment
} }
fun getLimitContentLength(): Boolean {
return config().limitContentLength
}
fun setLimitContentLength(limitContentLength: Boolean) {
config().limitContentLength = limitContentLength
}
fun getPageAnim(): Int { fun getPageAnim(): Int {
var pageAnim = config().pageAnim ?: ReadBookConfig.pageAnim var pageAnim = config().pageAnim ?: ReadBookConfig.pageAnim
if (pageAnim < 0) { if (pageAnim < 0) {
@ -292,7 +284,6 @@ data class Book(
var reverseToc: Boolean = false, var reverseToc: Boolean = false,
var pageAnim: Int? = null, var pageAnim: Int? = null,
var reSegment: Boolean = false, var reSegment: Boolean = false,
var limitContentLength: Boolean = true, //txt规则解析目录时超过规定的最大字数时均分txt
var imageStyle: String? = null, var imageStyle: String? = null,
var useReplaceRule: Boolean? = null,// 正文使用净化替换规则 var useReplaceRule: Boolean? = null,// 正文使用净化替换规则
var delTag: Long = 0L,//去除标签 var delTag: Long = 0L,//去除标签

@ -119,8 +119,6 @@ class BookInfoActivity :
override fun onMenuOpened(featureId: Int, menu: Menu): Boolean { override fun onMenuOpened(featureId: Int, menu: Menu): Boolean {
menu.findItem(R.id.menu_can_update)?.isChecked = menu.findItem(R.id.menu_can_update)?.isChecked =
viewModel.bookData.value?.canUpdate ?: true viewModel.bookData.value?.canUpdate ?: true
menu.findItem(R.id.menu_limit_content_length)?.isChecked =
viewModel.bookData.value?.getLimitContentLength() ?: false
menu.findItem(R.id.menu_login)?.isVisible = menu.findItem(R.id.menu_login)?.isVisible =
!viewModel.bookSource?.loginUrl.isNullOrBlank() !viewModel.bookSource?.loginUrl.isNullOrBlank()
menu.findItem(R.id.menu_set_source_variable)?.isVisible = menu.findItem(R.id.menu_set_source_variable)?.isVisible =
@ -129,8 +127,6 @@ class BookInfoActivity :
viewModel.bookSource != null viewModel.bookSource != null
menu.findItem(R.id.menu_can_update)?.isVisible = menu.findItem(R.id.menu_can_update)?.isVisible =
viewModel.bookSource != null viewModel.bookSource != null
menu.findItem(R.id.menu_limit_content_length)?.isVisible =
viewModel.bookData.value?.isLocalTxt() ?: false
return super.onMenuOpened(featureId, menu) return super.onMenuOpened(featureId, menu)
} }
@ -190,16 +186,6 @@ class BookInfoActivity :
} }
R.id.menu_clear_cache -> viewModel.clearCache() R.id.menu_clear_cache -> viewModel.clearCache()
R.id.menu_log -> showDialogFragment<AppLogDialog>() R.id.menu_log -> showDialogFragment<AppLogDialog>()
R.id.menu_limit_content_length -> {
upLoading(true)
tocChanged = true
viewModel.bookData.value?.let {
it.setLimitContentLength(!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) return super.onCompatOptionsItemSelected(item)
} }

@ -24,7 +24,6 @@ import io.legado.app.databinding.ItemTocRegexBinding
import io.legado.app.lib.dialogs.alert import io.legado.app.lib.dialogs.alert
import io.legado.app.lib.theme.backgroundColor import io.legado.app.lib.theme.backgroundColor
import io.legado.app.lib.theme.primaryColor 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.ItemTouchCallback
import io.legado.app.ui.widget.recycler.VerticalDivider import io.legado.app.ui.widget.recycler.VerticalDivider
import io.legado.app.utils.* import io.legado.app.utils.*
@ -59,8 +58,6 @@ class TocRegexDialog() : BaseDialogFragment(R.layout.dialog_toc_regex),
binding.toolBar.setTitle(R.string.txt_toc_regex) binding.toolBar.setTitle(R.string.txt_toc_regex)
binding.toolBar.inflateMenu(R.menu.txt_toc_regex) binding.toolBar.inflateMenu(R.menu.txt_toc_regex)
binding.toolBar.menu.applyTint(requireContext()) binding.toolBar.menu.applyTint(requireContext())
binding.toolBar.menu.findItem(R.id.menu_limit_content_length)
?.isChecked = ReadBook.book?.getLimitContentLength() == true
binding.toolBar.setOnMenuItemClickListener(this) binding.toolBar.setOnMenuItemClickListener(this)
initView() initView()
initData() initData()
@ -115,11 +112,6 @@ class TocRegexDialog() : BaseDialogFragment(R.layout.dialog_toc_regex),
R.id.menu_add -> editRule() R.id.menu_add -> editRule()
R.id.menu_default -> viewModel.importDefault() R.id.menu_default -> viewModel.importDefault()
R.id.menu_import -> showImportDialog() R.id.menu_import -> showImportDialog()
R.id.menu_limit_content_length -> {
ReadBook.book?.setLimitContentLength(!item.isChecked)
item.isChecked = !item.isChecked
if (!item.isChecked) context?.longToastOnUi(R.string.need_more_time_load_content)
}
} }
return false return false
} }

@ -55,12 +55,6 @@
android:checkable="true" android:checkable="true"
app:showAsAction="never" /> app:showAsAction="never" />
<item
android:id="@+id/menu_limit_content_length"
android:title="@string/limit_content_length"
android:checkable="true"
app:showAsAction="never" />
<item <item
android:id="@+id/menu_clear_cache" android:id="@+id/menu_clear_cache"
android:title="@string/clear_cache" android:title="@string/clear_cache"

@ -20,10 +20,4 @@
android:title="@string/import_replace_rule_on_line" android:title="@string/import_replace_rule_on_line"
app:showAsAction="never" /> app:showAsAction="never" />
<item
android:id="@+id/menu_limit_content_length"
android:title="@string/limit_content_length"
android:checkable="true"
app:showAsAction="never" />
</menu> </menu>
Loading…
Cancel
Save