INNER CODE UNIT · Kotlin
registerShowNotchCollector
FossifyOrg/Gallery · app/src/main/kotlin/org/fossify/gallery/activities/BaseViewerActivity.kt:32
private fun registerShowNotchCollector(view: View) {
lifecycleScope.launch {
repeatOnLifecycle(Lifecycle.State.RESUMED) {
config.showNotchFlow.collect {
view.requestApplyInsets()
}
}
}
}
private fun setupEdgeToEdge(insets: WindowInsetsCompat) {
if (config.showNotch) {
val systemAndCutout =
insets.getInsetsIgnoringVisibility(Type.systemBars() or Type.displayCutout())
appBarLayout.updatePaddingWithBase(
top = systemAndCutout.top,
left = systemAndCutout.left,
right = systemAndCutout.right