diff --git a/app/src/main/AndroidManifest.xml b/app/src/main/AndroidManifest.xml index 67af4688e..543c13f6c 100644 --- a/app/src/main/AndroidManifest.xml +++ b/app/src/main/AndroidManifest.xml @@ -185,6 +185,7 @@ android:launchMode="singleTop" /> requestedOrientation = ActivityInfo.SCREEN_ORIENTATION_UNSPECIFIED + "1" -> requestedOrientation = ActivityInfo.SCREEN_ORIENTATION_PORTRAIT + "2" -> requestedOrientation = ActivityInfo.SCREEN_ORIENTATION_LANDSCAPE + "3" -> requestedOrientation = ActivityInfo.SCREEN_ORIENTATION_SENSOR + } + } + + /** * 返回NavigationBar是否存在 * 该方法需要在View完全被绘制出来之后调用,否则判断不了 diff --git a/app/src/main/java/io/legado/app/ui/book/read/ReadBookActivity.kt b/app/src/main/java/io/legado/app/ui/book/read/ReadBookActivity.kt index 2ca4555a3..3696ccbab 100644 --- a/app/src/main/java/io/legado/app/ui/book/read/ReadBookActivity.kt +++ b/app/src/main/java/io/legado/app/ui/book/read/ReadBookActivity.kt @@ -88,6 +88,11 @@ class ReadBookActivity : VMBaseActivity(R.layout.activity_boo override val pageFactory: TextPageFactory get() = page_view.pageFactory override val headerHeight: Int get() = page_view.curPage.headerHeight + override fun onCreate(savedInstanceState: Bundle?) { + Help.setOrientation(this) + super.onCreate(savedInstanceState) + } + override fun onActivityCreated(savedInstanceState: Bundle?) { Help.upLayoutInDisplayCutoutMode(window) initView() 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 6f472f270..a23725143 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 @@ -104,6 +104,11 @@ class MoreConfigDialog : DialogFragment() { } PreferKey.keepLight -> postEvent(key, true) PreferKey.textSelectAble -> postEvent(key, getPrefBoolean(key)) + getString(R.string.pk_requested_direction) -> { + activity?.let { + Help.setOrientation(it) + } + } } } diff --git a/app/src/main/java/io/legado/app/ui/config/OtherConfigFragment.kt b/app/src/main/java/io/legado/app/ui/config/OtherConfigFragment.kt index c6633461a..a010428fd 100644 --- a/app/src/main/java/io/legado/app/ui/config/OtherConfigFragment.kt +++ b/app/src/main/java/io/legado/app/ui/config/OtherConfigFragment.kt @@ -43,10 +43,6 @@ class OtherConfigFragment : PreferenceFragmentCompat(), upPreferenceSummary(getString(R.string.pk_download_path), BookHelp.downloadPath) upPreferenceSummary(PreferKey.threadCount, AppConfig.threadCount.toString()) upPreferenceSummary(PreferKey.webPort, webPort.toString()) - upPreferenceSummary( - getString(R.string.pk_requested_direction), - AppConfig.requestedDirection - ) } override fun onViewCreated(view: View, savedInstanceState: Bundle?) { @@ -107,9 +103,6 @@ class OtherConfigFragment : PreferenceFragmentCompat(), setProcessTextEnable(it.getBoolean(key, true)) } PreferKey.showRss -> postEvent(EventBus.SHOW_RSS, "unused") - getString(R.string.pk_requested_direction) -> { - upPreferenceSummary(key, AppConfig.requestedDirection) - } } } diff --git a/app/src/main/res/xml/pref_config_other.xml b/app/src/main/res/xml/pref_config_other.xml index 6bf712292..b049bcf22 100644 --- a/app/src/main/res/xml/pref_config_other.xml +++ b/app/src/main/res/xml/pref_config_other.xml @@ -6,14 +6,6 @@ android:title="@string/main_activity" app:iconSpaceReserved="false"> - - + +