From 7399c87601d1bb2016d6fe0114d0bd4009ab99af Mon Sep 17 00:00:00 2001 From: CarlosEsco Date: Wed, 22 Apr 2020 12:42:03 -0400 Subject: [PATCH] adjust setting reader system ui easier to follow --- .../tachiyomi/ui/reader/ReaderActivity.kt | 21 ++++++++++--------- 1 file changed, 11 insertions(+), 10 deletions(-) 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 84691e0199..441bf35ad1 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 @@ -21,6 +21,7 @@ import android.view.WindowManager import android.view.animation.Animation import android.view.animation.AnimationUtils import android.widget.SeekBar +import androidx.annotation.RequiresApi import androidx.appcompat.app.AppCompatDelegate import androidx.core.graphics.ColorUtils import com.davemorrissey.labs.subscaleview.SubsamplingScaleImageView @@ -114,6 +115,7 @@ class ReaderActivity : BaseRxActivity(), private set private var coroutine: Job? = null + /** * System UI helper to hide status & navigation bar on all different API levels. */ @@ -172,17 +174,16 @@ class ReaderActivity : BaseRxActivity(), lightStatusBar = a.getBoolean(0, false) a.recycle() setNotchCutoutMode() - if (lightStatusBar) { - if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.O) reader_layout.systemUiVisibility = - reader_layout.systemUiVisibility.or(View.SYSTEM_UI_FLAG_LIGHT_NAVIGATION_BAR) - reader_layout.systemUiVisibility = - reader_layout.systemUiVisibility.or(View.SYSTEM_UI_FLAG_LIGHT_STATUS_BAR) - } else { - if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.O) reader_layout.systemUiVisibility = - reader_layout.systemUiVisibility.rem(View.SYSTEM_UI_FLAG_LIGHT_NAVIGATION_BAR) - reader_layout.systemUiVisibility = - reader_layout.systemUiVisibility.rem(View.SYSTEM_UI_FLAG_LIGHT_STATUS_BAR) + + val systemUiFlag = when(Build.VERSION.SDK_INT >= Build.VERSION_CODES.O){ + true -> View.SYSTEM_UI_FLAG_LIGHT_NAVIGATION_BAR + false -> View.SYSTEM_UI_FLAG_LIGHT_STATUS_BAR } + reader_layout.systemUiVisibility =when(lightStatusBar){ + true -> reader_layout.systemUiVisibility.or(systemUiFlag) + false -> reader_layout.systemUiVisibility.rem(systemUiFlag) + } + if (presenter.needsInit()) { val manga = intent.extras!!.getLong("manga", -1)