pull/743/head 3.20.121712
gedoor 4 years ago
parent 4491e507c6
commit 591128d9a6
  1. 2
      app/src/main/java/io/legado/app/constant/PreferKey.kt
  2. 4
      app/src/main/java/io/legado/app/help/AppConfig.kt
  3. 2
      app/src/main/java/io/legado/app/ui/book/read/ReadBookBaseActivity.kt
  4. 2
      app/src/main/java/io/legado/app/ui/book/read/config/MoreConfigDialog.kt
  5. 2
      app/src/main/res/xml/pref_config_read.xml

@ -62,7 +62,7 @@ object PreferKey {
const val autoClearExpired = "autoClearExpired" const val autoClearExpired = "autoClearExpired"
const val autoChangeSource = "autoChangeSource" const val autoChangeSource = "autoChangeSource"
const val importKeepName = "importKeepName" const val importKeepName = "importKeepName"
const val screenDirection = "screenDirection" const val screenOrientation = "screenOrientation"
const val syncBookProgress = "syncBookProgress" const val syncBookProgress = "syncBookProgress"
const val cPrimary = "colorPrimary" const val cPrimary = "colorPrimary"

@ -79,8 +79,8 @@ object AppConfig : SharedPreferences.OnSharedPreferenceChangeListener {
val immNavigationBar: Boolean val immNavigationBar: Boolean
get() = context.getPrefBoolean(PreferKey.immNavigationBar, true) get() = context.getPrefBoolean(PreferKey.immNavigationBar, true)
val screenDirection: String? val screenOrientation: String?
get() = context.getPrefString(PreferKey.screenDirection) get() = context.getPrefString(PreferKey.screenOrientation)
var backupPath: String? var backupPath: String?
get() = context.getPrefString(PreferKey.backupPath) get() = context.getPrefString(PreferKey.backupPath)

@ -77,7 +77,7 @@ abstract class ReadBookBaseActivity :
*/ */
@SuppressLint("SourceLockedOrientationActivity") @SuppressLint("SourceLockedOrientationActivity")
fun setOrientation() { fun setOrientation() {
when (AppConfig.screenDirection) { when (AppConfig.screenOrientation) {
"0" -> requestedOrientation = ActivityInfo.SCREEN_ORIENTATION_UNSPECIFIED "0" -> requestedOrientation = ActivityInfo.SCREEN_ORIENTATION_UNSPECIFIED
"1" -> requestedOrientation = ActivityInfo.SCREEN_ORIENTATION_PORTRAIT "1" -> requestedOrientation = ActivityInfo.SCREEN_ORIENTATION_PORTRAIT
"2" -> requestedOrientation = ActivityInfo.SCREEN_ORIENTATION_LANDSCAPE "2" -> requestedOrientation = ActivityInfo.SCREEN_ORIENTATION_LANDSCAPE

@ -107,7 +107,7 @@ class MoreConfigDialog : DialogFragment() {
} }
PreferKey.keepLight -> postEvent(key, true) PreferKey.keepLight -> postEvent(key, true)
PreferKey.textSelectAble -> postEvent(key, getPrefBoolean(key)) PreferKey.textSelectAble -> postEvent(key, getPrefBoolean(key))
PreferKey.screenDirection -> { PreferKey.screenOrientation -> {
(activity as? ReadBookActivity)?.setOrientation() (activity as? ReadBookActivity)?.setOrientation()
} }
PreferKey.textFullJustify, PreferKey.textFullJustify,

@ -3,7 +3,7 @@
xmlns:app="http://schemas.android.com/apk/res-auto"> xmlns:app="http://schemas.android.com/apk/res-auto">
<io.legado.app.ui.widget.prefs.NameListPreference <io.legado.app.ui.widget.prefs.NameListPreference
android:key="screenDirection" android:key="screenOrientation"
android:defaultValue="0" android:defaultValue="0"
android:title="@string/screen_direction" android:title="@string/screen_direction"
android:entries="@array/screen_direction_title" android:entries="@array/screen_direction_title"

Loading…
Cancel
Save