换源添加是否校验作者选项

pull/931/head 3.21.040323
gedoor 4 years ago
parent c37e00f2fd
commit c13dd1d371
  1. 2
      app/src/main/assets/updateLog.md
  2. 1
      app/src/main/java/io/legado/app/constant/PreferKey.kt
  3. 6
      app/src/main/java/io/legado/app/help/AppConfig.kt
  4. 6
      app/src/main/java/io/legado/app/ui/book/changesource/ChangeSourceDialog.kt
  5. 6
      app/src/main/java/io/legado/app/ui/book/changesource/ChangeSourceViewModel.kt
  6. 6
      app/src/main/res/menu/change_source.xml
  7. 1
      app/src/main/res/values-zh-rHK/strings.xml
  8. 1
      app/src/main/res/values-zh-rTW/strings.xml
  9. 1
      app/src/main/res/values-zh/strings.xml
  10. 1
      app/src/main/res/values/strings.xml

@ -6,6 +6,8 @@
**2021/04/02**
* 修复bug
* 书源调试添加源码查看
* 添加导出epub by ag2s20150909
* 换源添加是否校验作者选项
**2021/03/31**
* 优化epubLib by ag2s20150909

@ -41,6 +41,7 @@ object PreferKey {
const val webDavCreateDir = "webDavCreateDir"
const val exportToWebDav = "webDavCacheBackup"
const val exportType = "exportType"
const val changeSourceCheckAuthor = "changeSourceCheckAuthor"
const val changeSourceLoadToc = "changeSourceLoadToc"
const val changeSourceLoadInfo = "changeSourceLoadInfo"
const val chineseConverterType = "chineseConverterType"

@ -167,6 +167,12 @@ object AppConfig : SharedPreferences.OnSharedPreferenceChangeListener {
appCtx.putPrefInt(PreferKey.exportType, value)
}
var changeSourceCheckAuthor: Boolean
get() = appCtx.getPrefBoolean(PreferKey.changeSourceCheckAuthor)
set(value) {
appCtx.putPrefBoolean(PreferKey.changeSourceCheckAuthor, value)
}
val autoChangeSource: Boolean
get() = appCtx.getPrefBoolean(PreferKey.autoChangeSource, true)

@ -84,6 +84,8 @@ class ChangeSourceDialog : BaseDialogFragment(),
binding.toolBar.inflateMenu(R.menu.change_source)
binding.toolBar.menu.applyTint(requireContext())
binding.toolBar.setOnMenuItemClickListener(this)
binding.toolBar.menu.findItem(R.id.menu_check_author)
?.isChecked = AppConfig.changeSourceCheckAuthor
binding.toolBar.menu.findItem(R.id.menu_load_info)
?.isChecked = AppConfig.changeSourceLoadInfo
binding.toolBar.menu.findItem(R.id.menu_load_toc)
@ -160,6 +162,10 @@ class ChangeSourceDialog : BaseDialogFragment(),
override fun onMenuItemClick(item: MenuItem?): Boolean {
when (item?.itemId) {
R.id.menu_check_author -> {
AppConfig.changeSourceCheckAuthor = !item.isChecked
item.isChecked = !item.isChecked
}
R.id.menu_load_toc -> {
putPrefBoolean(PreferKey.changeSourceLoadToc, !item.isChecked)
item.isChecked = !item.isChecked

@ -130,7 +130,10 @@ class ChangeSourceViewModel(application: Application) : BaseViewModel(applicatio
.timeout(60000L)
.onSuccess(IO) {
it.forEach { searchBook ->
if (searchBook.name == name && searchBook.author == author) {
if (searchBook.name == name) {
if ((AppConfig.changeSourceCheckAuthor && searchBook.author == author)
|| !AppConfig.changeSourceCheckAuthor
) {
if (searchBook.latestChapterTitle.isNullOrEmpty()) {
if (AppConfig.changeSourceLoadInfo || AppConfig.changeSourceLoadToc) {
loadBookInfo(webBook, searchBook.toBook())
@ -143,6 +146,7 @@ class ChangeSourceViewModel(application: Application) : BaseViewModel(applicatio
}
}
}
}
.onFinally {
synchronized(this) {
if (searchIndex < bookSourceList.lastIndex) {

@ -23,6 +23,12 @@
android:title="@string/book_source_manage"
app:showAsAction="never" />
<item
android:id="@+id/menu_check_author"
android:title="@string/checkAuthor"
android:checkable="true"
app:showAsAction="never" />
<item
android:id="@+id/menu_load_info"
android:title="@string/load_info"

@ -812,5 +812,6 @@
<string name="image_style">图片样式</string>
<string name="system_tts">系统TTS</string>
<string name="export_type">导出格式</string>
<string name="checkAuthor">校验作者</string>
</resources>

@ -814,5 +814,6 @@
<string name="image_style">图片样式</string>
<string name="system_tts">系统TTS</string>
<string name="export_type">导出格式</string>
<string name="checkAuthor">校验作者</string>
</resources>

@ -816,5 +816,6 @@
<string name="image_style">图片样式</string>
<string name="system_tts">系统TTS</string>
<string name="export_type">导出格式</string>
<string name="checkAuthor">校验作者</string>
</resources>

@ -819,5 +819,6 @@
<string name="image_style">Image style</string>
<string name="system_tts">System TTS</string>
<string name="export_type">导出格式</string>
<string name="checkAuthor">校验作者</string>
</resources>

Loading…
Cancel
Save