优化,添加替换净化默认配置

主题色适配
pull/298/head
gedoor 4 years ago
parent f297c7cd51
commit 9c6610bd6e
  1. 30
      app/src/main/java/io/legado/app/help/storage/Restore.kt
  2. 2
      app/src/main/java/io/legado/app/ui/config/OtherConfigFragment.kt
  3. 9
      app/src/main/java/io/legado/app/ui/filechooser/FilePicker.kt

@ -13,6 +13,7 @@ import io.legado.app.R
import io.legado.app.constant.EventBus import io.legado.app.constant.EventBus
import io.legado.app.constant.PreferKey import io.legado.app.constant.PreferKey
import io.legado.app.data.entities.* import io.legado.app.data.entities.*
import io.legado.app.help.AppConfig
import io.legado.app.help.LauncherIconHelp import io.legado.app.help.LauncherIconHelp
import io.legado.app.help.ReadBookConfig import io.legado.app.help.ReadBookConfig
import io.legado.app.service.help.ReadBook import io.legado.app.service.help.ReadBook
@ -146,23 +147,24 @@ object Restore {
e.printStackTrace() e.printStackTrace()
} }
} }
Preferences.getSharedPreferences(App.INSTANCE, path, "config")?.all Preferences.getSharedPreferences(App.INSTANCE, path, "config")?.all?.let { map ->
?.let { map -> val edit = App.INSTANCE.defaultSharedPreferences.edit()
val edit = App.INSTANCE.defaultSharedPreferences.edit() map.forEach {
map.forEach { if (keyIsNotIgnore(it.key)) {
if (keyIsNotIgnore(it.key)) { when (val value = it.value) {
when (val value = it.value) { is Int -> edit.putInt(it.key, value)
is Int -> edit.putInt(it.key, value) is Boolean -> edit.putBoolean(it.key, value)
is Boolean -> edit.putBoolean(it.key, value) is Long -> edit.putLong(it.key, value)
is Long -> edit.putLong(it.key, value) is Float -> edit.putFloat(it.key, value)
is Float -> edit.putFloat(it.key, value) is String -> edit.putString(it.key, value)
is String -> edit.putString(it.key, value) else -> Unit
else -> Unit
}
} }
} }
edit.apply()
} }
edit.apply()
AppConfig.replaceEnableDefault =
App.INSTANCE.getPrefBoolean(PreferKey.replaceEnableDefault, true)
}
ReadBookConfig.apply { ReadBookConfig.apply {
styleSelect = App.INSTANCE.getPrefInt(PreferKey.readStyleSelect) styleSelect = App.INSTANCE.getPrefInt(PreferKey.readStyleSelect)
shareLayout = App.INSTANCE.getPrefBoolean(PreferKey.shareLayout) shareLayout = App.INSTANCE.getPrefBoolean(PreferKey.shareLayout)

@ -114,6 +114,8 @@ class OtherConfigFragment : PreferenceFragmentCompat(),
key, key,
getPrefString(PreferKey.defaultCover) getPrefString(PreferKey.defaultCover)
) )
PreferKey.replaceEnableDefault -> AppConfig.replaceEnableDefault =
App.INSTANCE.getPrefBoolean(PreferKey.replaceEnableDefault, true)
} }
} }

@ -8,6 +8,7 @@ import io.legado.app.base.BaseActivity
import io.legado.app.help.permission.Permissions import io.legado.app.help.permission.Permissions
import io.legado.app.help.permission.PermissionsCompat import io.legado.app.help.permission.PermissionsCompat
import io.legado.app.lib.dialogs.alert import io.legado.app.lib.dialogs.alert
import io.legado.app.utils.applyTint
import io.legado.app.utils.toast import io.legado.app.utils.toast
import org.jetbrains.anko.toast import org.jetbrains.anko.toast
@ -47,7 +48,7 @@ object FilePicker {
} }
} }
} }
}.show() }.show().applyTint()
} }
fun selectFolder( fun selectFolder(
@ -84,7 +85,7 @@ object FilePicker {
} }
} }
} }
}.show() }.show().applyTint()
} }
fun selectFile( fun selectFile(
@ -124,7 +125,7 @@ object FilePicker {
} }
} }
} }
}.show() }.show().applyTint()
} }
fun selectFile( fun selectFile(
@ -165,7 +166,7 @@ object FilePicker {
} }
} }
} }
}.show() }.show().applyTint()
} }
private fun createSelectFileIntent(): Intent { private fun createSelectFileIntent(): Intent {

Loading…
Cancel
Save