From 3fe2f2035b0eec4fde783a49db7d208e2d77be49 Mon Sep 17 00:00:00 2001 From: Sohel Shaikh Date: Sat, 23 Nov 2024 01:10:46 +0530 Subject: [PATCH] Use safe insets to draw content Currently edge to edge is enabled but we are not making use of safe insets which causes app to draw behind display cutouts. This is not a good UX, especially in landscape mode. --- .../src/main/java/com/emergetools/hackernews/MainActivity.kt | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/android/app/src/main/java/com/emergetools/hackernews/MainActivity.kt b/android/app/src/main/java/com/emergetools/hackernews/MainActivity.kt index 1673e255..102b394b 100644 --- a/android/app/src/main/java/com/emergetools/hackernews/MainActivity.kt +++ b/android/app/src/main/java/com/emergetools/hackernews/MainActivity.kt @@ -7,8 +7,10 @@ import androidx.activity.enableEdgeToEdge import androidx.compose.animation.fadeIn import androidx.compose.animation.fadeOut import androidx.compose.animation.scaleIn +import androidx.compose.foundation.layout.WindowInsets import androidx.compose.foundation.layout.fillMaxSize import androidx.compose.foundation.layout.padding +import androidx.compose.foundation.layout.safeContent import androidx.compose.material3.Icon import androidx.compose.material3.MaterialTheme import androidx.compose.material3.NavigationBar @@ -100,7 +102,8 @@ fun App() { ) } } - } + }, + contentWindowInsets = WindowInsets.safeContent ) { innerPadding -> NavHost( modifier = Modifier