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 9d2a3f679..547322cce 100644 --- a/app/src/main/java/io/legado/app/help/AppConfig.kt +++ b/app/src/main/java/io/legado/app/help/AppConfig.kt @@ -127,6 +127,8 @@ object AppConfig { App.INSTANCE.putPrefInt("elevation", value) } + val autoChangeSource: Boolean get() = App.INSTANCE.getPrefBoolean("autoChangeSource", true) + val readBodyToLh: Boolean get() = App.INSTANCE.getPrefBoolean(PreferKey.readBodyToLh, true) val isGooglePlay: Boolean get() = App.INSTANCE.channel == "google" diff --git a/app/src/main/java/io/legado/app/ui/book/read/ReadBookViewModel.kt b/app/src/main/java/io/legado/app/ui/book/read/ReadBookViewModel.kt index cc129056a..bf6ad1925 100644 --- a/app/src/main/java/io/legado/app/ui/book/read/ReadBookViewModel.kt +++ b/app/src/main/java/io/legado/app/ui/book/read/ReadBookViewModel.kt @@ -7,6 +7,7 @@ import io.legado.app.R import io.legado.app.base.BaseViewModel import io.legado.app.data.entities.Book import io.legado.app.data.entities.BookChapter +import io.legado.app.help.AppConfig import io.legado.app.help.BookHelp import io.legado.app.help.IntentDataHelp import io.legado.app.model.WebBook @@ -163,6 +164,7 @@ class ReadBookViewModel(application: Application) : BaseViewModel(application) { } private fun autoChangeSource(name: String, author: String) { + if (!AppConfig.autoChangeSource) return execute { App.db.bookSourceDao().allTextEnabled.forEach { source -> try { diff --git a/app/src/main/res/values/strings.xml b/app/src/main/res/values/strings.xml index edf2698e6..3d3014c89 100644 --- a/app/src/main/res/values/strings.xml +++ b/app/src/main/res/values/strings.xml @@ -689,5 +689,6 @@ 夜间,强调色 夜间,背景色 夜间,底栏色 + 自动换源 diff --git a/app/src/main/res/xml/pref_config_read.xml b/app/src/main/res/xml/pref_config_read.xml index 6b55f0fcc..1ed0294e5 100644 --- a/app/src/main/res/xml/pref_config_read.xml +++ b/app/src/main/res/xml/pref_config_read.xml @@ -60,6 +60,12 @@ android:key="volumeKeyPageOnPlay" app:iconSpaceReserved="false" /> + +