From 008a7bff80410cb9df31882ad2f02652328e370e Mon Sep 17 00:00:00 2001 From: topjohnwu Date: Fri, 23 Oct 2026 05:43:13 +0000 Subject: [PATCH] app: keep FAB clear of side system bars In navigation bar mode, NavigationSuiteScaffold places the primary action at the end edge of the window with a fixed 16dp margin and ignores window insets. In landscape with 3-button navigation, the FAB on the Modules and Superuser tabs overlapped the side navigation bar. Pad the primary action slot with the end side of the safe drawing insets in bar mode, so the FAB stays clear of side system bars and display cutouts. Portrait and navigation rail layouts are unchanged. Assisted-by: Claude Opus 5.5 --- .../src/main/java/com/topjohnwu/magisk/ui/MainScreen.kt | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/app/apk/src/main/java/com/topjohnwu/magisk/ui/MainScreen.kt b/app/apk/src/main/java/com/topjohnwu/magisk/ui/MainScreen.kt index c5b57d9a8..197b0e2a2 100644 --- a/app/apk/src/main/java/com/topjohnwu/magisk/ui/MainScreen.kt +++ b/app/apk/src/main/java/com/topjohnwu/magisk/ui/MainScreen.kt @@ -10,11 +10,15 @@ import androidx.compose.animation.scaleOut import androidx.compose.foundation.focusGroup import androidx.compose.foundation.layout.Box import androidx.compose.foundation.layout.WindowInsets +import androidx.compose.foundation.layout.WindowInsetsSides import androidx.compose.foundation.layout.fillMaxSize import androidx.compose.foundation.layout.heightIn +import androidx.compose.foundation.layout.only import androidx.compose.foundation.layout.padding +import androidx.compose.foundation.layout.safeDrawing import androidx.compose.foundation.layout.size import androidx.compose.foundation.layout.systemBars +import androidx.compose.foundation.layout.windowInsetsPadding import androidx.compose.foundation.pager.HorizontalPager import androidx.compose.foundation.pager.rememberPagerState import androidx.compose.material.icons.Icons @@ -178,8 +182,11 @@ fun MainScreen( // In the rail header, keep the FAB slot even when the FAB is hidden so the rail // items don't jump on tab switches, and center the FAB in the collapsed rail. // Skip the slot if no tab has a FAB (no root). + // In bar mode, the scaffold places this slot at the end edge of the window without + // considering insets, so pad it to keep the FAB clear of side system bars and cutouts. Box( - if (isBar || !hasFabTab) Modifier + if (isBar) Modifier.windowInsetsPadding(WindowInsets.safeDrawing.only(WindowInsetsSides.End)) + else if (!hasFabTab) Modifier else Modifier.padding(start = 20.dp).heightIn(min = 56.dp) ) { AnimatedVisibility(