diff --git a/app/src/main/java/io/legado/app/help/storage/Restore.kt b/app/src/main/java/io/legado/app/help/storage/Restore.kt index 930132990..0708dfe67 100644 --- a/app/src/main/java/io/legado/app/help/storage/Restore.kt +++ b/app/src/main/java/io/legado/app/help/storage/Restore.kt @@ -9,6 +9,7 @@ import com.jayway.jsonpath.Option import com.jayway.jsonpath.ParseContext import io.legado.app.App import io.legado.app.BuildConfig +import io.legado.app.R import io.legado.app.constant.EventBus import io.legado.app.constant.PreferKey import io.legado.app.data.entities.* @@ -31,8 +32,11 @@ object Restore { val json = file.readText() GSON.fromJsonObject>(json) ?: hashMapOf() } - val ignoreKeys = arrayOf("readConfig") - val ignoreTitle = arrayOf("阅读界面设置") + val ignoreKeys = arrayOf("readConfig", "themeMode") + val ignoreTitle = arrayOf( + App.INSTANCE.getString(R.string.read_config), + App.INSTANCE.getString(R.string.theme_mode) + ) private val ignorePrefKeys = arrayOf(PreferKey.versionCode, PreferKey.defaultCover) private val readPrefKeys = arrayOf( PreferKey.readStyleSelect, @@ -130,9 +134,7 @@ object Restore { ?.let { map -> val edit = App.INSTANCE.defaultSharedPreferences.edit() map.forEach { - if (!ignorePrefKeys.contains(it.key) - && !(readPrefKeys.contains(it.key) && ignoreReadConfig) - ) { + if (keyIsNotIgnore(it.key)) { when (val value = it.value) { is Int -> edit.putInt(it.key, value) is Boolean -> edit.putBoolean(it.key, value) @@ -166,7 +168,17 @@ object Restore { } } - val ignoreReadConfig: Boolean get() = ignoreConfig["readConfig"] == true + private fun keyIsNotIgnore(key: String): Boolean { + return when { + ignorePrefKeys.contains(key) -> false + readPrefKeys.contains(key) && ignoreReadConfig -> false + PreferKey.themeMode == key && ignoreThemeMode -> false + else -> true + } + } + + private val ignoreReadConfig: Boolean get() = ignoreConfig["readConfig"] == true + private val ignoreThemeMode: Boolean get() = ignoreConfig["themeMode"] == true fun saveIgnoreConfig() { val json = GSON.toJson(ignoreConfig) diff --git a/app/src/main/res/values-zh-rHK/strings.xml b/app/src/main/res/values-zh-rHK/strings.xml index 41858beea..20529810b 100644 --- a/app/src/main/res/values-zh-rHK/strings.xml +++ b/app/src/main/res/values-zh-rHK/strings.xml @@ -723,4 +723,5 @@ 默认封面 恢复忽略列表 恢复时忽略一些内容不恢复,方便不同手机配置不同 + 阅读界面设置 diff --git a/app/src/main/res/values-zh-rTW/strings.xml b/app/src/main/res/values-zh-rTW/strings.xml index 364055d03..89cdbf2a5 100644 --- a/app/src/main/res/values-zh-rTW/strings.xml +++ b/app/src/main/res/values-zh-rTW/strings.xml @@ -723,5 +723,6 @@ 默认封面 恢复忽略列表 恢复时忽略一些内容不恢复,方便不同手机配置不同 + 阅读界面设置 diff --git a/app/src/main/res/values-zh/strings.xml b/app/src/main/res/values-zh/strings.xml index ca5456dd2..f44eaa67f 100644 --- a/app/src/main/res/values-zh/strings.xml +++ b/app/src/main/res/values-zh/strings.xml @@ -723,4 +723,5 @@ 默认封面 恢复忽略列表 恢复时忽略一些内容不恢复,方便不同手机配置不同 + 阅读界面设置 diff --git a/app/src/main/res/values/strings.xml b/app/src/main/res/values/strings.xml index dda5fb3c9..62b552f92 100644 --- a/app/src/main/res/values/strings.xml +++ b/app/src/main/res/values/strings.xml @@ -724,5 +724,6 @@ Default cover 恢复忽略列表 恢复时忽略一些内容不恢复,方便不同手机配置不同 + 阅读界面设置 \ No newline at end of file