pull/1759/head
kunfei 3 years ago
parent f377f3ca5c
commit 7ae3838a01
  1. 12
      app/src/main/java/io/legado/app/help/config/AppConfig.kt
  2. 9
      app/src/main/java/io/legado/app/ui/book/changesource/ChangeBookSourceDialog.kt
  3. 5
      app/src/main/java/io/legado/app/ui/book/changesource/ChangeBookSourceViewModel.kt
  4. 9
      app/src/main/java/io/legado/app/ui/book/changesource/ChangeChapterSourceDialog.kt

@ -276,9 +276,17 @@ object AppConfig : SharedPreferences.OnSharedPreferenceChangeListener {
val autoChangeSource: Boolean
get() = appCtx.getPrefBoolean(PreferKey.autoChangeSource, true)
val changeSourceLoadInfo get() = appCtx.getPrefBoolean(PreferKey.changeSourceLoadInfo)
var changeSourceLoadInfo: Boolean
get() = appCtx.getPrefBoolean(PreferKey.changeSourceLoadInfo)
set(value) {
appCtx.putPrefBoolean(PreferKey.changeSourceLoadInfo, value)
}
val changeSourceLoadToc get() = appCtx.getPrefBoolean(PreferKey.changeSourceLoadToc)
var changeSourceLoadToc: Boolean
get() = appCtx.getPrefBoolean(PreferKey.changeSourceLoadToc)
set(value) {
appCtx.putPrefBoolean(PreferKey.changeSourceLoadToc, value)
}
val importKeepName get() = appCtx.getPrefBoolean(PreferKey.importKeepName)

@ -16,7 +16,6 @@ import io.legado.app.R
import io.legado.app.base.BaseDialogFragment
import io.legado.app.constant.AppPattern
import io.legado.app.constant.EventBus
import io.legado.app.constant.PreferKey
import io.legado.app.data.appDb
import io.legado.app.data.entities.Book
import io.legado.app.data.entities.BookChapter
@ -207,12 +206,12 @@ class ChangeBookSourceDialog() : BaseDialogFragment(R.layout.dialog_book_change_
item.isChecked = !item.isChecked
viewModel.refresh()
}
R.id.menu_load_toc -> {
putPrefBoolean(PreferKey.changeSourceLoadToc, !item.isChecked)
R.id.menu_load_info -> {
AppConfig.changeSourceLoadInfo = !item.isChecked
item.isChecked = !item.isChecked
}
R.id.menu_load_info -> {
putPrefBoolean(PreferKey.changeSourceLoadInfo, !item.isChecked)
R.id.menu_load_toc -> {
AppConfig.changeSourceLoadToc = !item.isChecked
item.isChecked = !item.isChecked
}
R.id.menu_start_stop -> viewModel.startOrStopSearch()

@ -184,12 +184,11 @@ open class ChangeBookSourceViewModel(application: Application) : BaseViewModel(a
}
private suspend fun loadBookInfo(scope: CoroutineScope, source: BookSource, book: Book) {
val mBook = WebBook.getBookInfoAwait(scope, source, book)
WebBook.getBookInfoAwait(scope, source, book)
if (context.getPrefBoolean(PreferKey.changeSourceLoadToc)) {
loadBookToc(scope, source, mBook)
loadBookToc(scope, source, book)
} else {
//从详情页里获取最新章节
book.latestChapterTitle = mBook.latestChapterTitle
val searchBook = book.toSearchBook()
searchCallback?.searchSuccess(searchBook)
}

@ -16,7 +16,6 @@ import io.legado.app.R
import io.legado.app.base.BaseDialogFragment
import io.legado.app.constant.AppPattern
import io.legado.app.constant.EventBus
import io.legado.app.constant.PreferKey
import io.legado.app.data.appDb
import io.legado.app.data.entities.Book
import io.legado.app.data.entities.BookChapter
@ -231,12 +230,12 @@ class ChangeChapterSourceDialog() : BaseDialogFragment(R.layout.dialog_chapter_c
item.isChecked = !item.isChecked
viewModel.refresh()
}
R.id.menu_load_toc -> {
putPrefBoolean(PreferKey.changeSourceLoadToc, !item.isChecked)
R.id.menu_load_info -> {
AppConfig.changeSourceLoadInfo = !item.isChecked
item.isChecked = !item.isChecked
}
R.id.menu_load_info -> {
putPrefBoolean(PreferKey.changeSourceLoadInfo, !item.isChecked)
R.id.menu_load_toc -> {
AppConfig.changeSourceLoadToc = !item.isChecked
item.isChecked = !item.isChecked
}
R.id.menu_start_stop -> viewModel.startOrStopSearch()

Loading…
Cancel
Save