From 6bb77bcf1aabfcad2c4a9dd73854f3fcc6c52c89 Mon Sep 17 00:00:00 2001 From: arkon Date: Sat, 30 Dec 2023 10:30:32 -0500 Subject: [PATCH] Minor cleanup/address lint warnings --- .../browse/ExtensionDetailsScreen.kt | 2 +- .../presentation/browse/ExtensionsScreen.kt | 4 ++-- .../browse/components/GlobalSearchCardRow.kt | 2 +- .../components/GlobalSearchResultItems.kt | 2 +- .../history/components/HistoryDialogs.kt | 5 +++-- .../manga/DuplicateMangaDialog.kt | 5 +++-- .../manga/components/BaseMangaListItem.kt | 2 +- .../manga/components/ChapterHeader.kt | 6 +++-- .../manga/components/DotSeparatorText.kt | 19 ++++++++++++---- .../manga/components/MangaBottomActionMenu.kt | 2 +- .../manga/components/MangaCover.kt | 2 +- .../manga/components/MangaInfoHeader.kt | 11 +++++----- .../presentation/more/NewUpdateScreen.kt | 2 +- .../more/onboarding/GuidesStep.kt | 3 ++- .../more/onboarding/StorageStep.kt | 4 +++- .../settings/screen/SettingsTrackingScreen.kt | 2 +- .../screen/data/CreateBackupScreen.kt | 2 ++ .../more/settings/screen/data/StorageInfo.kt | 5 +++-- .../more/stats/StatsScreenContent.kt | 22 +++++++++---------- .../reader/appbars/ReaderAppBars.kt | 3 ++- .../reader/components/ModeSelectionDialog.kt | 4 +++- .../presentation/track/TrackerSearch.kt | 2 +- .../browse/migration/search/MigrateDialog.kt | 4 ++-- .../ui/manga/track/TrackInfoDialog.kt | 3 +-- .../core/components/ActionButton.kt | 5 +++-- .../core/components/LabeledCheckbox.kt | 3 ++- .../core/components/SectionCard.kt | 20 ++++++++++------- .../core/components/SettingsItems.kt | 2 +- .../core/components/material/Constants.kt | 2 +- .../components/material/NavigationRail.kt | 4 ++-- 30 files changed, 91 insertions(+), 63 deletions(-) rename app/src/main/java/eu/kanade/presentation/more/stats/components/StatsSection.kt => presentation-core/src/main/java/tachiyomi/presentation/core/components/SectionCard.kt (70%) diff --git a/app/src/main/java/eu/kanade/presentation/browse/ExtensionDetailsScreen.kt b/app/src/main/java/eu/kanade/presentation/browse/ExtensionDetailsScreen.kt index c94a687c2e..65da031422 100644 --- a/app/src/main/java/eu/kanade/presentation/browse/ExtensionDetailsScreen.kt +++ b/app/src/main/java/eu/kanade/presentation/browse/ExtensionDetailsScreen.kt @@ -295,7 +295,7 @@ private fun DetailsHeader( top = MaterialTheme.padding.small, bottom = MaterialTheme.padding.medium, ), - horizontalArrangement = Arrangement.spacedBy(16.dp), + horizontalArrangement = Arrangement.spacedBy(MaterialTheme.padding.medium), ) { OutlinedButton( modifier = Modifier.weight(1f), diff --git a/app/src/main/java/eu/kanade/presentation/browse/ExtensionsScreen.kt b/app/src/main/java/eu/kanade/presentation/browse/ExtensionsScreen.kt index c9c83ab45e..b4af945144 100644 --- a/app/src/main/java/eu/kanade/presentation/browse/ExtensionsScreen.kt +++ b/app/src/main/java/eu/kanade/presentation/browse/ExtensionsScreen.kt @@ -319,7 +319,7 @@ private fun ExtensionItemContent( // Won't look good but it's not like we can ellipsize overflowing content FlowRow( modifier = Modifier.secondaryItemAlpha(), - horizontalArrangement = Arrangement.spacedBy(4.dp), + horizontalArrangement = Arrangement.spacedBy(MaterialTheme.padding.extraSmall), ) { ProvideTextStyle(value = MaterialTheme.typography.bodySmall) { if (extension is Extension.Installed && extension.lang.isNotEmpty()) { @@ -379,7 +379,7 @@ private fun ExtensionItemActions( Row( modifier = modifier, - horizontalArrangement = Arrangement.spacedBy(8.dp), + horizontalArrangement = Arrangement.spacedBy(MaterialTheme.padding.small), ) { when { !isIdle -> { diff --git a/app/src/main/java/eu/kanade/presentation/browse/components/GlobalSearchCardRow.kt b/app/src/main/java/eu/kanade/presentation/browse/components/GlobalSearchCardRow.kt index 135b1135e6..456269b7c6 100644 --- a/app/src/main/java/eu/kanade/presentation/browse/components/GlobalSearchCardRow.kt +++ b/app/src/main/java/eu/kanade/presentation/browse/components/GlobalSearchCardRow.kt @@ -37,7 +37,7 @@ fun GlobalSearchCardRow( LazyRow( contentPadding = PaddingValues(MaterialTheme.padding.small), - horizontalArrangement = Arrangement.spacedBy(MaterialTheme.padding.tiny), + horizontalArrangement = Arrangement.spacedBy(MaterialTheme.padding.extraSmall), ) { items(titles) { val title by getManga(it) diff --git a/app/src/main/java/eu/kanade/presentation/browse/components/GlobalSearchResultItems.kt b/app/src/main/java/eu/kanade/presentation/browse/components/GlobalSearchResultItems.kt index d0f032a2d8..29ef3b97b5 100644 --- a/app/src/main/java/eu/kanade/presentation/browse/components/GlobalSearchResultItems.kt +++ b/app/src/main/java/eu/kanade/presentation/browse/components/GlobalSearchResultItems.kt @@ -39,7 +39,7 @@ fun GlobalSearchResultItem( modifier = Modifier .padding( start = MaterialTheme.padding.medium, - end = MaterialTheme.padding.tiny, + end = MaterialTheme.padding.extraSmall, ) .fillMaxWidth() .clickable(onClick = onClick), diff --git a/app/src/main/java/eu/kanade/presentation/history/components/HistoryDialogs.kt b/app/src/main/java/eu/kanade/presentation/history/components/HistoryDialogs.kt index 2ab1922350..9aaaa6bdda 100644 --- a/app/src/main/java/eu/kanade/presentation/history/components/HistoryDialogs.kt +++ b/app/src/main/java/eu/kanade/presentation/history/components/HistoryDialogs.kt @@ -3,6 +3,7 @@ package eu.kanade.presentation.history.components import androidx.compose.foundation.layout.Arrangement import androidx.compose.foundation.layout.Column import androidx.compose.material3.AlertDialog +import androidx.compose.material3.MaterialTheme import androidx.compose.material3.Text import androidx.compose.material3.TextButton import androidx.compose.runtime.Composable @@ -11,10 +12,10 @@ import androidx.compose.runtime.mutableStateOf import androidx.compose.runtime.remember import androidx.compose.runtime.setValue import androidx.compose.ui.tooling.preview.PreviewLightDark -import androidx.compose.ui.unit.dp import eu.kanade.presentation.theme.TachiyomiTheme import tachiyomi.i18n.MR import tachiyomi.presentation.core.components.LabeledCheckbox +import tachiyomi.presentation.core.components.material.padding import tachiyomi.presentation.core.i18n.stringResource @Composable @@ -30,7 +31,7 @@ fun HistoryDeleteDialog( }, text = { Column( - verticalArrangement = Arrangement.spacedBy(8.dp), + verticalArrangement = Arrangement.spacedBy(MaterialTheme.padding.small), ) { Text(text = stringResource(MR.strings.dialog_with_checkbox_remove_description)) diff --git a/app/src/main/java/eu/kanade/presentation/manga/DuplicateMangaDialog.kt b/app/src/main/java/eu/kanade/presentation/manga/DuplicateMangaDialog.kt index a44a53b37b..e3ff20ad26 100644 --- a/app/src/main/java/eu/kanade/presentation/manga/DuplicateMangaDialog.kt +++ b/app/src/main/java/eu/kanade/presentation/manga/DuplicateMangaDialog.kt @@ -4,12 +4,13 @@ import androidx.compose.foundation.layout.Arrangement import androidx.compose.foundation.layout.FlowRow import androidx.compose.foundation.layout.Spacer import androidx.compose.material3.AlertDialog +import androidx.compose.material3.MaterialTheme import androidx.compose.material3.Text import androidx.compose.material3.TextButton import androidx.compose.runtime.Composable import androidx.compose.ui.Modifier -import androidx.compose.ui.unit.dp import tachiyomi.i18n.MR +import tachiyomi.presentation.core.components.material.padding import tachiyomi.presentation.core.i18n.stringResource @Composable @@ -28,7 +29,7 @@ fun DuplicateMangaDialog( }, confirmButton = { FlowRow( - horizontalArrangement = Arrangement.spacedBy(4.dp), + horizontalArrangement = Arrangement.spacedBy(MaterialTheme.padding.extraSmall), ) { TextButton( onClick = { diff --git a/app/src/main/java/eu/kanade/presentation/manga/components/BaseMangaListItem.kt b/app/src/main/java/eu/kanade/presentation/manga/components/BaseMangaListItem.kt index 0462396f5d..48952d8a8c 100644 --- a/app/src/main/java/eu/kanade/presentation/manga/components/BaseMangaListItem.kt +++ b/app/src/main/java/eu/kanade/presentation/manga/components/BaseMangaListItem.kt @@ -19,8 +19,8 @@ import tachiyomi.presentation.core.components.material.padding @Composable fun BaseMangaListItem( - modifier: Modifier = Modifier, manga: Manga, + modifier: Modifier = Modifier, onClickItem: () -> Unit = {}, onClickCover: () -> Unit = onClickItem, cover: @Composable RowScope.() -> Unit = { defaultCover(manga, onClickCover) }, diff --git a/app/src/main/java/eu/kanade/presentation/manga/components/ChapterHeader.kt b/app/src/main/java/eu/kanade/presentation/manga/components/ChapterHeader.kt index a193a190ed..99ad1b37a5 100644 --- a/app/src/main/java/eu/kanade/presentation/manga/components/ChapterHeader.kt +++ b/app/src/main/java/eu/kanade/presentation/manga/components/ChapterHeader.kt @@ -13,6 +13,7 @@ import androidx.compose.ui.text.style.TextOverflow import androidx.compose.ui.unit.dp import tachiyomi.i18n.MR import tachiyomi.presentation.core.components.material.SecondaryItemAlpha +import tachiyomi.presentation.core.components.material.padding import tachiyomi.presentation.core.i18n.pluralStringResource import tachiyomi.presentation.core.i18n.stringResource @@ -22,16 +23,17 @@ fun ChapterHeader( chapterCount: Int?, missingChapterCount: Int, onClick: () -> Unit, + modifier: Modifier = Modifier, ) { Column( - modifier = Modifier + modifier = modifier .fillMaxWidth() .clickable( enabled = enabled, onClick = onClick, ) .padding(horizontal = 16.dp, vertical = 4.dp), - verticalArrangement = Arrangement.spacedBy(4.dp), + verticalArrangement = Arrangement.spacedBy(MaterialTheme.padding.extraSmall), ) { Text( text = if (chapterCount == null) { diff --git a/app/src/main/java/eu/kanade/presentation/manga/components/DotSeparatorText.kt b/app/src/main/java/eu/kanade/presentation/manga/components/DotSeparatorText.kt index fd9fd09f7f..e1f3529999 100644 --- a/app/src/main/java/eu/kanade/presentation/manga/components/DotSeparatorText.kt +++ b/app/src/main/java/eu/kanade/presentation/manga/components/DotSeparatorText.kt @@ -2,13 +2,24 @@ package eu.kanade.presentation.manga.components import androidx.compose.material3.Text import androidx.compose.runtime.Composable +import androidx.compose.ui.Modifier @Composable -fun DotSeparatorText() { - Text(text = " • ") +fun DotSeparatorText( + modifier: Modifier = Modifier, +) { + Text( + text = " • ", + modifier = modifier, + ) } @Composable -fun DotSeparatorNoSpaceText() { - Text(text = "•") +fun DotSeparatorNoSpaceText( + modifier: Modifier = Modifier, +) { + Text( + text = "•", + modifier = modifier, + ) } diff --git a/app/src/main/java/eu/kanade/presentation/manga/components/MangaBottomActionMenu.kt b/app/src/main/java/eu/kanade/presentation/manga/components/MangaBottomActionMenu.kt index 905a457a63..8d409dab89 100644 --- a/app/src/main/java/eu/kanade/presentation/manga/components/MangaBottomActionMenu.kt +++ b/app/src/main/java/eu/kanade/presentation/manga/components/MangaBottomActionMenu.kt @@ -222,12 +222,12 @@ private fun RowScope.Button( @Composable fun LibraryBottomActionMenu( visible: Boolean, - modifier: Modifier = Modifier, onChangeCategoryClicked: () -> Unit, onMarkAsReadClicked: () -> Unit, onMarkAsUnreadClicked: () -> Unit, onDownloadClicked: ((DownloadAction) -> Unit)?, onDeleteClicked: () -> Unit, + modifier: Modifier = Modifier, ) { AnimatedVisibility( visible = visible, diff --git a/app/src/main/java/eu/kanade/presentation/manga/components/MangaCover.kt b/app/src/main/java/eu/kanade/presentation/manga/components/MangaCover.kt index 04794119c5..cfb4f5fcb1 100644 --- a/app/src/main/java/eu/kanade/presentation/manga/components/MangaCover.kt +++ b/app/src/main/java/eu/kanade/presentation/manga/components/MangaCover.kt @@ -22,8 +22,8 @@ enum class MangaCover(val ratio: Float) { @Composable operator fun invoke( - modifier: Modifier = Modifier, data: Any?, + modifier: Modifier = Modifier, contentDescription: String = "", shape: Shape = MaterialTheme.shapes.extraSmall, onClick: (() -> Unit)? = null, 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 5d33206b2d..7b5de24672 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 @@ -9,6 +9,7 @@ import androidx.compose.foundation.background import androidx.compose.foundation.layout.Arrangement import androidx.compose.foundation.layout.Box import androidx.compose.foundation.layout.Column +import androidx.compose.foundation.layout.ColumnScope import androidx.compose.foundation.layout.FlowRow import androidx.compose.foundation.layout.PaddingValues import androidx.compose.foundation.layout.Row @@ -283,7 +284,7 @@ fun ExpandableMangaDescription( if (expanded) { FlowRow( modifier = Modifier.padding(horizontal = 16.dp), - horizontalArrangement = Arrangement.spacedBy(4.dp), + horizontalArrangement = Arrangement.spacedBy(MaterialTheme.padding.extraSmall), ) { tags.forEach { TagsChip( @@ -299,7 +300,7 @@ fun ExpandableMangaDescription( } else { LazyRow( contentPadding = PaddingValues(horizontal = MaterialTheme.padding.medium), - horizontalArrangement = Arrangement.spacedBy(MaterialTheme.padding.tiny), + horizontalArrangement = Arrangement.spacedBy(MaterialTheme.padding.extraSmall), ) { items(items = tags) { TagsChip( @@ -402,7 +403,7 @@ private fun MangaAndSourceTitlesSmall( } @Composable -private fun MangaContentInfo( +private fun ColumnScope.MangaContentInfo( title: String, doSearch: (query: String, global: Boolean) -> Unit, author: String?, @@ -434,7 +435,7 @@ private fun MangaContentInfo( Row( modifier = Modifier.secondaryItemAlpha(), - horizontalArrangement = Arrangement.spacedBy(4.dp), + horizontalArrangement = Arrangement.spacedBy(MaterialTheme.padding.extraSmall), verticalAlignment = Alignment.CenterVertically, ) { Icon( @@ -465,7 +466,7 @@ private fun MangaContentInfo( if (!artist.isNullOrBlank() && author != artist) { Row( modifier = Modifier.secondaryItemAlpha(), - horizontalArrangement = Arrangement.spacedBy(4.dp), + horizontalArrangement = Arrangement.spacedBy(MaterialTheme.padding.extraSmall), verticalAlignment = Alignment.CenterVertically, ) { Icon( diff --git a/app/src/main/java/eu/kanade/presentation/more/NewUpdateScreen.kt b/app/src/main/java/eu/kanade/presentation/more/NewUpdateScreen.kt index 33656e3881..f3c8a433d3 100644 --- a/app/src/main/java/eu/kanade/presentation/more/NewUpdateScreen.kt +++ b/app/src/main/java/eu/kanade/presentation/more/NewUpdateScreen.kt @@ -59,7 +59,7 @@ fun NewUpdateScreen( modifier = Modifier.padding(top = MaterialTheme.padding.small), ) { Text(text = stringResource(MR.strings.update_check_open)) - Spacer(modifier = Modifier.width(MaterialTheme.padding.tiny)) + Spacer(modifier = Modifier.width(MaterialTheme.padding.extraSmall)) Icon(imageVector = Icons.AutoMirrored.Outlined.OpenInNew, contentDescription = null) } } diff --git a/app/src/main/java/eu/kanade/presentation/more/onboarding/GuidesStep.kt b/app/src/main/java/eu/kanade/presentation/more/onboarding/GuidesStep.kt index d1ac967fa4..3f44f51aa4 100644 --- a/app/src/main/java/eu/kanade/presentation/more/onboarding/GuidesStep.kt +++ b/app/src/main/java/eu/kanade/presentation/more/onboarding/GuidesStep.kt @@ -15,6 +15,7 @@ import androidx.compose.ui.tooling.preview.PreviewLightDark import androidx.compose.ui.unit.dp import eu.kanade.presentation.theme.TachiyomiTheme import tachiyomi.i18n.MR +import tachiyomi.presentation.core.components.material.padding import tachiyomi.presentation.core.i18n.stringResource internal class GuidesStep( @@ -29,7 +30,7 @@ internal class GuidesStep( Column( modifier = Modifier.padding(16.dp), - verticalArrangement = Arrangement.spacedBy(8.dp), + verticalArrangement = Arrangement.spacedBy(MaterialTheme.padding.small), ) { Text(stringResource(MR.strings.onboarding_guides_new_user, stringResource(MR.strings.app_name))) Button( diff --git a/app/src/main/java/eu/kanade/presentation/more/onboarding/StorageStep.kt b/app/src/main/java/eu/kanade/presentation/more/onboarding/StorageStep.kt index 74a1be4ae7..cb91daab58 100644 --- a/app/src/main/java/eu/kanade/presentation/more/onboarding/StorageStep.kt +++ b/app/src/main/java/eu/kanade/presentation/more/onboarding/StorageStep.kt @@ -5,6 +5,7 @@ import androidx.compose.foundation.layout.Arrangement import androidx.compose.foundation.layout.Column import androidx.compose.foundation.layout.fillMaxWidth import androidx.compose.foundation.layout.padding +import androidx.compose.material3.MaterialTheme import androidx.compose.material3.Text import androidx.compose.runtime.Composable import androidx.compose.runtime.LaunchedEffect @@ -20,6 +21,7 @@ import kotlinx.coroutines.flow.collectLatest import tachiyomi.domain.storage.service.StoragePreferences import tachiyomi.i18n.MR import tachiyomi.presentation.core.components.material.Button +import tachiyomi.presentation.core.components.material.padding import tachiyomi.presentation.core.i18n.stringResource import uy.kohesive.injekt.Injekt import uy.kohesive.injekt.api.get @@ -40,7 +42,7 @@ internal class StorageStep : OnboardingStep { Column( modifier = Modifier.padding(16.dp), - verticalArrangement = Arrangement.spacedBy(8.dp), + verticalArrangement = Arrangement.spacedBy(MaterialTheme.padding.small), ) { Text( stringResource( 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 f81f1ba5d3..d0ba0dd0ca 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 @@ -317,7 +317,7 @@ object SettingsTrackingScreen : SearchableSettings { ) }, confirmButton = { - Row(horizontalArrangement = Arrangement.spacedBy(MaterialTheme.padding.tiny)) { + Row(horizontalArrangement = Arrangement.spacedBy(MaterialTheme.padding.extraSmall)) { OutlinedButton( modifier = Modifier.weight(1f), onClick = onDismissRequest, diff --git a/app/src/main/java/eu/kanade/presentation/more/settings/screen/data/CreateBackupScreen.kt b/app/src/main/java/eu/kanade/presentation/more/settings/screen/data/CreateBackupScreen.kt index cf673b28d6..7b8e42d66d 100644 --- a/app/src/main/java/eu/kanade/presentation/more/settings/screen/data/CreateBackupScreen.kt +++ b/app/src/main/java/eu/kanade/presentation/more/settings/screen/data/CreateBackupScreen.kt @@ -87,6 +87,8 @@ class CreateBackupScreen : Screen() { } } + // TODO: separate sections for library and settings + item { LabeledCheckbox( label = stringResource(MR.strings.manga), diff --git a/app/src/main/java/eu/kanade/presentation/more/settings/screen/data/StorageInfo.kt b/app/src/main/java/eu/kanade/presentation/more/settings/screen/data/StorageInfo.kt index e45b6bafca..5fed6c6ef0 100644 --- a/app/src/main/java/eu/kanade/presentation/more/settings/screen/data/StorageInfo.kt +++ b/app/src/main/java/eu/kanade/presentation/more/settings/screen/data/StorageInfo.kt @@ -16,6 +16,7 @@ import androidx.compose.ui.platform.LocalContext import androidx.compose.ui.unit.dp import eu.kanade.tachiyomi.util.storage.DiskUtil import tachiyomi.i18n.MR +import tachiyomi.presentation.core.components.material.padding import tachiyomi.presentation.core.i18n.stringResource import tachiyomi.presentation.core.theme.header import tachiyomi.presentation.core.util.secondaryItemAlpha @@ -30,7 +31,7 @@ fun StorageInfo( Column( modifier = modifier, - verticalArrangement = Arrangement.spacedBy(8.dp), + verticalArrangement = Arrangement.spacedBy(MaterialTheme.padding.small), ) { storages.forEach { StorageInfo(it) @@ -50,7 +51,7 @@ private fun StorageInfo( val totalText = remember(total) { Formatter.formatFileSize(context, total) } Column( - verticalArrangement = Arrangement.spacedBy(4.dp), + verticalArrangement = Arrangement.spacedBy(MaterialTheme.padding.extraSmall), ) { Text( text = file.absolutePath, diff --git a/app/src/main/java/eu/kanade/presentation/more/stats/StatsScreenContent.kt b/app/src/main/java/eu/kanade/presentation/more/stats/StatsScreenContent.kt index a24b4cb640..415f72ae5f 100644 --- a/app/src/main/java/eu/kanade/presentation/more/stats/StatsScreenContent.kt +++ b/app/src/main/java/eu/kanade/presentation/more/stats/StatsScreenContent.kt @@ -6,7 +6,7 @@ import androidx.compose.foundation.layout.PaddingValues import androidx.compose.foundation.layout.Row import androidx.compose.foundation.layout.height import androidx.compose.foundation.lazy.LazyColumn -import androidx.compose.foundation.lazy.rememberLazyListState +import androidx.compose.foundation.lazy.LazyItemScope import androidx.compose.material.icons.Icons import androidx.compose.material.icons.outlined.CollectionsBookmark import androidx.compose.material.icons.outlined.LocalLibrary @@ -18,10 +18,10 @@ import androidx.compose.ui.Modifier import androidx.compose.ui.platform.LocalContext import eu.kanade.presentation.more.stats.components.StatsItem import eu.kanade.presentation.more.stats.components.StatsOverviewItem -import eu.kanade.presentation.more.stats.components.StatsSection import eu.kanade.presentation.more.stats.data.StatsData import eu.kanade.presentation.util.toDurationString import tachiyomi.i18n.MR +import tachiyomi.presentation.core.components.SectionCard import tachiyomi.presentation.core.components.material.padding import tachiyomi.presentation.core.i18n.stringResource import java.util.Locale @@ -33,9 +33,7 @@ fun StatsScreenContent( state: StatsScreenState.Success, paddingValues: PaddingValues, ) { - val statListState = rememberLazyListState() LazyColumn( - state = statListState, contentPadding = paddingValues, verticalArrangement = Arrangement.spacedBy(MaterialTheme.padding.small), ) { @@ -55,7 +53,7 @@ fun StatsScreenContent( } @Composable -private fun OverviewSection( +private fun LazyItemScope.OverviewSection( data: StatsData.Overview, ) { val none = stringResource(MR.strings.none) @@ -65,7 +63,7 @@ private fun OverviewSection( .toDuration(DurationUnit.MILLISECONDS) .toDurationString(context, fallback = none) } - StatsSection(MR.strings.label_overview_section) { + SectionCard(MR.strings.label_overview_section) { Row( modifier = Modifier.height(IntrinsicSize.Min), ) { @@ -89,10 +87,10 @@ private fun OverviewSection( } @Composable -private fun TitlesStats( +private fun LazyItemScope.TitlesStats( data: StatsData.Titles, ) { - StatsSection(MR.strings.label_titles_section) { + SectionCard(MR.strings.label_titles_section) { Row { StatsItem( data.globalUpdateItemCount.toString(), @@ -111,10 +109,10 @@ private fun TitlesStats( } @Composable -private fun ChapterStats( +private fun LazyItemScope.ChapterStats( data: StatsData.Chapters, ) { - StatsSection(MR.strings.chapters) { + SectionCard(MR.strings.chapters) { Row { StatsItem( data.totalChapterCount.toString(), @@ -133,7 +131,7 @@ private fun ChapterStats( } @Composable -private fun TrackerStats( +private fun LazyItemScope.TrackerStats( data: StatsData.Trackers, ) { val notApplicable = stringResource(MR.strings.not_applicable) @@ -145,7 +143,7 @@ private fun TrackerStats( notApplicable } } - StatsSection(MR.strings.label_tracker_section) { + SectionCard(MR.strings.label_tracker_section) { Row { StatsItem( data.trackedTitleCount.toString(), diff --git a/app/src/main/java/eu/kanade/presentation/reader/appbars/ReaderAppBars.kt b/app/src/main/java/eu/kanade/presentation/reader/appbars/ReaderAppBars.kt index 06ba7e7e2a..9641724837 100644 --- a/app/src/main/java/eu/kanade/presentation/reader/appbars/ReaderAppBars.kt +++ b/app/src/main/java/eu/kanade/presentation/reader/appbars/ReaderAppBars.kt @@ -29,6 +29,7 @@ import eu.kanade.tachiyomi.ui.reader.viewer.Viewer import eu.kanade.tachiyomi.ui.reader.viewer.pager.R2LPagerViewer import kotlinx.collections.immutable.persistentListOf import tachiyomi.i18n.MR +import tachiyomi.presentation.core.components.material.padding import tachiyomi.presentation.core.i18n.stringResource private val animationSpec = tween(200) @@ -156,7 +157,7 @@ fun ReaderAppBars( ) { Column( modifier = modifierWithInsetsPadding, - verticalArrangement = Arrangement.spacedBy(8.dp), + verticalArrangement = Arrangement.spacedBy(MaterialTheme.padding.small), ) { ChapterNavigator( isRtl = isRtl, diff --git a/app/src/main/java/eu/kanade/presentation/reader/components/ModeSelectionDialog.kt b/app/src/main/java/eu/kanade/presentation/reader/components/ModeSelectionDialog.kt index 14635e50f4..683534e9af 100644 --- a/app/src/main/java/eu/kanade/presentation/reader/components/ModeSelectionDialog.kt +++ b/app/src/main/java/eu/kanade/presentation/reader/components/ModeSelectionDialog.kt @@ -10,6 +10,7 @@ import androidx.compose.material.icons.Icons import androidx.compose.material.icons.outlined.Check import androidx.compose.material3.FilledTonalButton import androidx.compose.material3.Icon +import androidx.compose.material3.MaterialTheme import androidx.compose.material3.OutlinedButton import androidx.compose.material3.Surface import androidx.compose.material3.Text @@ -21,6 +22,7 @@ import androidx.compose.ui.unit.dp import eu.kanade.presentation.theme.TachiyomiTheme import tachiyomi.i18n.MR import tachiyomi.presentation.core.components.SettingsItemsPaddings +import tachiyomi.presentation.core.components.material.padding import tachiyomi.presentation.core.i18n.stringResource @Composable @@ -50,7 +52,7 @@ fun ModeSelectionDialog( onClick = onApply, ) { Row( - horizontalArrangement = Arrangement.spacedBy(8.dp), + horizontalArrangement = Arrangement.spacedBy(MaterialTheme.padding.small), verticalAlignment = Alignment.CenterVertically, ) { Icon( diff --git a/app/src/main/java/eu/kanade/presentation/track/TrackerSearch.kt b/app/src/main/java/eu/kanade/presentation/track/TrackerSearch.kt index ea5a810104..3ed269e2f5 100644 --- a/app/src/main/java/eu/kanade/presentation/track/TrackerSearch.kt +++ b/app/src/main/java/eu/kanade/presentation/track/TrackerSearch.kt @@ -309,7 +309,7 @@ private fun SearchResultItemDetails( title: String, text: String, ) { - Row(horizontalArrangement = Arrangement.spacedBy(MaterialTheme.padding.tiny)) { + Row(horizontalArrangement = Arrangement.spacedBy(MaterialTheme.padding.extraSmall)) { Text( text = title, maxLines = 1, diff --git a/app/src/main/java/eu/kanade/tachiyomi/ui/browse/migration/search/MigrateDialog.kt b/app/src/main/java/eu/kanade/tachiyomi/ui/browse/migration/search/MigrateDialog.kt index fb43e676a7..d6b70381bf 100644 --- a/app/src/main/java/eu/kanade/tachiyomi/ui/browse/migration/search/MigrateDialog.kt +++ b/app/src/main/java/eu/kanade/tachiyomi/ui/browse/migration/search/MigrateDialog.kt @@ -19,7 +19,6 @@ import androidx.compose.runtime.remember import androidx.compose.runtime.rememberCoroutineScope import androidx.compose.runtime.toMutableStateList import androidx.compose.ui.Modifier -import androidx.compose.ui.unit.dp import cafe.adriel.voyager.core.model.StateScreenModel import eu.kanade.domain.chapter.interactor.SyncChaptersWithSource import eu.kanade.domain.manga.interactor.UpdateManga @@ -49,6 +48,7 @@ import tachiyomi.domain.track.interactor.GetTracks import tachiyomi.domain.track.interactor.InsertTrack import tachiyomi.i18n.MR import tachiyomi.presentation.core.components.LabeledCheckbox +import tachiyomi.presentation.core.components.material.padding import tachiyomi.presentation.core.i18n.stringResource import tachiyomi.presentation.core.screens.LoadingScreen import uy.kohesive.injekt.Injekt @@ -96,7 +96,7 @@ internal fun MigrateDialog( }, confirmButton = { FlowRow( - horizontalArrangement = Arrangement.spacedBy(4.dp), + horizontalArrangement = Arrangement.spacedBy(MaterialTheme.padding.extraSmall), ) { TextButton( onClick = { 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 9ad9f5bb2e..9f08bb5dca 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 @@ -30,7 +30,6 @@ import androidx.compose.ui.Modifier import androidx.compose.ui.platform.LocalContext 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.rememberScreenModel @@ -759,7 +758,7 @@ private data class TrackerRemoveScreen( }, text = { Column( - verticalArrangement = Arrangement.spacedBy(8.dp), + verticalArrangement = Arrangement.spacedBy(MaterialTheme.padding.small), ) { Text( text = stringResource(MR.strings.track_delete_text, serviceName), diff --git a/presentation-core/src/main/java/tachiyomi/presentation/core/components/ActionButton.kt b/presentation-core/src/main/java/tachiyomi/presentation/core/components/ActionButton.kt index 4aa09cde56..dd24a973ab 100644 --- a/presentation-core/src/main/java/tachiyomi/presentation/core/components/ActionButton.kt +++ b/presentation-core/src/main/java/tachiyomi/presentation/core/components/ActionButton.kt @@ -3,6 +3,7 @@ package tachiyomi.presentation.core.components import androidx.compose.foundation.layout.Arrangement import androidx.compose.foundation.layout.Column import androidx.compose.material3.Icon +import androidx.compose.material3.MaterialTheme import androidx.compose.material3.Text import androidx.compose.material3.TextButton import androidx.compose.runtime.Composable @@ -10,7 +11,7 @@ import androidx.compose.ui.Alignment import androidx.compose.ui.Modifier import androidx.compose.ui.graphics.vector.ImageVector import androidx.compose.ui.text.style.TextAlign -import androidx.compose.ui.unit.dp +import tachiyomi.presentation.core.components.material.padding @Composable fun ActionButton( @@ -24,7 +25,7 @@ fun ActionButton( onClick = onClick, ) { Column( - verticalArrangement = Arrangement.spacedBy(4.dp), + verticalArrangement = Arrangement.spacedBy(MaterialTheme.padding.extraSmall), horizontalAlignment = Alignment.CenterHorizontally, ) { Icon( diff --git a/presentation-core/src/main/java/tachiyomi/presentation/core/components/LabeledCheckbox.kt b/presentation-core/src/main/java/tachiyomi/presentation/core/components/LabeledCheckbox.kt index e402938414..b4a7fb1d8a 100644 --- a/presentation-core/src/main/java/tachiyomi/presentation/core/components/LabeledCheckbox.kt +++ b/presentation-core/src/main/java/tachiyomi/presentation/core/components/LabeledCheckbox.kt @@ -14,6 +14,7 @@ import androidx.compose.ui.Modifier import androidx.compose.ui.draw.clip import androidx.compose.ui.semantics.Role import androidx.compose.ui.unit.dp +import tachiyomi.presentation.core.components.material.padding @Composable fun LabeledCheckbox( @@ -33,7 +34,7 @@ fun LabeledCheckbox( onClick = { onCheckedChange(!checked) }, ), verticalAlignment = Alignment.CenterVertically, - horizontalArrangement = Arrangement.spacedBy(8.dp), + horizontalArrangement = Arrangement.spacedBy(MaterialTheme.padding.small), ) { Checkbox( checked = checked, diff --git a/app/src/main/java/eu/kanade/presentation/more/stats/components/StatsSection.kt b/presentation-core/src/main/java/tachiyomi/presentation/core/components/SectionCard.kt similarity index 70% rename from app/src/main/java/eu/kanade/presentation/more/stats/components/StatsSection.kt rename to presentation-core/src/main/java/tachiyomi/presentation/core/components/SectionCard.kt index d5795fab24..2cbd6e7dcf 100644 --- a/app/src/main/java/eu/kanade/presentation/more/stats/components/StatsSection.kt +++ b/presentation-core/src/main/java/tachiyomi/presentation/core/components/SectionCard.kt @@ -1,8 +1,9 @@ -package eu.kanade.presentation.more.stats.components +package tachiyomi.presentation.core.components import androidx.compose.foundation.layout.Column import androidx.compose.foundation.layout.fillMaxWidth import androidx.compose.foundation.layout.padding +import androidx.compose.foundation.lazy.LazyItemScope import androidx.compose.material3.ElevatedCard import androidx.compose.material3.MaterialTheme import androidx.compose.material3.Text @@ -13,15 +14,18 @@ import tachiyomi.presentation.core.components.material.padding import tachiyomi.presentation.core.i18n.stringResource @Composable -fun StatsSection( - titleRes: StringResource, +fun LazyItemScope.SectionCard( + titleRes: StringResource? = null, content: @Composable () -> Unit, ) { - Text( - modifier = Modifier.padding(horizontal = MaterialTheme.padding.extraLarge), - text = stringResource(titleRes), - style = MaterialTheme.typography.titleSmall, - ) + if (titleRes != null) { + Text( + modifier = Modifier.padding(horizontal = MaterialTheme.padding.extraLarge), + text = stringResource(titleRes), + style = MaterialTheme.typography.titleSmall, + ) + } + ElevatedCard( modifier = Modifier .fillMaxWidth() diff --git a/presentation-core/src/main/java/tachiyomi/presentation/core/components/SettingsItems.kt b/presentation-core/src/main/java/tachiyomi/presentation/core/components/SettingsItems.kt index 0094dbcd70..d29d44b88d 100644 --- a/presentation-core/src/main/java/tachiyomi/presentation/core/components/SettingsItems.kt +++ b/presentation-core/src/main/java/tachiyomi/presentation/core/components/SettingsItems.kt @@ -345,7 +345,7 @@ fun SettingsIconGrid(labelRes: StringResource, content: LazyGridScope.() -> Unit end = SettingsItemsPaddings.Horizontal, bottom = SettingsItemsPaddings.Vertical, ), - verticalArrangement = Arrangement.spacedBy(MaterialTheme.padding.tiny), + verticalArrangement = Arrangement.spacedBy(MaterialTheme.padding.extraSmall), horizontalArrangement = Arrangement.spacedBy(MaterialTheme.padding.small), content = content, ) diff --git a/presentation-core/src/main/java/tachiyomi/presentation/core/components/material/Constants.kt b/presentation-core/src/main/java/tachiyomi/presentation/core/components/material/Constants.kt index 32249fe5ba..d86bece61e 100644 --- a/presentation-core/src/main/java/tachiyomi/presentation/core/components/material/Constants.kt +++ b/presentation-core/src/main/java/tachiyomi/presentation/core/components/material/Constants.kt @@ -19,7 +19,7 @@ class Padding { val small = 8.dp - val tiny = 4.dp + val extraSmall = 4.dp } val MaterialTheme.padding: Padding diff --git a/presentation-core/src/main/java/tachiyomi/presentation/core/components/material/NavigationRail.kt b/presentation-core/src/main/java/tachiyomi/presentation/core/components/material/NavigationRail.kt index 39c00895b3..e33f6e4fea 100644 --- a/presentation-core/src/main/java/tachiyomi/presentation/core/components/material/NavigationRail.kt +++ b/presentation-core/src/main/java/tachiyomi/presentation/core/components/material/NavigationRail.kt @@ -45,11 +45,11 @@ fun NavigationRail( .fillMaxHeight() .windowInsetsPadding(windowInsets) .widthIn(min = 80.dp) - .padding(vertical = MaterialTheme.padding.tiny) + .padding(vertical = MaterialTheme.padding.extraSmall) .selectableGroup(), horizontalAlignment = Alignment.CenterHorizontally, verticalArrangement = Arrangement.spacedBy( - MaterialTheme.padding.tiny, + MaterialTheme.padding.extraSmall, alignment = Alignment.CenterVertically, ), ) {