From 7f56b019e32bd3c93947003adcb2621be9444c52 Mon Sep 17 00:00:00 2001 From: gedoor Date: Tue, 28 Sep 2021 14:49:46 +0800 Subject: [PATCH] =?UTF-8?q?=E6=A8=AA=E5=B1=8F=E5=8F=8C=E9=A1=B5?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/src/main/java/io/legado/app/constant/PreferKey.kt | 1 + app/src/main/java/io/legado/app/help/AppConfig.kt | 3 +++ .../io/legado/app/ui/book/read/config/MoreConfigDialog.kt | 6 ++++++ .../app/ui/book/read/page/provider/ChapterProvider.kt | 4 +++- app/src/main/res/values-es-rES/strings.xml | 1 + app/src/main/res/values-ja-rJP/strings.xml | 1 + app/src/main/res/values-pt-rBR/strings.xml | 1 + app/src/main/res/values-zh-rHK/strings.xml | 1 + app/src/main/res/values-zh-rTW/strings.xml | 1 + app/src/main/res/values-zh/strings.xml | 1 + app/src/main/res/values/strings.xml | 1 + app/src/main/res/xml/pref_config_read.xml | 7 +++++++ 12 files changed, 27 insertions(+), 1 deletion(-) diff --git a/app/src/main/java/io/legado/app/constant/PreferKey.kt b/app/src/main/java/io/legado/app/constant/PreferKey.kt index 8c7576df5..55016befd 100644 --- a/app/src/main/java/io/legado/app/constant/PreferKey.kt +++ b/app/src/main/java/io/legado/app/constant/PreferKey.kt @@ -88,6 +88,7 @@ object PreferKey { const val brightness = "brightness" const val nightBrightness = "nightBrightness" const val expandTextMenu = "expandTextMenu" + const val doublePageHorizontal = "doublePageHorizontal" const val cPrimary = "colorPrimary" const val cAccent = "colorAccent" diff --git a/app/src/main/java/io/legado/app/help/AppConfig.kt b/app/src/main/java/io/legado/app/help/AppConfig.kt index 1e1708c36..6661cfe0d 100644 --- a/app/src/main/java/io/legado/app/help/AppConfig.kt +++ b/app/src/main/java/io/legado/app/help/AppConfig.kt @@ -252,6 +252,9 @@ object AppConfig : SharedPreferences.OnSharedPreferenceChangeListener { val fullScreenGesturesSupport: Boolean get() = appCtx.getPrefBoolean(PreferKey.fullScreenGesturesSupport, false) + val doublePageHorizontal: Boolean + get() = appCtx.getPrefBoolean(PreferKey.doublePageHorizontal, true) + private fun getPrefUserAgent(): String { val ua = appCtx.getPrefString(PreferKey.userAgent) if (ua.isNullOrBlank()) { diff --git a/app/src/main/java/io/legado/app/ui/book/read/config/MoreConfigDialog.kt b/app/src/main/java/io/legado/app/ui/book/read/config/MoreConfigDialog.kt index 15f601c27..f7bea50e0 100644 --- a/app/src/main/java/io/legado/app/ui/book/read/config/MoreConfigDialog.kt +++ b/app/src/main/java/io/legado/app/ui/book/read/config/MoreConfigDialog.kt @@ -15,8 +15,10 @@ import io.legado.app.constant.PreferKey import io.legado.app.help.ReadBookConfig import io.legado.app.lib.theme.ATH import io.legado.app.lib.theme.bottomBackground +import io.legado.app.model.ReadBook import io.legado.app.ui.book.read.ReadBookActivity import io.legado.app.ui.book.read.page.ReadView +import io.legado.app.ui.book.read.page.provider.ChapterProvider import io.legado.app.utils.dp import io.legado.app.utils.getPrefBoolean import io.legado.app.utils.postEvent @@ -122,6 +124,10 @@ class MoreConfigDialog : DialogFragment() { PreferKey.expandTextMenu -> { (activity as? ReadBookActivity)?.textActionMenu?.upMenu() } + PreferKey.doublePageHorizontal -> { + ChapterProvider.upLayout() + ReadBook.loadContent(false) + } } } diff --git a/app/src/main/java/io/legado/app/ui/book/read/page/provider/ChapterProvider.kt b/app/src/main/java/io/legado/app/ui/book/read/page/provider/ChapterProvider.kt index 3792a36f4..d3d5c8295 100644 --- a/app/src/main/java/io/legado/app/ui/book/read/page/provider/ChapterProvider.kt +++ b/app/src/main/java/io/legado/app/ui/book/read/page/provider/ChapterProvider.kt @@ -585,7 +585,9 @@ object ChapterProvider { * 更新绘制尺寸 */ fun upLayout() { - doublePage = viewWidth > viewHeight && ReadBook.pageAnim() != 3 + doublePage = viewWidth > viewHeight + && ReadBook.pageAnim() != 3 + && AppConfig.doublePageHorizontal if (viewWidth > 0 && viewHeight > 0) { paddingLeft = ReadBookConfig.paddingLeft.dp paddingTop = ReadBookConfig.paddingTop.dp diff --git a/app/src/main/res/values-es-rES/strings.xml b/app/src/main/res/values-es-rES/strings.xml index 57560d621..1fe68aacd 100644 --- a/app/src/main/res/values-es-rES/strings.xml +++ b/app/src/main/res/values-es-rES/strings.xml @@ -890,5 +890,6 @@ 禁用源 删除源 购买 + 横屏双页 diff --git a/app/src/main/res/values-ja-rJP/strings.xml b/app/src/main/res/values-ja-rJP/strings.xml index a31235a29..8b8ad47f4 100644 --- a/app/src/main/res/values-ja-rJP/strings.xml +++ b/app/src/main/res/values-ja-rJP/strings.xml @@ -894,5 +894,6 @@ 禁用源 删除源 购买 + 横屏双页 diff --git a/app/src/main/res/values-pt-rBR/strings.xml b/app/src/main/res/values-pt-rBR/strings.xml index 19d170a43..b24b6d308 100644 --- a/app/src/main/res/values-pt-rBR/strings.xml +++ b/app/src/main/res/values-pt-rBR/strings.xml @@ -894,5 +894,6 @@ 禁用源 删除源 购买 + 横屏双页 diff --git a/app/src/main/res/values-zh-rHK/strings.xml b/app/src/main/res/values-zh-rHK/strings.xml index bfedef73e..08b11c044 100644 --- a/app/src/main/res/values-zh-rHK/strings.xml +++ b/app/src/main/res/values-zh-rHK/strings.xml @@ -891,5 +891,6 @@ 禁用源 删除源 购买 + 横屏双页 diff --git a/app/src/main/res/values-zh-rTW/strings.xml b/app/src/main/res/values-zh-rTW/strings.xml index f36f0fa06..f39dfab1c 100644 --- a/app/src/main/res/values-zh-rTW/strings.xml +++ b/app/src/main/res/values-zh-rTW/strings.xml @@ -893,5 +893,6 @@ 禁用源 删除源 购买 + 横屏双页 diff --git a/app/src/main/res/values-zh/strings.xml b/app/src/main/res/values-zh/strings.xml index 577a468bf..9f00fe6f6 100644 --- a/app/src/main/res/values-zh/strings.xml +++ b/app/src/main/res/values-zh/strings.xml @@ -893,5 +893,6 @@ 禁用源 删除源 购买 + 横屏双页 diff --git a/app/src/main/res/values/strings.xml b/app/src/main/res/values/strings.xml index 5a991fa86..4cbab645a 100644 --- a/app/src/main/res/values/strings.xml +++ b/app/src/main/res/values/strings.xml @@ -894,5 +894,6 @@ 禁用源 删除源 购买 + 横屏双页 diff --git a/app/src/main/res/xml/pref_config_read.xml b/app/src/main/res/xml/pref_config_read.xml index f66057975..2ff1567be 100644 --- a/app/src/main/res/xml/pref_config_read.xml +++ b/app/src/main/res/xml/pref_config_read.xml @@ -41,6 +41,13 @@ app:iconSpaceReserved="false" app:isBottomBackground="true" /> + +