Add persistent notch display mode
(cherry picked from commit 444cfa7669166edc874da4994396776a90ded465)
This commit is contained in:
parent
1be0171398
commit
84aba68b96
@ -162,6 +162,8 @@ class ReaderActivity : BaseRxActivity<ReaderActivityBinding, ReaderPresenter>()
|
|||||||
binding = ReaderActivityBinding.inflate(layoutInflater)
|
binding = ReaderActivityBinding.inflate(layoutInflater)
|
||||||
setContentView(binding.root)
|
setContentView(binding.root)
|
||||||
|
|
||||||
|
setNotchCutoutMode()
|
||||||
|
|
||||||
if (presenter.needsInit()) {
|
if (presenter.needsInit()) {
|
||||||
val manga = intent.extras!!.getLong("manga", -1)
|
val manga = intent.extras!!.getLong("manga", -1)
|
||||||
val chapter = intent.extras!!.getLong("chapter", -1)
|
val chapter = intent.extras!!.getLong("chapter", -1)
|
||||||
@ -862,6 +864,22 @@ class ReaderActivity : BaseRxActivity<ReaderActivityBinding, ReaderPresenter>()
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 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.
|
* Class that handles the user preferences of the reader.
|
||||||
*/
|
*/
|
||||||
|
Loading…
x
Reference in New Issue
Block a user