INNER CODE UNIT · Kotlin
setupEdgeToEdge
FossifyOrg/Gallery · app/src/main/kotlin/org/fossify/gallery/activities/BaseViewerActivity.kt:42
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
)
contentHolder.updatePaddingWithBase(left = 0, top = 0, right = 0, bottom = 0)
} else {
val system = insets.getInsetsIgnoringVisibility(Type.systemBars())
val cutout = insets.getInsetsIgnoringVisibility(Type.displayCutout())
appBarLayout.updatePaddingWithBase(
top = if (cutout.top > 0) 0 else system.top,
left = if (cutout.left > 0) 0 else system.left,
right = if (cutout.right > 0) 0 else system.right