Add missing top padding for screen that was rewritten in Compose (#7145)

This commit is contained in:
Andreas 2022-05-15 20:00:35 +02:00 committed by GitHub
parent 3e2d7d76b9
commit fb83a07f84
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
6 changed files with 35 additions and 4 deletions

View file

@ -41,7 +41,9 @@ import com.google.accompanist.swiperefresh.rememberSwipeRefreshState
import eu.kanade.presentation.browse.components.BaseBrowseItem import eu.kanade.presentation.browse.components.BaseBrowseItem
import eu.kanade.presentation.browse.components.ExtensionIcon import eu.kanade.presentation.browse.components.ExtensionIcon
import eu.kanade.presentation.theme.header import eu.kanade.presentation.theme.header
import eu.kanade.presentation.util.topPaddingValues
import eu.kanade.presentation.util.horizontalPadding import eu.kanade.presentation.util.horizontalPadding
import eu.kanade.presentation.util.plus
import eu.kanade.tachiyomi.R import eu.kanade.tachiyomi.R
import eu.kanade.tachiyomi.extension.model.Extension import eu.kanade.tachiyomi.extension.model.Extension
import eu.kanade.tachiyomi.extension.model.InstallStep import eu.kanade.tachiyomi.extension.model.InstallStep
@ -110,7 +112,7 @@ fun ExtensionContent(
) { ) {
val (trustState, setTrustState) = remember { mutableStateOf<Extension.Untrusted?>(null) } val (trustState, setTrustState) = remember { mutableStateOf<Extension.Untrusted?>(null) }
LazyColumn( LazyColumn(
contentPadding = WindowInsets.navigationBars.asPaddingValues(), contentPadding = WindowInsets.navigationBars.asPaddingValues() + topPaddingValues,
) { ) {
items( items(
items = items, items = items,

View file

@ -44,7 +44,9 @@ import eu.kanade.domain.history.model.HistoryWithRelations
import eu.kanade.presentation.components.EmptyScreen import eu.kanade.presentation.components.EmptyScreen
import eu.kanade.presentation.components.LoadingScreen import eu.kanade.presentation.components.LoadingScreen
import eu.kanade.presentation.components.MangaCover import eu.kanade.presentation.components.MangaCover
import eu.kanade.presentation.util.topPaddingValues
import eu.kanade.presentation.util.horizontalPadding import eu.kanade.presentation.util.horizontalPadding
import eu.kanade.presentation.util.plus
import eu.kanade.tachiyomi.R import eu.kanade.tachiyomi.R
import eu.kanade.tachiyomi.data.preference.PreferencesHelper import eu.kanade.tachiyomi.data.preference.PreferencesHelper
import eu.kanade.tachiyomi.ui.recent.history.HistoryPresenter import eu.kanade.tachiyomi.ui.recent.history.HistoryPresenter
@ -107,7 +109,7 @@ fun HistoryContent(
LazyColumn( LazyColumn(
modifier = Modifier modifier = Modifier
.nestedScroll(nestedScroll), .nestedScroll(nestedScroll),
contentPadding = WindowInsets.navigationBars.asPaddingValues(), contentPadding = WindowInsets.navigationBars.asPaddingValues() + topPaddingValues,
state = scrollState, state = scrollState,
) { ) {
items(history) { item -> items(history) { item ->

View file

@ -22,7 +22,9 @@ import eu.kanade.presentation.components.ItemBadges
import eu.kanade.presentation.components.LoadingScreen import eu.kanade.presentation.components.LoadingScreen
import eu.kanade.presentation.source.components.BaseSourceItem import eu.kanade.presentation.source.components.BaseSourceItem
import eu.kanade.presentation.theme.header import eu.kanade.presentation.theme.header
import eu.kanade.presentation.util.topPaddingValues
import eu.kanade.presentation.util.horizontalPadding import eu.kanade.presentation.util.horizontalPadding
import eu.kanade.presentation.util.plus
import eu.kanade.tachiyomi.R import eu.kanade.tachiyomi.R
import eu.kanade.tachiyomi.ui.browse.migration.sources.MigrateSourceState import eu.kanade.tachiyomi.ui.browse.migration.sources.MigrateSourceState
import eu.kanade.tachiyomi.ui.browse.migration.sources.MigrationSourcesPresenter import eu.kanade.tachiyomi.ui.browse.migration.sources.MigrationSourcesPresenter
@ -62,7 +64,7 @@ fun MigrateSourceList(
LazyColumn( LazyColumn(
modifier = Modifier.nestedScroll(nestedScrollInterop), modifier = Modifier.nestedScroll(nestedScrollInterop),
contentPadding = WindowInsets.navigationBars.asPaddingValues(), contentPadding = WindowInsets.navigationBars.asPaddingValues() + topPaddingValues,
) { ) {
item(key = "title") { item(key = "title") {
Text( Text(

View file

@ -36,7 +36,9 @@ import eu.kanade.presentation.components.EmptyScreen
import eu.kanade.presentation.components.LoadingScreen import eu.kanade.presentation.components.LoadingScreen
import eu.kanade.presentation.source.components.BaseSourceItem import eu.kanade.presentation.source.components.BaseSourceItem
import eu.kanade.presentation.theme.header import eu.kanade.presentation.theme.header
import eu.kanade.presentation.util.topPaddingValues
import eu.kanade.presentation.util.horizontalPadding import eu.kanade.presentation.util.horizontalPadding
import eu.kanade.presentation.util.plus
import eu.kanade.tachiyomi.R import eu.kanade.tachiyomi.R
import eu.kanade.tachiyomi.source.LocalSource import eu.kanade.tachiyomi.source.LocalSource
import eu.kanade.tachiyomi.ui.browse.source.SourcePresenter import eu.kanade.tachiyomi.ui.browse.source.SourcePresenter
@ -86,7 +88,7 @@ fun SourceList(
LazyColumn( LazyColumn(
modifier = Modifier modifier = Modifier
.nestedScroll(nestedScrollConnection), .nestedScroll(nestedScrollConnection),
contentPadding = WindowInsets.navigationBars.asPaddingValues(), contentPadding = WindowInsets.navigationBars.asPaddingValues() + topPaddingValues,
) { ) {
items( items(
items = list, items = list,

View file

@ -1,5 +1,8 @@
package eu.kanade.presentation.util package eu.kanade.presentation.util
import androidx.compose.foundation.layout.PaddingValues
import androidx.compose.ui.unit.dp import androidx.compose.ui.unit.dp
val horizontalPadding = 16.dp val horizontalPadding = 16.dp
val topPaddingValues = PaddingValues(top = 8.dp)

View file

@ -0,0 +1,20 @@
package eu.kanade.presentation.util
import androidx.compose.foundation.layout.PaddingValues
import androidx.compose.foundation.layout.calculateEndPadding
import androidx.compose.foundation.layout.calculateStartPadding
import androidx.compose.runtime.Composable
import androidx.compose.ui.platform.LocalLayoutDirection
@Composable
operator fun PaddingValues.plus(other: PaddingValues): PaddingValues {
val layoutDirection = LocalLayoutDirection.current
return PaddingValues(
start = calculateStartPadding(layoutDirection) +
other.calculateStartPadding(layoutDirection),
end = calculateEndPadding(layoutDirection) +
other.calculateEndPadding(layoutDirection),
top = calculateTopPadding() + other.calculateTopPadding(),
bottom = calculateBottomPadding() + other.calculateBottomPadding(),
)
}