Fix toolbar having bottom padding in portrait (#7601)

This commit is contained in:
Andreas 2022-07-24 15:56:03 +02:00 committed by GitHub
parent 2e15be59af
commit 6f94777530
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
4 changed files with 6 additions and 13 deletions

View file

@ -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(

View file

@ -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,

View file

@ -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()) {

View file

@ -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")