Bladeren bron

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

Andreas 2 jaren geleden
bovenliggende
commit
fb83a07f84

+ 3 - 1
app/src/main/java/eu/kanade/presentation/extension/ExtensionScreen.kt

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

+ 3 - 1
app/src/main/java/eu/kanade/presentation/history/HistoryScreen.kt

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

+ 3 - 1
app/src/main/java/eu/kanade/presentation/source/MigrateSourceScreen.kt

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

+ 3 - 1
app/src/main/java/eu/kanade/presentation/source/SourceScreen.kt

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

+ 3 - 0
app/src/main/java/eu/kanade/presentation/util/Constants.kt

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

+ 20 - 0
app/src/main/java/eu/kanade/presentation/util/PaddingValues.kt

@@ -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(),
+    )
+}