diff --git a/app/src/main/java/io/legado/app/ui/main/my/MyFragment.kt b/app/src/main/java/io/legado/app/ui/main/my/MyFragment.kt index da6dde167..724b084c4 100644 --- a/app/src/main/java/io/legado/app/ui/main/my/MyFragment.kt +++ b/app/src/main/java/io/legado/app/ui/main/my/MyFragment.kt @@ -15,6 +15,7 @@ import io.legado.app.constant.PreferKey import io.legado.app.help.AppConfig import io.legado.app.help.ReadBookConfig import io.legado.app.lib.theme.ATH +import io.legado.app.lib.theme.ThemeStore import io.legado.app.service.WebService import io.legado.app.ui.about.AboutActivity import io.legado.app.ui.about.DonateActivity @@ -124,6 +125,15 @@ class MyFragment : BaseFragment(R.layout.fragment_my_config), FileChooserDialog. PreferKey.einkMode -> { //既然是 E-Ink 模式,为什么不一步到位呢 if (AppConfig.isEInkMode) { + //保存开启前的设置 + putPrefInt("lastReadBookPageAnim", ReadBookConfig.pageAnim) + putPrefInt("lastColorPrimary", ThemeStore.primaryColor(requireContext())) + putPrefInt("lastColorAccent", ThemeStore.accentColor(requireContext())) + putPrefInt("lastColorBackground", ThemeStore.backgroundColor(requireContext())) + putPrefInt("lastColorBottomBackground", ThemeStore.bottomBackground(requireContext())) + putPrefBoolean("lastIsNightTheme", AppConfig.isNightTheme) + + //设置 E-Ink 模式配置 ReadBookConfig.pageAnim = 4 putPrefInt("colorPrimary", getCompatColor(R.color.white)) putPrefInt("colorAccent", getCompatColor(R.color.black)) @@ -132,6 +142,15 @@ class MyFragment : BaseFragment(R.layout.fragment_my_config), FileChooserDialog. AppConfig.isNightTheme = false App.INSTANCE.applyDayNight() postEvent(EventBus.RECREATE, "") + } else { + ReadBookConfig.pageAnim = getPrefInt("lastReadBookPageAnim") + putPrefInt("colorPrimary", getPrefInt("lastColorPrimary")) + putPrefInt("colorAccent", getPrefInt("lastColorAccent")) + putPrefInt("colorBackground", getPrefInt("lastColorBackground")) + putPrefInt("colorBottomBackground", getPrefInt("lastColorBottomBackground")) + AppConfig.isNightTheme = getPrefBoolean("lastIsNightTheme") + App.INSTANCE.applyDayNight() + postEvent(EventBus.RECREATE, "") } } }