pull/467/head
gedoor 4 years ago
parent 72fa07ca66
commit 727bcdd498
  1. 3
      app/src/main/java/io/legado/app/help/AppConfig.kt
  2. 12
      app/src/main/java/io/legado/app/ui/book/changesource/ChangeSourceDialog.kt
  3. 4
      app/src/main/java/io/legado/app/ui/book/changesource/ChangeSourceViewModel.kt

@ -131,5 +131,8 @@ object AppConfig {
App.INSTANCE.getPrefBoolean(PreferKey.replaceEnableDefault, true)
}
val changeSourceLoadInfo get() = App.INSTANCE.getPrefBoolean(PreferKey.changeSourceLoadToc)
val changeSourceLoadToc get() = App.INSTANCE.getPrefBoolean(PreferKey.changeSourceLoadToc)
}

@ -16,9 +16,13 @@ import io.legado.app.base.BaseDialogFragment
import io.legado.app.constant.PreferKey
import io.legado.app.data.entities.Book
import io.legado.app.data.entities.SearchBook
import io.legado.app.help.AppConfig
import io.legado.app.lib.theme.primaryColor
import io.legado.app.ui.widget.recycler.VerticalDivider
import io.legado.app.utils.*
import io.legado.app.utils.applyTint
import io.legado.app.utils.getSize
import io.legado.app.utils.getViewModel
import io.legado.app.utils.putPrefBoolean
import kotlinx.android.synthetic.main.dialog_change_source.*
@ -81,10 +85,8 @@ class ChangeSourceDialog : BaseDialogFragment(),
tool_bar.inflateMenu(R.menu.change_source)
tool_bar.menu.applyTint(requireContext())
tool_bar.setOnMenuItemClickListener(this)
tool_bar.menu.findItem(R.id.menu_load_toc)?.isChecked =
getPrefBoolean(PreferKey.changeSourceLoadToc)
tool_bar.menu.findItem(R.id.menu_load_info)?.isChecked =
getPrefBoolean(PreferKey.changeSourceLoadInfo)
tool_bar.menu.findItem(R.id.menu_load_info)?.isChecked = AppConfig.changeSourceLoadInfo
tool_bar.menu.findItem(R.id.menu_load_toc)?.isChecked = AppConfig.changeSourceLoadToc
}
private fun initRecyclerView() {

@ -124,9 +124,7 @@ class ChangeSourceViewModel(application: Application) : BaseViewModel(applicatio
it.forEach { searchBook ->
if (searchBook.name == name && searchBook.author == author) {
if (searchBook.latestChapterTitle.isNullOrEmpty()) {
if (context.getPrefBoolean(PreferKey.changeSourceLoadInfo)
|| context.getPrefBoolean(PreferKey.changeSourceLoadToc)
) {
if (AppConfig.changeSourceLoadInfo || AppConfig.changeSourceLoadToc) {
loadBookInfo(webBook, searchBook.toBook())
} else {
searchFinish(searchBook)

Loading…
Cancel
Save