From 0067d474c86d08011ebf3b1676c4db8c85e68125 Mon Sep 17 00:00:00 2001 From: arkon Date: Sun, 8 Jan 2023 15:40:43 -0500 Subject: [PATCH] Use theme padding values in more places --- .../eu/kanade/presentation/browse/MigrateSourceScreen.kt | 3 +-- .../presentation/category/components/CategoryContent.kt | 5 +++-- .../eu/kanade/presentation/components/EmptyScreen.kt | 3 ++- .../eu/kanade/presentation/components/NavigationRail.kt | 8 +++++--- .../kanade/presentation/manga/TrackInfoDialogSelector.kt | 3 ++- .../eu/kanade/presentation/manga/TrackServiceSearch.kt | 3 ++- .../presentation/manga/components/MangaInfoHeader.kt | 5 +++-- .../more/settings/screen/SettingsTrackingScreen.kt | 3 ++- .../more/settings/widget/AppThemePreferenceWidget.kt | 5 +++-- .../presentation/more/settings/widget/InfoWidget.kt | 9 ++++++--- .../ui/browse/source/browse/BrowseSourceScreen.kt | 6 +++--- .../kanade/tachiyomi/ui/manga/track/TrackInfoDialog.kt | 4 ++-- 12 files changed, 34 insertions(+), 23 deletions(-) diff --git a/app/src/main/java/eu/kanade/presentation/browse/MigrateSourceScreen.kt b/app/src/main/java/eu/kanade/presentation/browse/MigrateSourceScreen.kt index 981e1ae34e..a808d7edd4 100644 --- a/app/src/main/java/eu/kanade/presentation/browse/MigrateSourceScreen.kt +++ b/app/src/main/java/eu/kanade/presentation/browse/MigrateSourceScreen.kt @@ -22,7 +22,6 @@ import androidx.compose.ui.Modifier import androidx.compose.ui.platform.LocalContext import androidx.compose.ui.res.stringResource import androidx.compose.ui.text.style.TextOverflow -import androidx.compose.ui.unit.dp import eu.kanade.domain.source.interactor.SetMigrateSorting import eu.kanade.domain.source.model.Source import eu.kanade.presentation.browse.components.BaseSourceItem @@ -164,7 +163,7 @@ private fun MigrateSourceItem( style = MaterialTheme.typography.bodyMedium, ) Row( - horizontalArrangement = Arrangement.spacedBy(8.dp), + horizontalArrangement = Arrangement.spacedBy(MaterialTheme.padding.small), verticalAlignment = Alignment.CenterVertically, ) { if (sourceLangString != null) { diff --git a/app/src/main/java/eu/kanade/presentation/category/components/CategoryContent.kt b/app/src/main/java/eu/kanade/presentation/category/components/CategoryContent.kt index 23fb9f1e80..13e6823cff 100644 --- a/app/src/main/java/eu/kanade/presentation/category/components/CategoryContent.kt +++ b/app/src/main/java/eu/kanade/presentation/category/components/CategoryContent.kt @@ -4,11 +4,12 @@ import androidx.compose.foundation.layout.Arrangement import androidx.compose.foundation.layout.PaddingValues import androidx.compose.foundation.lazy.LazyListState import androidx.compose.foundation.lazy.itemsIndexed +import androidx.compose.material3.MaterialTheme import androidx.compose.runtime.Composable import androidx.compose.ui.Modifier -import androidx.compose.ui.unit.dp import eu.kanade.domain.category.model.Category import eu.kanade.presentation.components.LazyColumn +import eu.kanade.presentation.util.padding @Composable fun CategoryContent( @@ -23,7 +24,7 @@ fun CategoryContent( LazyColumn( state = lazyListState, contentPadding = paddingValues, - verticalArrangement = Arrangement.spacedBy(8.dp), + verticalArrangement = Arrangement.spacedBy(MaterialTheme.padding.small), ) { itemsIndexed( items = categories, diff --git a/app/src/main/java/eu/kanade/presentation/components/EmptyScreen.kt b/app/src/main/java/eu/kanade/presentation/components/EmptyScreen.kt index 9e9711841e..2908c190e1 100644 --- a/app/src/main/java/eu/kanade/presentation/components/EmptyScreen.kt +++ b/app/src/main/java/eu/kanade/presentation/components/EmptyScreen.kt @@ -27,6 +27,7 @@ import androidx.compose.ui.text.style.TextAlign import androidx.compose.ui.unit.dp import eu.kanade.presentation.theme.TachiyomiTheme import eu.kanade.presentation.util.ThemePreviews +import eu.kanade.presentation.util.padding import eu.kanade.presentation.util.secondaryItemAlpha import eu.kanade.tachiyomi.R import kotlin.random.Random @@ -79,7 +80,7 @@ fun EmptyScreen( start = 24.dp, end = 24.dp, ), - horizontalArrangement = Arrangement.spacedBy(space = 8.dp), + horizontalArrangement = Arrangement.spacedBy(MaterialTheme.padding.small), ) { actions.forEach { ActionButton( diff --git a/app/src/main/java/eu/kanade/presentation/components/NavigationRail.kt b/app/src/main/java/eu/kanade/presentation/components/NavigationRail.kt index 4a0778b079..674560c24d 100644 --- a/app/src/main/java/eu/kanade/presentation/components/NavigationRail.kt +++ b/app/src/main/java/eu/kanade/presentation/components/NavigationRail.kt @@ -11,6 +11,7 @@ import androidx.compose.foundation.layout.padding import androidx.compose.foundation.layout.widthIn import androidx.compose.foundation.layout.windowInsetsPadding import androidx.compose.foundation.selection.selectableGroup +import androidx.compose.material3.MaterialTheme import androidx.compose.material3.NavigationRailDefaults import androidx.compose.material3.contentColorFor import androidx.compose.runtime.Composable @@ -18,6 +19,7 @@ import androidx.compose.ui.Alignment import androidx.compose.ui.Modifier import androidx.compose.ui.graphics.Color import androidx.compose.ui.unit.dp +import eu.kanade.presentation.util.padding /** * Center-aligned M3 Navigation rail @@ -44,14 +46,14 @@ fun NavigationRail( .fillMaxHeight() .windowInsetsPadding(windowInsets) .widthIn(min = 80.dp) - .padding(vertical = 4.dp) + .padding(vertical = MaterialTheme.padding.tiny) .selectableGroup(), horizontalAlignment = Alignment.CenterHorizontally, - verticalArrangement = Arrangement.spacedBy(space = 4.dp, alignment = Alignment.CenterVertically), + verticalArrangement = Arrangement.spacedBy(MaterialTheme.padding.tiny, alignment = Alignment.CenterVertically), ) { if (header != null) { header() - Spacer(Modifier.height(8.dp)) + Spacer(Modifier.height(MaterialTheme.padding.small)) } content() } diff --git a/app/src/main/java/eu/kanade/presentation/manga/TrackInfoDialogSelector.kt b/app/src/main/java/eu/kanade/presentation/manga/TrackInfoDialogSelector.kt index 89a3f692a0..191a1313dc 100644 --- a/app/src/main/java/eu/kanade/presentation/manga/TrackInfoDialogSelector.kt +++ b/app/src/main/java/eu/kanade/presentation/manga/TrackInfoDialogSelector.kt @@ -37,6 +37,7 @@ import eu.kanade.presentation.components.ScrollbarLazyColumn import eu.kanade.presentation.util.isScrolledToEnd import eu.kanade.presentation.util.isScrolledToStart import eu.kanade.presentation.util.minimumTouchTargetSize +import eu.kanade.presentation.util.padding import eu.kanade.tachiyomi.R import java.time.LocalDate import java.time.format.TextStyle @@ -210,7 +211,7 @@ private fun BaseSelector( buttons = { Row( modifier = Modifier.fillMaxWidth(), - horizontalArrangement = Arrangement.spacedBy(8.dp, Alignment.End), + horizontalArrangement = Arrangement.spacedBy(MaterialTheme.padding.small, Alignment.End), ) { if (thirdButton != null) { thirdButton() diff --git a/app/src/main/java/eu/kanade/presentation/manga/TrackServiceSearch.kt b/app/src/main/java/eu/kanade/presentation/manga/TrackServiceSearch.kt index d7f1037d89..36ec519a8b 100644 --- a/app/src/main/java/eu/kanade/presentation/manga/TrackServiceSearch.kt +++ b/app/src/main/java/eu/kanade/presentation/manga/TrackServiceSearch.kt @@ -62,6 +62,7 @@ import eu.kanade.presentation.components.LoadingScreen import eu.kanade.presentation.components.MangaCover import eu.kanade.presentation.components.Scaffold import eu.kanade.presentation.components.ScrollbarLazyColumn +import eu.kanade.presentation.util.padding import eu.kanade.presentation.util.plus import eu.kanade.presentation.util.runOnEnterKeyPressed import eu.kanade.presentation.util.secondaryItemAlpha @@ -296,7 +297,7 @@ private fun SearchResultItemDetails( title: String, text: String, ) { - Row(horizontalArrangement = Arrangement.spacedBy(4.dp)) { + Row(horizontalArrangement = Arrangement.spacedBy(MaterialTheme.padding.tiny)) { Text( text = title, maxLines = 1, diff --git a/app/src/main/java/eu/kanade/presentation/manga/components/MangaInfoHeader.kt b/app/src/main/java/eu/kanade/presentation/manga/components/MangaInfoHeader.kt index eda1973f9f..c2e53be16b 100644 --- a/app/src/main/java/eu/kanade/presentation/manga/components/MangaInfoHeader.kt +++ b/app/src/main/java/eu/kanade/presentation/manga/components/MangaInfoHeader.kt @@ -76,6 +76,7 @@ import eu.kanade.domain.manga.model.Manga import eu.kanade.presentation.components.MangaCover import eu.kanade.presentation.components.TextButton import eu.kanade.presentation.util.clickableNoIndication +import eu.kanade.presentation.util.padding import eu.kanade.presentation.util.secondaryItemAlpha import eu.kanade.tachiyomi.R import eu.kanade.tachiyomi.source.model.SManga @@ -254,8 +255,8 @@ fun ExpandableMangaDescription( } } else { LazyRow( - contentPadding = PaddingValues(horizontal = 16.dp), - horizontalArrangement = Arrangement.spacedBy(4.dp), + contentPadding = PaddingValues(horizontal = MaterialTheme.padding.medium), + horizontalArrangement = Arrangement.spacedBy(MaterialTheme.padding.tiny), ) { items(items = tags) { TagsChip( diff --git a/app/src/main/java/eu/kanade/presentation/more/settings/screen/SettingsTrackingScreen.kt b/app/src/main/java/eu/kanade/presentation/more/settings/screen/SettingsTrackingScreen.kt index f591ed155b..91ecac4df3 100644 --- a/app/src/main/java/eu/kanade/presentation/more/settings/screen/SettingsTrackingScreen.kt +++ b/app/src/main/java/eu/kanade/presentation/more/settings/screen/SettingsTrackingScreen.kt @@ -43,6 +43,7 @@ import androidx.compose.ui.text.style.TextAlign import androidx.compose.ui.unit.dp import eu.kanade.domain.track.service.TrackPreferences import eu.kanade.presentation.more.settings.Preference +import eu.kanade.presentation.util.padding import eu.kanade.tachiyomi.R import eu.kanade.tachiyomi.data.track.EnhancedTrackService import eu.kanade.tachiyomi.data.track.TrackManager @@ -319,7 +320,7 @@ object SettingsTrackingScreen : SearchableSettings { ) }, confirmButton = { - Row(horizontalArrangement = Arrangement.spacedBy(4.dp)) { + Row(horizontalArrangement = Arrangement.spacedBy(MaterialTheme.padding.tiny)) { OutlinedButton( modifier = Modifier.weight(1f), onClick = onDismissRequest, diff --git a/app/src/main/java/eu/kanade/presentation/more/settings/widget/AppThemePreferenceWidget.kt b/app/src/main/java/eu/kanade/presentation/more/settings/widget/AppThemePreferenceWidget.kt index e61e9e46af..2600d57351 100644 --- a/app/src/main/java/eu/kanade/presentation/more/settings/widget/AppThemePreferenceWidget.kt +++ b/app/src/main/java/eu/kanade/presentation/more/settings/widget/AppThemePreferenceWidget.kt @@ -43,6 +43,7 @@ import eu.kanade.presentation.components.DIVIDER_ALPHA import eu.kanade.presentation.components.MangaCover import eu.kanade.presentation.theme.TachiyomiTheme import eu.kanade.presentation.util.ThemePreviews +import eu.kanade.presentation.util.padding import eu.kanade.presentation.util.secondaryItemAlpha import eu.kanade.tachiyomi.R import eu.kanade.tachiyomi.util.system.DeviceUtil @@ -80,9 +81,9 @@ private fun AppThemesList( LazyRow( modifier = Modifier .animateContentSize() - .padding(vertical = 8.dp), + .padding(vertical = MaterialTheme.padding.small), contentPadding = PaddingValues(horizontal = PrefsHorizontalPadding), - horizontalArrangement = Arrangement.spacedBy(8.dp), + horizontalArrangement = Arrangement.spacedBy(MaterialTheme.padding.small), ) { items( items = appThemes, diff --git a/app/src/main/java/eu/kanade/presentation/more/settings/widget/InfoWidget.kt b/app/src/main/java/eu/kanade/presentation/more/settings/widget/InfoWidget.kt index 6a4aa74f3b..16ab3cb780 100644 --- a/app/src/main/java/eu/kanade/presentation/more/settings/widget/InfoWidget.kt +++ b/app/src/main/java/eu/kanade/presentation/more/settings/widget/InfoWidget.kt @@ -12,9 +12,9 @@ import androidx.compose.material3.Text import androidx.compose.runtime.Composable import androidx.compose.ui.Modifier import androidx.compose.ui.res.stringResource -import androidx.compose.ui.unit.dp import eu.kanade.presentation.theme.TachiyomiTheme import eu.kanade.presentation.util.ThemePreviews +import eu.kanade.presentation.util.padding import eu.kanade.presentation.util.secondaryItemAlpha import eu.kanade.tachiyomi.R @@ -22,9 +22,12 @@ import eu.kanade.tachiyomi.R internal fun InfoWidget(text: String) { Column( modifier = Modifier - .padding(horizontal = PrefsHorizontalPadding, vertical = 16.dp) + .padding( + horizontal = PrefsHorizontalPadding, + vertical = MaterialTheme.padding.medium, + ) .secondaryItemAlpha(), - verticalArrangement = Arrangement.spacedBy(16.dp), + verticalArrangement = Arrangement.spacedBy(MaterialTheme.padding.medium), ) { Icon( imageVector = Icons.Outlined.Info, diff --git a/app/src/main/java/eu/kanade/tachiyomi/ui/browse/source/browse/BrowseSourceScreen.kt b/app/src/main/java/eu/kanade/tachiyomi/ui/browse/source/browse/BrowseSourceScreen.kt index bb3e91cf39..dc5b771702 100644 --- a/app/src/main/java/eu/kanade/tachiyomi/ui/browse/source/browse/BrowseSourceScreen.kt +++ b/app/src/main/java/eu/kanade/tachiyomi/ui/browse/source/browse/BrowseSourceScreen.kt @@ -32,7 +32,6 @@ import androidx.compose.ui.platform.LocalContext import androidx.compose.ui.platform.LocalHapticFeedback import androidx.compose.ui.platform.LocalUriHandler import androidx.compose.ui.res.stringResource -import androidx.compose.ui.unit.dp import androidx.paging.compose.collectAsLazyPagingItems import cafe.adriel.voyager.core.model.rememberScreenModel import cafe.adriel.voyager.core.screen.Screen @@ -47,6 +46,7 @@ import eu.kanade.presentation.components.Divider import eu.kanade.presentation.components.DuplicateMangaDialog import eu.kanade.presentation.components.Scaffold import eu.kanade.presentation.util.AssistContentScreen +import eu.kanade.presentation.util.padding import eu.kanade.tachiyomi.R import eu.kanade.tachiyomi.source.LocalSource import eu.kanade.tachiyomi.source.online.HttpSource @@ -121,8 +121,8 @@ data class BrowseSourceScreen( Row( modifier = Modifier .horizontalScroll(rememberScrollState()) - .padding(horizontal = 8.dp), - horizontalArrangement = Arrangement.spacedBy(8.dp), + .padding(horizontal = MaterialTheme.padding.small), + horizontalArrangement = Arrangement.spacedBy(MaterialTheme.padding.small), ) { FilterChip( selected = state.listing == Listing.Popular, diff --git a/app/src/main/java/eu/kanade/tachiyomi/ui/manga/track/TrackInfoDialog.kt b/app/src/main/java/eu/kanade/tachiyomi/ui/manga/track/TrackInfoDialog.kt index 6034d95128..5f26e73002 100644 --- a/app/src/main/java/eu/kanade/tachiyomi/ui/manga/track/TrackInfoDialog.kt +++ b/app/src/main/java/eu/kanade/tachiyomi/ui/manga/track/TrackInfoDialog.kt @@ -28,7 +28,6 @@ import androidx.compose.ui.platform.LocalContext import androidx.compose.ui.res.stringResource import androidx.compose.ui.text.input.TextFieldValue import androidx.compose.ui.text.style.TextAlign -import androidx.compose.ui.unit.dp import cafe.adriel.voyager.core.model.ScreenModel import cafe.adriel.voyager.core.model.StateScreenModel import cafe.adriel.voyager.core.model.coroutineScope @@ -53,6 +52,7 @@ import eu.kanade.presentation.manga.TrackInfoDialogHome import eu.kanade.presentation.manga.TrackScoreSelector import eu.kanade.presentation.manga.TrackServiceSearch import eu.kanade.presentation.manga.TrackStatusSelector +import eu.kanade.presentation.util.padding import eu.kanade.tachiyomi.R import eu.kanade.tachiyomi.data.database.models.Track import eu.kanade.tachiyomi.data.track.EnhancedTrackService @@ -518,7 +518,7 @@ private data class TrackDateRemoverScreen( buttons = { Row( modifier = Modifier.fillMaxWidth(), - horizontalArrangement = Arrangement.spacedBy(8.dp, Alignment.End), + horizontalArrangement = Arrangement.spacedBy(MaterialTheme.padding.small, Alignment.End), ) { TextButton(onClick = navigator::pop) { Text(text = stringResource(android.R.string.cancel))