From f1fd69ca4f818599f5c6042c0b6c0b3a03f188b5 Mon Sep 17 00:00:00 2001 From: Modificator Date: Mon, 15 Jun 2020 23:48:37 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BF=9D=E5=AD=98=E6=89=93=E5=BC=80=20E-Ink=20?= =?UTF-8?q?=E6=A8=A1=E5=BC=8F=E5=89=8D=E7=9A=84=E4=B8=BB=E9=A2=98=E3=80=81?= =?UTF-8?q?=E7=BF=BB=E9=A1=B5=E5=8A=A8=E7=94=BB=EF=BC=8C=E5=85=B3=E9=97=AD?= =?UTF-8?q?=E5=90=8E=E6=81=A2=E5=A4=8D=E4=B9=8B=E5=89=8D=E7=9A=84=E9=85=8D?= =?UTF-8?q?=E7=BD=AE?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../io/legado/app/ui/main/my/MyFragment.kt | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+) 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, "") } } }