From 543cb0a0470fe5991ff131fe1851bf72243c6954 Mon Sep 17 00:00:00 2001 From: Jan Grabowski Date: Mon, 9 Mar 2020 17:38:46 +0100 Subject: [PATCH] Moved function, removed pref. --- .../data/preference/PreferenceKeys.kt | 2 - .../tachiyomi/ui/reader/ReaderActivity.kt | 39 +++++++++---------- 2 files changed, 19 insertions(+), 22 deletions(-) diff --git a/app/src/main/java/eu/kanade/tachiyomi/data/preference/PreferenceKeys.kt b/app/src/main/java/eu/kanade/tachiyomi/data/preference/PreferenceKeys.kt index 3fbc2c90f8..ea3d9eb08a 100644 --- a/app/src/main/java/eu/kanade/tachiyomi/data/preference/PreferenceKeys.kt +++ b/app/src/main/java/eu/kanade/tachiyomi/data/preference/PreferenceKeys.kt @@ -19,8 +19,6 @@ object PreferenceKeys { const val fullscreen = "fullscreen" - const val isDefaultNotchMode = "pref_notch_mode" - const val keepScreenOn = "pref_keep_screen_on_key" const val customBrightness = "pref_custom_brightness_key" diff --git a/app/src/main/java/eu/kanade/tachiyomi/ui/reader/ReaderActivity.kt b/app/src/main/java/eu/kanade/tachiyomi/ui/reader/ReaderActivity.kt index 1bbfb659b2..2f82a1a552 100644 --- a/app/src/main/java/eu/kanade/tachiyomi/ui/reader/ReaderActivity.kt +++ b/app/src/main/java/eu/kanade/tachiyomi/ui/reader/ReaderActivity.kt @@ -159,6 +159,8 @@ class ReaderActivity : BaseRxActivity(), super.onCreate(savedState) setContentView(R.layout.reader_activity) + setNotchCutoutMode() + if (presenter.needsInit()) { val manga = intent.extras!!.getLong("manga", -1) val chapter = intent.extras!!.getLong("chapter", -1) @@ -628,6 +630,23 @@ class ReaderActivity : BaseRxActivity(), } } + /** + * Sets notch cutout mode to "NEVER", if mobile is in a landscape view + */ + private fun setNotchCutoutMode() { + if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.P) { + + val currentOrientation = resources.configuration.orientation + + if(currentOrientation == Configuration.ORIENTATION_LANDSCAPE) { + val params = window.attributes + params.layoutInDisplayCutoutMode = + WindowManager.LayoutParams.LAYOUT_IN_DISPLAY_CUTOUT_MODE_NEVER + } + + } + } + /** * Class that handles the user preferences of the reader. @@ -685,8 +704,6 @@ class ReaderActivity : BaseRxActivity(), subscriptions += preferences.colorFilterMode().asObservable() .subscribe { setColorFilter(preferences.colorFilter().getOrDefault()) } - - this.setNotchCutoutMode() } /** @@ -799,24 +816,6 @@ class ReaderActivity : BaseRxActivity(), } } - - /** - * Sets notch cutout mode to "NEVER", if mobile is in a landscape view - */ - private fun setNotchCutoutMode() { - if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.P) { - - val currentOrientation = resources.configuration.orientation - - if(currentOrientation == Configuration.ORIENTATION_LANDSCAPE) { - val params = window.attributes - params.layoutInDisplayCutoutMode = - WindowManager.LayoutParams.LAYOUT_IN_DISPLAY_CUTOUT_MODE_NEVER - } - - } - } - /** * Sets the brightness of the screen. Range is [-75, 100]. * From -75 to -1 a semi-transparent black view is overlaid with the minimum brightness.