diff --git a/app/src/main/assets/updateLog.md b/app/src/main/assets/updateLog.md
index 6cb716e85..50cf85aef 100644
--- a/app/src/main/assets/updateLog.md
+++ b/app/src/main/assets/updateLog.md
@@ -6,6 +6,8 @@
**2021/04/02**
* 修复bug
* 书源调试添加源码查看
+* 添加导出epub by ag2s20150909
+* 换源添加是否校验作者选项
**2021/03/31**
* 优化epubLib by ag2s20150909
diff --git a/app/src/main/java/io/legado/app/constant/PreferKey.kt b/app/src/main/java/io/legado/app/constant/PreferKey.kt
index 7e8f68da5..72d260d8a 100644
--- a/app/src/main/java/io/legado/app/constant/PreferKey.kt
+++ b/app/src/main/java/io/legado/app/constant/PreferKey.kt
@@ -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"
diff --git a/app/src/main/java/io/legado/app/help/AppConfig.kt b/app/src/main/java/io/legado/app/help/AppConfig.kt
index 4e4ce33c9..c72078564 100644
--- a/app/src/main/java/io/legado/app/help/AppConfig.kt
+++ b/app/src/main/java/io/legado/app/help/AppConfig.kt
@@ -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)
@@ -182,7 +188,7 @@ object AppConfig : SharedPreferences.OnSharedPreferenceChangeListener {
val mediaButtonOnExit get() = appCtx.getPrefBoolean("mediaButtonOnExit", true)
- val replaceEnableDefault get() = appCtx.getPrefBoolean(PreferKey.replaceEnableDefault, true)
+ val replaceEnableDefault get() = appCtx.getPrefBoolean(PreferKey.replaceEnableDefault, true)
private fun getPrefUserAgent(): String {
val ua = appCtx.getPrefString(PreferKey.userAgent)
diff --git a/app/src/main/java/io/legado/app/ui/book/changesource/ChangeSourceDialog.kt b/app/src/main/java/io/legado/app/ui/book/changesource/ChangeSourceDialog.kt
index e6be2e4be..7b858949a 100644
--- a/app/src/main/java/io/legado/app/ui/book/changesource/ChangeSourceDialog.kt
+++ b/app/src/main/java/io/legado/app/ui/book/changesource/ChangeSourceDialog.kt
@@ -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
diff --git a/app/src/main/java/io/legado/app/ui/book/changesource/ChangeSourceViewModel.kt b/app/src/main/java/io/legado/app/ui/book/changesource/ChangeSourceViewModel.kt
index ae3114e04..03f49c28e 100644
--- a/app/src/main/java/io/legado/app/ui/book/changesource/ChangeSourceViewModel.kt
+++ b/app/src/main/java/io/legado/app/ui/book/changesource/ChangeSourceViewModel.kt
@@ -130,15 +130,19 @@ class ChangeSourceViewModel(application: Application) : BaseViewModel(applicatio
.timeout(60000L)
.onSuccess(IO) {
it.forEach { searchBook ->
- if (searchBook.name == name && searchBook.author == author) {
- if (searchBook.latestChapterTitle.isNullOrEmpty()) {
- if (AppConfig.changeSourceLoadInfo || AppConfig.changeSourceLoadToc) {
- loadBookInfo(webBook, searchBook.toBook())
+ 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())
+ } else {
+ searchFinish(searchBook)
+ }
} else {
searchFinish(searchBook)
}
- } else {
- searchFinish(searchBook)
}
}
}
diff --git a/app/src/main/res/menu/change_source.xml b/app/src/main/res/menu/change_source.xml
index ecee5ca02..347877bde 100644
--- a/app/src/main/res/menu/change_source.xml
+++ b/app/src/main/res/menu/change_source.xml
@@ -23,6 +23,12 @@
android:title="@string/book_source_manage"
app:showAsAction="never" />
+
+
- 图片样式
系统TTS
导出格式
+ 校验作者
diff --git a/app/src/main/res/values-zh-rTW/strings.xml b/app/src/main/res/values-zh-rTW/strings.xml
index ab85be403..2920fcc23 100644
--- a/app/src/main/res/values-zh-rTW/strings.xml
+++ b/app/src/main/res/values-zh-rTW/strings.xml
@@ -814,5 +814,6 @@
图片样式
系统TTS
导出格式
+ 校验作者
diff --git a/app/src/main/res/values-zh/strings.xml b/app/src/main/res/values-zh/strings.xml
index 196d02455..f64b848d7 100644
--- a/app/src/main/res/values-zh/strings.xml
+++ b/app/src/main/res/values-zh/strings.xml
@@ -816,5 +816,6 @@
图片样式
系统TTS
导出格式
+ 校验作者
diff --git a/app/src/main/res/values/strings.xml b/app/src/main/res/values/strings.xml
index 983a21e48..4cb2fa208 100644
--- a/app/src/main/res/values/strings.xml
+++ b/app/src/main/res/values/strings.xml
@@ -819,5 +819,6 @@
Image style
System TTS
导出格式
+ 校验作者