From 6f947775307296974b9a109578dd895d34179758 Mon Sep 17 00:00:00 2001 From: Andreas Date: Sun, 24 Jul 2022 15:56:03 +0200 Subject: [PATCH] Fix toolbar having bottom padding in portrait (#7601) --- .../java/eu/kanade/presentation/library/LibraryScreen.kt | 3 +++ .../presentation/library/components/LazyLibraryGrid.kt | 5 +---- .../kanade/presentation/library/components/LibraryList.kt | 5 +---- .../presentation/library/components/LibraryToolbar.kt | 6 +----- 4 files changed, 6 insertions(+), 13 deletions(-) diff --git a/app/src/main/java/eu/kanade/presentation/library/LibraryScreen.kt b/app/src/main/java/eu/kanade/presentation/library/LibraryScreen.kt index 483bb6d8d8..e7655a35cf 100644 --- a/app/src/main/java/eu/kanade/presentation/library/LibraryScreen.kt +++ b/app/src/main/java/eu/kanade/presentation/library/LibraryScreen.kt @@ -1,7 +1,9 @@ package eu.kanade.presentation.library +import androidx.compose.foundation.layout.safeDrawingPadding import androidx.compose.runtime.Composable import androidx.compose.runtime.getValue +import androidx.compose.ui.Modifier import eu.kanade.domain.category.model.Category import eu.kanade.presentation.components.LibraryBottomActionMenu import eu.kanade.presentation.components.Scaffold @@ -27,6 +29,7 @@ fun LibraryScreen( onClickRefresh: (Category?) -> Unit, ) { Scaffold( + modifier = Modifier.safeDrawingPadding(), topBar = { val title by presenter.getToolbarTitle() LibraryToolbar( diff --git a/app/src/main/java/eu/kanade/presentation/library/components/LazyLibraryGrid.kt b/app/src/main/java/eu/kanade/presentation/library/components/LazyLibraryGrid.kt index 79f1b1d89f..d73e0cb174 100644 --- a/app/src/main/java/eu/kanade/presentation/library/components/LazyLibraryGrid.kt +++ b/app/src/main/java/eu/kanade/presentation/library/components/LazyLibraryGrid.kt @@ -2,9 +2,6 @@ package eu.kanade.presentation.library.components import androidx.compose.foundation.layout.Arrangement import androidx.compose.foundation.layout.PaddingValues -import androidx.compose.foundation.layout.WindowInsets -import androidx.compose.foundation.layout.asPaddingValues -import androidx.compose.foundation.layout.navigationBars import androidx.compose.foundation.lazy.grid.GridCells import androidx.compose.foundation.lazy.grid.GridItemSpan import androidx.compose.foundation.lazy.grid.LazyGridScope @@ -29,7 +26,7 @@ fun LazyLibraryGrid( LazyVerticalGrid( modifier = modifier, columns = if (columns == 0) GridCells.Adaptive(128.dp) else GridCells.Fixed(columns), - contentPadding = bottomNavPaddingValues + PaddingValues(12.dp, 2.dp) + WindowInsets.navigationBars.asPaddingValues(), + contentPadding = bottomNavPaddingValues + PaddingValues(12.dp, 2.dp), verticalArrangement = Arrangement.spacedBy(12.dp), horizontalArrangement = Arrangement.spacedBy(12.dp), content = content, diff --git a/app/src/main/java/eu/kanade/presentation/library/components/LibraryList.kt b/app/src/main/java/eu/kanade/presentation/library/components/LibraryList.kt index 2c0fecf59f..6eeb4ecbb9 100644 --- a/app/src/main/java/eu/kanade/presentation/library/components/LibraryList.kt +++ b/app/src/main/java/eu/kanade/presentation/library/components/LibraryList.kt @@ -2,11 +2,8 @@ package eu.kanade.presentation.library.components import androidx.compose.foundation.combinedClickable import androidx.compose.foundation.layout.Row -import androidx.compose.foundation.layout.WindowInsets -import androidx.compose.foundation.layout.asPaddingValues import androidx.compose.foundation.layout.fillMaxHeight import androidx.compose.foundation.layout.height -import androidx.compose.foundation.layout.navigationBars import androidx.compose.foundation.layout.padding import androidx.compose.foundation.lazy.LazyColumn import androidx.compose.foundation.lazy.items @@ -41,7 +38,7 @@ fun LibraryList( onGlobalSearchClicked: () -> Unit, ) { LazyColumn( - contentPadding = bottomNavPaddingValues + WindowInsets.navigationBars.asPaddingValues(), + contentPadding = bottomNavPaddingValues, ) { item { if (searchQuery.isNullOrEmpty().not()) { diff --git a/app/src/main/java/eu/kanade/presentation/library/components/LibraryToolbar.kt b/app/src/main/java/eu/kanade/presentation/library/components/LibraryToolbar.kt index 305a75f973..90ae523e7b 100644 --- a/app/src/main/java/eu/kanade/presentation/library/components/LibraryToolbar.kt +++ b/app/src/main/java/eu/kanade/presentation/library/components/LibraryToolbar.kt @@ -3,7 +3,6 @@ package eu.kanade.presentation.library.components import androidx.compose.foundation.isSystemInDarkTheme import androidx.compose.foundation.layout.Row import androidx.compose.foundation.layout.fillMaxWidth -import androidx.compose.foundation.layout.safeDrawingPadding import androidx.compose.foundation.text.BasicTextField import androidx.compose.material.icons.Icons import androidx.compose.material.icons.outlined.ArrowBack @@ -79,7 +78,6 @@ fun LibraryRegularToolbar( val pillAlpha = if (isSystemInDarkTheme()) 0.12f else 0.08f val filterTint = if (hasFilters) MaterialTheme.colorScheme.active else LocalContentColor.current SmallTopAppBar( - modifier = Modifier.safeDrawingPadding(), title = { Row(verticalAlignment = Alignment.CenterVertically) { Text( @@ -123,8 +121,7 @@ fun LibrarySelectionToolbar( modifier = Modifier .drawBehind { drawRect(backgroundColor.copy(alpha = 1f)) - } - .safeDrawingPadding(), + }, navigationIcon = { IconButton(onClick = onClickUnselectAll) { Icon(Icons.Outlined.Close, contentDescription = "close") @@ -156,7 +153,6 @@ fun LibrarySearchToolbar( ) { val focusRequester = remember { FocusRequester.Default } SmallTopAppBar( - modifier = Modifier.safeDrawingPadding(), navigationIcon = { IconButton(onClick = onClickCloseSearch) { Icon(Icons.Outlined.ArrowBack, contentDescription = "back")