@@ -5,7 +5,11 @@ import android.view.View
55import androidx.core.view.ViewCompat
66import androidx.core.view.WindowInsetsCompat
77import androidx.core.view.WindowInsetsCompat.Type
8+ import androidx.lifecycle.Lifecycle
9+ import androidx.lifecycle.lifecycleScope
10+ import androidx.lifecycle.repeatOnLifecycle
811import com.google.android.material.appbar.AppBarLayout
12+ import kotlinx.coroutines.launch
913import org.fossify.commons.extensions.updatePaddingWithBase
1014import org.fossify.gallery.extensions.config
1115
@@ -21,6 +25,17 @@ abstract class BaseViewerActivity : SimpleActivity() {
2125 setupEdgeToEdge(insets)
2226 insets
2327 }
28+ registerShowNotchCollector(contentRoot)
29+ }
30+
31+ private fun registerShowNotchCollector (view : View ) {
32+ lifecycleScope.launch {
33+ repeatOnLifecycle(Lifecycle .State .RESUMED ) {
34+ config.showNotchFlow.collect {
35+ view.requestApplyInsets()
36+ }
37+ }
38+ }
2439 }
2540
2641 private fun setupEdgeToEdge (insets : WindowInsetsCompat ) {
@@ -32,6 +47,8 @@ abstract class BaseViewerActivity : SimpleActivity() {
3247 left = systemAndCutout.left,
3348 right = systemAndCutout.right
3449 )
50+
51+ contentHolder.updatePaddingWithBase(left = 0 , top = 0 , right = 0 , bottom = 0 )
3552 } else {
3653 val system = insets.getInsetsIgnoringVisibility(Type .systemBars())
3754 val cutout = insets.getInsetsIgnoringVisibility(Type .displayCutout())
0 commit comments