From 591128d9a627916735fe6c1aba82a6a3ba20ed13 Mon Sep 17 00:00:00 2001 From: gedoor Date: Thu, 17 Dec 2020 12:12:43 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BF=AE=E5=A4=8Dbug?= 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 | 2 +- app/src/main/java/io/legado/app/help/AppConfig.kt | 4 ++-- .../java/io/legado/app/ui/book/read/ReadBookBaseActivity.kt | 2 +- .../io/legado/app/ui/book/read/config/MoreConfigDialog.kt | 2 +- app/src/main/res/xml/pref_config_read.xml | 2 +- 5 files changed, 6 insertions(+), 6 deletions(-) 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 9f055e498..de28caddc 100644 --- a/app/src/main/java/io/legado/app/constant/PreferKey.kt +++ b/app/src/main/java/io/legado/app/constant/PreferKey.kt @@ -62,7 +62,7 @@ object PreferKey { const val autoClearExpired = "autoClearExpired" const val autoChangeSource = "autoChangeSource" const val importKeepName = "importKeepName" - const val screenDirection = "screenDirection" + const val screenOrientation = "screenOrientation" const val syncBookProgress = "syncBookProgress" const val cPrimary = "colorPrimary" 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 b96344abc..076bbfdc4 100644 --- a/app/src/main/java/io/legado/app/help/AppConfig.kt +++ b/app/src/main/java/io/legado/app/help/AppConfig.kt @@ -79,8 +79,8 @@ object AppConfig : SharedPreferences.OnSharedPreferenceChangeListener { val immNavigationBar: Boolean get() = context.getPrefBoolean(PreferKey.immNavigationBar, true) - val screenDirection: String? - get() = context.getPrefString(PreferKey.screenDirection) + val screenOrientation: String? + get() = context.getPrefString(PreferKey.screenOrientation) var backupPath: String? get() = context.getPrefString(PreferKey.backupPath) diff --git a/app/src/main/java/io/legado/app/ui/book/read/ReadBookBaseActivity.kt b/app/src/main/java/io/legado/app/ui/book/read/ReadBookBaseActivity.kt index e50ebf435..1df2554ec 100644 --- a/app/src/main/java/io/legado/app/ui/book/read/ReadBookBaseActivity.kt +++ b/app/src/main/java/io/legado/app/ui/book/read/ReadBookBaseActivity.kt @@ -77,7 +77,7 @@ abstract class ReadBookBaseActivity : */ @SuppressLint("SourceLockedOrientationActivity") fun setOrientation() { - when (AppConfig.screenDirection) { + when (AppConfig.screenOrientation) { "0" -> requestedOrientation = ActivityInfo.SCREEN_ORIENTATION_UNSPECIFIED "1" -> requestedOrientation = ActivityInfo.SCREEN_ORIENTATION_PORTRAIT "2" -> requestedOrientation = ActivityInfo.SCREEN_ORIENTATION_LANDSCAPE 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 a23dd1ddc..8a5f87202 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 @@ -107,7 +107,7 @@ class MoreConfigDialog : DialogFragment() { } PreferKey.keepLight -> postEvent(key, true) PreferKey.textSelectAble -> postEvent(key, getPrefBoolean(key)) - PreferKey.screenDirection -> { + PreferKey.screenOrientation -> { (activity as? ReadBookActivity)?.setOrientation() } PreferKey.textFullJustify, diff --git a/app/src/main/res/xml/pref_config_read.xml b/app/src/main/res/xml/pref_config_read.xml index fea7ed25c..104ae4039 100644 --- a/app/src/main/res/xml/pref_config_read.xml +++ b/app/src/main/res/xml/pref_config_read.xml @@ -3,7 +3,7 @@ xmlns:app="http://schemas.android.com/apk/res-auto">