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 package eu.kanade.presentation.library
import androidx.compose.foundation.layout.safeDrawingPadding
import androidx.compose.runtime.Composable import androidx.compose.runtime.Composable
import androidx.compose.runtime.getValue import androidx.compose.runtime.getValue
import androidx.compose.ui.Modifier
import eu.kanade.domain.category.model.Category import eu.kanade.domain.category.model.Category
import eu.kanade.presentation.components.LibraryBottomActionMenu import eu.kanade.presentation.components.LibraryBottomActionMenu
import eu.kanade.presentation.components.Scaffold import eu.kanade.presentation.components.Scaffold
@ -27,6 +29,7 @@ fun LibraryScreen(
onClickRefresh: (Category?) -> Unit, onClickRefresh: (Category?) -> Unit,
) { ) {
Scaffold( Scaffold(
modifier = Modifier.safeDrawingPadding(),
topBar = { topBar = {
val title by presenter.getToolbarTitle() val title by presenter.getToolbarTitle()
LibraryToolbar( LibraryToolbar(

View File

@ -2,9 +2,6 @@ package eu.kanade.presentation.library.components
import androidx.compose.foundation.layout.Arrangement import androidx.compose.foundation.layout.Arrangement
import androidx.compose.foundation.layout.PaddingValues 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.GridCells
import androidx.compose.foundation.lazy.grid.GridItemSpan import androidx.compose.foundation.lazy.grid.GridItemSpan
import androidx.compose.foundation.lazy.grid.LazyGridScope import androidx.compose.foundation.lazy.grid.LazyGridScope
@ -29,7 +26,7 @@ fun LazyLibraryGrid(
LazyVerticalGrid( LazyVerticalGrid(
modifier = modifier, modifier = modifier,
columns = if (columns == 0) GridCells.Adaptive(128.dp) else GridCells.Fixed(columns), 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), verticalArrangement = Arrangement.spacedBy(12.dp),
horizontalArrangement = Arrangement.spacedBy(12.dp), horizontalArrangement = Arrangement.spacedBy(12.dp),
content = content, content = content,

View File

@ -2,11 +2,8 @@ package eu.kanade.presentation.library.components
import androidx.compose.foundation.combinedClickable import androidx.compose.foundation.combinedClickable
import androidx.compose.foundation.layout.Row 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.fillMaxHeight
import androidx.compose.foundation.layout.height import androidx.compose.foundation.layout.height
import androidx.compose.foundation.layout.navigationBars
import androidx.compose.foundation.layout.padding import androidx.compose.foundation.layout.padding
import androidx.compose.foundation.lazy.LazyColumn import androidx.compose.foundation.lazy.LazyColumn
import androidx.compose.foundation.lazy.items import androidx.compose.foundation.lazy.items
@ -41,7 +38,7 @@ fun LibraryList(
onGlobalSearchClicked: () -> Unit, onGlobalSearchClicked: () -> Unit,
) { ) {
LazyColumn( LazyColumn(
contentPadding = bottomNavPaddingValues + WindowInsets.navigationBars.asPaddingValues(), contentPadding = bottomNavPaddingValues,
) { ) {
item { item {
if (searchQuery.isNullOrEmpty().not()) { 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.isSystemInDarkTheme
import androidx.compose.foundation.layout.Row import androidx.compose.foundation.layout.Row
import androidx.compose.foundation.layout.fillMaxWidth import androidx.compose.foundation.layout.fillMaxWidth
import androidx.compose.foundation.layout.safeDrawingPadding
import androidx.compose.foundation.text.BasicTextField import androidx.compose.foundation.text.BasicTextField
import androidx.compose.material.icons.Icons import androidx.compose.material.icons.Icons
import androidx.compose.material.icons.outlined.ArrowBack import androidx.compose.material.icons.outlined.ArrowBack
@ -79,7 +78,6 @@ fun LibraryRegularToolbar(
val pillAlpha = if (isSystemInDarkTheme()) 0.12f else 0.08f val pillAlpha = if (isSystemInDarkTheme()) 0.12f else 0.08f
val filterTint = if (hasFilters) MaterialTheme.colorScheme.active else LocalContentColor.current val filterTint = if (hasFilters) MaterialTheme.colorScheme.active else LocalContentColor.current
SmallTopAppBar( SmallTopAppBar(
modifier = Modifier.safeDrawingPadding(),
title = { title = {
Row(verticalAlignment = Alignment.CenterVertically) { Row(verticalAlignment = Alignment.CenterVertically) {
Text( Text(
@ -123,8 +121,7 @@ fun LibrarySelectionToolbar(
modifier = Modifier modifier = Modifier
.drawBehind { .drawBehind {
drawRect(backgroundColor.copy(alpha = 1f)) drawRect(backgroundColor.copy(alpha = 1f))
} },
.safeDrawingPadding(),
navigationIcon = { navigationIcon = {
IconButton(onClick = onClickUnselectAll) { IconButton(onClick = onClickUnselectAll) {
Icon(Icons.Outlined.Close, contentDescription = "close") Icon(Icons.Outlined.Close, contentDescription = "close")
@ -156,7 +153,6 @@ fun LibrarySearchToolbar(
) { ) {
val focusRequester = remember { FocusRequester.Default } val focusRequester = remember { FocusRequester.Default }
SmallTopAppBar( SmallTopAppBar(
modifier = Modifier.safeDrawingPadding(),
navigationIcon = { navigationIcon = {
IconButton(onClick = onClickCloseSearch) { IconButton(onClick = onClickCloseSearch) {
Icon(Icons.Outlined.ArrowBack, contentDescription = "back") Icon(Icons.Outlined.ArrowBack, contentDescription = "back")