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 7494bb453..bed5cd7ce 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 @@ -13,6 +13,7 @@ import io.legado.app.R import io.legado.app.constant.EventBus import io.legado.app.constant.PreferKey import io.legado.app.data.entities.* +import io.legado.app.help.AppConfig import io.legado.app.help.LauncherIconHelp import io.legado.app.help.ReadBookConfig import io.legado.app.service.help.ReadBook @@ -146,23 +147,24 @@ object Restore { e.printStackTrace() } } - Preferences.getSharedPreferences(App.INSTANCE, path, "config")?.all - ?.let { map -> - val edit = App.INSTANCE.defaultSharedPreferences.edit() - map.forEach { - if (keyIsNotIgnore(it.key)) { - when (val value = it.value) { - is Int -> edit.putInt(it.key, value) - is Boolean -> edit.putBoolean(it.key, value) - is Long -> edit.putLong(it.key, value) - is Float -> edit.putFloat(it.key, value) - is String -> edit.putString(it.key, value) - else -> Unit - } + Preferences.getSharedPreferences(App.INSTANCE, path, "config")?.all?.let { map -> + val edit = App.INSTANCE.defaultSharedPreferences.edit() + map.forEach { + if (keyIsNotIgnore(it.key)) { + when (val value = it.value) { + is Int -> edit.putInt(it.key, value) + is Boolean -> edit.putBoolean(it.key, value) + is Long -> edit.putLong(it.key, value) + is Float -> edit.putFloat(it.key, value) + is String -> edit.putString(it.key, value) + else -> Unit } } - edit.apply() } + edit.apply() + AppConfig.replaceEnableDefault = + App.INSTANCE.getPrefBoolean(PreferKey.replaceEnableDefault, true) + } ReadBookConfig.apply { styleSelect = App.INSTANCE.getPrefInt(PreferKey.readStyleSelect) shareLayout = App.INSTANCE.getPrefBoolean(PreferKey.shareLayout) diff --git a/app/src/main/java/io/legado/app/ui/config/OtherConfigFragment.kt b/app/src/main/java/io/legado/app/ui/config/OtherConfigFragment.kt index 0f8cfc8b6..850ee8e39 100644 --- a/app/src/main/java/io/legado/app/ui/config/OtherConfigFragment.kt +++ b/app/src/main/java/io/legado/app/ui/config/OtherConfigFragment.kt @@ -114,6 +114,8 @@ class OtherConfigFragment : PreferenceFragmentCompat(), key, getPrefString(PreferKey.defaultCover) ) + PreferKey.replaceEnableDefault -> AppConfig.replaceEnableDefault = + App.INSTANCE.getPrefBoolean(PreferKey.replaceEnableDefault, true) } } diff --git a/app/src/main/java/io/legado/app/ui/filechooser/FilePicker.kt b/app/src/main/java/io/legado/app/ui/filechooser/FilePicker.kt index 0a5b5485d..1fd125a76 100644 --- a/app/src/main/java/io/legado/app/ui/filechooser/FilePicker.kt +++ b/app/src/main/java/io/legado/app/ui/filechooser/FilePicker.kt @@ -8,6 +8,7 @@ import io.legado.app.base.BaseActivity import io.legado.app.help.permission.Permissions import io.legado.app.help.permission.PermissionsCompat import io.legado.app.lib.dialogs.alert +import io.legado.app.utils.applyTint import io.legado.app.utils.toast import org.jetbrains.anko.toast @@ -47,7 +48,7 @@ object FilePicker { } } } - }.show() + }.show().applyTint() } fun selectFolder( @@ -84,7 +85,7 @@ object FilePicker { } } } - }.show() + }.show().applyTint() } fun selectFile( @@ -124,7 +125,7 @@ object FilePicker { } } } - }.show() + }.show().applyTint() } fun selectFile( @@ -165,7 +166,7 @@ object FilePicker { } } } - }.show() + }.show().applyTint() } private fun createSelectFileIntent(): Intent {