adjust setting reader system ui easier to follow

This commit is contained in:
CarlosEsco 2020-04-22 12:42:03 -04:00
parent a47704071b
commit 7399c87601

View File

@ -21,6 +21,7 @@ import android.view.WindowManager
import android.view.animation.Animation import android.view.animation.Animation
import android.view.animation.AnimationUtils import android.view.animation.AnimationUtils
import android.widget.SeekBar import android.widget.SeekBar
import androidx.annotation.RequiresApi
import androidx.appcompat.app.AppCompatDelegate import androidx.appcompat.app.AppCompatDelegate
import androidx.core.graphics.ColorUtils import androidx.core.graphics.ColorUtils
import com.davemorrissey.labs.subscaleview.SubsamplingScaleImageView import com.davemorrissey.labs.subscaleview.SubsamplingScaleImageView
@ -114,6 +115,7 @@ class ReaderActivity : BaseRxActivity<ReaderPresenter>(),
private set private set
private var coroutine: Job? = null private var coroutine: Job? = null
/** /**
* System UI helper to hide status & navigation bar on all different API levels. * System UI helper to hide status & navigation bar on all different API levels.
*/ */
@ -172,17 +174,16 @@ class ReaderActivity : BaseRxActivity<ReaderPresenter>(),
lightStatusBar = a.getBoolean(0, false) lightStatusBar = a.getBoolean(0, false)
a.recycle() a.recycle()
setNotchCutoutMode() setNotchCutoutMode()
if (lightStatusBar) {
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.O) reader_layout.systemUiVisibility = val systemUiFlag = when(Build.VERSION.SDK_INT >= Build.VERSION_CODES.O){
reader_layout.systemUiVisibility.or(View.SYSTEM_UI_FLAG_LIGHT_NAVIGATION_BAR) true -> View.SYSTEM_UI_FLAG_LIGHT_NAVIGATION_BAR
reader_layout.systemUiVisibility = false -> View.SYSTEM_UI_FLAG_LIGHT_STATUS_BAR
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)
} }
reader_layout.systemUiVisibility =when(lightStatusBar){
true -> reader_layout.systemUiVisibility.or(systemUiFlag)
false -> reader_layout.systemUiVisibility.rem(systemUiFlag)
}
if (presenter.needsInit()) { if (presenter.needsInit()) {
val manga = intent.extras!!.getLong("manga", -1) val manga = intent.extras!!.getLong("manga", -1)