From e6ca54fd04668fde5ae12429101a13dc1f03b99e Mon Sep 17 00:00:00 2001 From: arkon Date: Sun, 5 Nov 2023 10:34:19 -0500 Subject: [PATCH] Replace custom preview annotation --- .../presentation/components/EmptyScreen.kt | 6 +-- .../kanade/presentation/crash/CrashScreen.kt | 4 +- .../presentation/history/HistoryScreen.kt | 4 +- .../history/components/HistoryDialogs.kt | 4 +- .../history/components/HistoryItem.kt | 19 ++++++---- .../library/components/LibraryBadges.kt | 4 +- .../presentation/more/NewUpdateScreen.kt | 4 +- .../widget/AppThemePreferenceWidget.kt | 16 ++++---- .../more/settings/widget/InfoWidget.kt | 4 +- .../settings/widget/SwitchPreferenceWidget.kt | 4 +- .../settings/widget/TextPreferenceWidget.kt | 4 +- .../presentation/reader/ChapterTransition.kt | 12 +++--- .../reader/OrientationSelectDialog.kt | 15 +++++--- .../presentation/reader/PageIndicatorText.kt | 9 +++-- .../reader/ReadingModeSelectDialog.kt | 15 +++++--- .../presentation/track/TrackInfoDialogHome.kt | 11 ++++-- .../track/TrackInfoDialogSelector.kt | 37 ++++++++++--------- .../presentation/track/TrackerSearch.kt | 4 +- .../track/components/TrackLogoIcon.kt | 4 +- .../presentation/core/screens/InfoScreen.kt | 4 +- .../presentation/core/util/ThemePreviews.kt | 15 -------- 21 files changed, 103 insertions(+), 96 deletions(-) delete mode 100644 presentation-core/src/main/java/tachiyomi/presentation/core/util/ThemePreviews.kt 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 fad8fd650..def969a39 100644 --- a/app/src/main/java/eu/kanade/presentation/components/EmptyScreen.kt +++ b/app/src/main/java/eu/kanade/presentation/components/EmptyScreen.kt @@ -5,13 +5,13 @@ import androidx.compose.material.icons.outlined.HelpOutline import androidx.compose.material.icons.outlined.Refresh import androidx.compose.material3.Surface import androidx.compose.runtime.Composable +import androidx.compose.ui.tooling.preview.PreviewLightDark import eu.kanade.presentation.theme.TachiyomiTheme import eu.kanade.tachiyomi.R import tachiyomi.presentation.core.screens.EmptyScreen import tachiyomi.presentation.core.screens.EmptyScreenAction -import tachiyomi.presentation.core.util.ThemePreviews -@ThemePreviews +@PreviewLightDark @Composable private fun NoActionPreview() { TachiyomiTheme { @@ -23,7 +23,7 @@ private fun NoActionPreview() { } } -@ThemePreviews +@PreviewLightDark @Composable private fun WithActionPreview() { TachiyomiTheme { diff --git a/app/src/main/java/eu/kanade/presentation/crash/CrashScreen.kt b/app/src/main/java/eu/kanade/presentation/crash/CrashScreen.kt index 3ed6d15fc..932f02e16 100644 --- a/app/src/main/java/eu/kanade/presentation/crash/CrashScreen.kt +++ b/app/src/main/java/eu/kanade/presentation/crash/CrashScreen.kt @@ -14,13 +14,13 @@ import androidx.compose.ui.Modifier import androidx.compose.ui.draw.clip import androidx.compose.ui.platform.LocalContext import androidx.compose.ui.res.stringResource +import androidx.compose.ui.tooling.preview.PreviewLightDark import eu.kanade.presentation.theme.TachiyomiTheme import eu.kanade.tachiyomi.R import eu.kanade.tachiyomi.util.CrashLogUtil import kotlinx.coroutines.launch import tachiyomi.presentation.core.components.material.padding import tachiyomi.presentation.core.screens.InfoScreen -import tachiyomi.presentation.core.util.ThemePreviews @Composable fun CrashScreen( @@ -60,7 +60,7 @@ fun CrashScreen( } } -@ThemePreviews +@PreviewLightDark @Composable private fun CrashScreenPreview() { TachiyomiTheme { diff --git a/app/src/main/java/eu/kanade/presentation/history/HistoryScreen.kt b/app/src/main/java/eu/kanade/presentation/history/HistoryScreen.kt index b2ffb6e5e..08db8aa24 100644 --- a/app/src/main/java/eu/kanade/presentation/history/HistoryScreen.kt +++ b/app/src/main/java/eu/kanade/presentation/history/HistoryScreen.kt @@ -11,6 +11,7 @@ import androidx.compose.runtime.Composable import androidx.compose.runtime.remember import androidx.compose.ui.Modifier import androidx.compose.ui.res.stringResource +import androidx.compose.ui.tooling.preview.PreviewLightDark import androidx.compose.ui.tooling.preview.PreviewParameter import eu.kanade.domain.ui.UiPreferences import eu.kanade.presentation.components.AppBar @@ -28,7 +29,6 @@ import tachiyomi.presentation.core.components.FastScrollLazyColumn import tachiyomi.presentation.core.components.material.Scaffold import tachiyomi.presentation.core.screens.EmptyScreen import tachiyomi.presentation.core.screens.LoadingScreen -import tachiyomi.presentation.core.util.ThemePreviews import uy.kohesive.injekt.Injekt import uy.kohesive.injekt.api.get import java.util.Date @@ -148,7 +148,7 @@ sealed interface HistoryUiModel { data class Item(val item: HistoryWithRelations) : HistoryUiModel } -@ThemePreviews +@PreviewLightDark @Composable internal fun HistoryScreenPreviews( @PreviewParameter(HistoryScreenModelStateProvider::class) 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 0ceab8f61..5e9027ba0 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 @@ -11,11 +11,11 @@ import androidx.compose.runtime.mutableStateOf import androidx.compose.runtime.remember import androidx.compose.runtime.setValue import androidx.compose.ui.res.stringResource +import androidx.compose.ui.tooling.preview.PreviewLightDark import androidx.compose.ui.unit.dp import eu.kanade.presentation.theme.TachiyomiTheme import eu.kanade.tachiyomi.R import tachiyomi.presentation.core.components.LabeledCheckbox -import tachiyomi.presentation.core.util.ThemePreviews @Composable fun HistoryDeleteDialog( @@ -87,7 +87,7 @@ fun HistoryDeleteAllDialog( ) } -@ThemePreviews +@PreviewLightDark @Composable private fun HistoryDeleteDialogPreview() { TachiyomiTheme { diff --git a/app/src/main/java/eu/kanade/presentation/history/components/HistoryItem.kt b/app/src/main/java/eu/kanade/presentation/history/components/HistoryItem.kt index cd37192f6..148a8e693 100644 --- a/app/src/main/java/eu/kanade/presentation/history/components/HistoryItem.kt +++ b/app/src/main/java/eu/kanade/presentation/history/components/HistoryItem.kt @@ -11,6 +11,7 @@ import androidx.compose.material.icons.outlined.Delete import androidx.compose.material3.Icon import androidx.compose.material3.IconButton import androidx.compose.material3.MaterialTheme +import androidx.compose.material3.Surface import androidx.compose.material3.Text import androidx.compose.runtime.Composable import androidx.compose.runtime.remember @@ -19,6 +20,7 @@ import androidx.compose.ui.Modifier import androidx.compose.ui.res.stringResource import androidx.compose.ui.text.font.FontWeight import androidx.compose.ui.text.style.TextOverflow +import androidx.compose.ui.tooling.preview.PreviewLightDark import androidx.compose.ui.tooling.preview.PreviewParameter import androidx.compose.ui.unit.dp import eu.kanade.presentation.manga.components.MangaCover @@ -28,7 +30,6 @@ import eu.kanade.tachiyomi.R import eu.kanade.tachiyomi.util.lang.toTimestampString import tachiyomi.domain.history.model.HistoryWithRelations import tachiyomi.presentation.core.components.material.padding -import tachiyomi.presentation.core.util.ThemePreviews private val HistoryItemHeight = 96.dp @@ -91,18 +92,20 @@ fun HistoryItem( } } -@ThemePreviews +@PreviewLightDark @Composable private fun HistoryItemPreviews( @PreviewParameter(HistoryWithRelationsProvider::class) historyWithRelations: HistoryWithRelations, ) { TachiyomiTheme { - HistoryItem( - history = historyWithRelations, - onClickCover = {}, - onClickResume = {}, - onClickDelete = {}, - ) + Surface { + HistoryItem( + history = historyWithRelations, + onClickCover = {}, + onClickResume = {}, + onClickDelete = {}, + ) + } } } diff --git a/app/src/main/java/eu/kanade/presentation/library/components/LibraryBadges.kt b/app/src/main/java/eu/kanade/presentation/library/components/LibraryBadges.kt index 0ab1a3c28..608edb8f4 100644 --- a/app/src/main/java/eu/kanade/presentation/library/components/LibraryBadges.kt +++ b/app/src/main/java/eu/kanade/presentation/library/components/LibraryBadges.kt @@ -5,9 +5,9 @@ import androidx.compose.material.icons.Icons import androidx.compose.material.icons.outlined.Folder import androidx.compose.material3.MaterialTheme import androidx.compose.runtime.Composable +import androidx.compose.ui.tooling.preview.PreviewLightDark import eu.kanade.presentation.theme.TachiyomiTheme import tachiyomi.presentation.core.components.Badge -import tachiyomi.presentation.core.util.ThemePreviews @Composable internal fun DownloadsBadge(count: Long) { @@ -47,7 +47,7 @@ internal fun LanguageBadge( } } -@ThemePreviews +@PreviewLightDark @Composable private fun BadgePreview() { TachiyomiTheme { 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 5e1c4d7ce..0cd661e85 100644 --- a/app/src/main/java/eu/kanade/presentation/more/NewUpdateScreen.kt +++ b/app/src/main/java/eu/kanade/presentation/more/NewUpdateScreen.kt @@ -15,6 +15,7 @@ import androidx.compose.runtime.Composable import androidx.compose.ui.Modifier import androidx.compose.ui.res.stringResource import androidx.compose.ui.text.SpanStyle +import androidx.compose.ui.tooling.preview.PreviewLightDark import com.halilibo.richtext.markdown.Markdown import com.halilibo.richtext.ui.RichTextStyle import com.halilibo.richtext.ui.material3.Material3RichText @@ -23,7 +24,6 @@ import eu.kanade.presentation.theme.TachiyomiTheme import eu.kanade.tachiyomi.R import tachiyomi.presentation.core.components.material.padding import tachiyomi.presentation.core.screens.InfoScreen -import tachiyomi.presentation.core.util.ThemePreviews @Composable fun NewUpdateScreen( @@ -66,7 +66,7 @@ fun NewUpdateScreen( } } -@ThemePreviews +@PreviewLightDark @Composable private fun NewUpdateScreenPreview() { TachiyomiTheme { 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 fef522408..484bb52eb 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 @@ -38,6 +38,7 @@ import androidx.compose.ui.draw.alpha import androidx.compose.ui.draw.clip import androidx.compose.ui.res.stringResource import androidx.compose.ui.text.style.TextAlign +import androidx.compose.ui.tooling.preview.PreviewLightDark import androidx.compose.ui.unit.dp import eu.kanade.domain.ui.model.AppTheme import eu.kanade.presentation.manga.components.MangaCover @@ -46,7 +47,6 @@ import eu.kanade.tachiyomi.R import eu.kanade.tachiyomi.util.system.DeviceUtil import eu.kanade.tachiyomi.util.system.isDynamicColorAvailable import tachiyomi.presentation.core.components.material.padding -import tachiyomi.presentation.core.util.ThemePreviews import tachiyomi.presentation.core.util.secondaryItemAlpha @Composable @@ -249,15 +249,17 @@ fun AppThemePreviewItem( } } -@ThemePreviews +@PreviewLightDark @Composable private fun AppThemesListPreview() { var appTheme by remember { mutableStateOf(AppTheme.DEFAULT) } TachiyomiTheme { - AppThemesList( - currentTheme = appTheme, - amoled = false, - onItemClick = { appTheme = it }, - ) + Surface { + AppThemesList( + currentTheme = appTheme, + amoled = false, + onItemClick = { appTheme = it }, + ) + } } } 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 1183414e2..2dbb54be0 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,10 +12,10 @@ 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.tooling.preview.PreviewLightDark import eu.kanade.presentation.theme.TachiyomiTheme import eu.kanade.tachiyomi.R import tachiyomi.presentation.core.components.material.padding -import tachiyomi.presentation.core.util.ThemePreviews import tachiyomi.presentation.core.util.secondaryItemAlpha @Composable @@ -40,7 +40,7 @@ internal fun InfoWidget(text: String) { } } -@ThemePreviews +@PreviewLightDark @Composable private fun InfoWidgetPreview() { TachiyomiTheme { diff --git a/app/src/main/java/eu/kanade/presentation/more/settings/widget/SwitchPreferenceWidget.kt b/app/src/main/java/eu/kanade/presentation/more/settings/widget/SwitchPreferenceWidget.kt index 7de5c68d3..bc026d3ba 100644 --- a/app/src/main/java/eu/kanade/presentation/more/settings/widget/SwitchPreferenceWidget.kt +++ b/app/src/main/java/eu/kanade/presentation/more/settings/widget/SwitchPreferenceWidget.kt @@ -9,8 +9,8 @@ import androidx.compose.material3.Switch import androidx.compose.runtime.Composable import androidx.compose.ui.Modifier import androidx.compose.ui.graphics.vector.ImageVector +import androidx.compose.ui.tooling.preview.PreviewLightDark import eu.kanade.presentation.theme.TachiyomiTheme -import tachiyomi.presentation.core.util.ThemePreviews @Composable fun SwitchPreferenceWidget( @@ -37,7 +37,7 @@ fun SwitchPreferenceWidget( ) } -@ThemePreviews +@PreviewLightDark @Composable private fun SwitchPreferenceWidgetPreview() { TachiyomiTheme { diff --git a/app/src/main/java/eu/kanade/presentation/more/settings/widget/TextPreferenceWidget.kt b/app/src/main/java/eu/kanade/presentation/more/settings/widget/TextPreferenceWidget.kt index bd8ac4593..05bd7f85d 100644 --- a/app/src/main/java/eu/kanade/presentation/more/settings/widget/TextPreferenceWidget.kt +++ b/app/src/main/java/eu/kanade/presentation/more/settings/widget/TextPreferenceWidget.kt @@ -12,8 +12,8 @@ import androidx.compose.runtime.Composable import androidx.compose.ui.Modifier import androidx.compose.ui.graphics.Color import androidx.compose.ui.graphics.vector.ImageVector +import androidx.compose.ui.tooling.preview.PreviewLightDark import eu.kanade.presentation.theme.TachiyomiTheme -import tachiyomi.presentation.core.util.ThemePreviews import tachiyomi.presentation.core.util.secondaryItemAlpha @Composable @@ -59,7 +59,7 @@ fun TextPreferenceWidget( ) } -@ThemePreviews +@PreviewLightDark @Composable private fun TextPreferenceWidgetPreview() { TachiyomiTheme { diff --git a/app/src/main/java/eu/kanade/presentation/reader/ChapterTransition.kt b/app/src/main/java/eu/kanade/presentation/reader/ChapterTransition.kt index a153b37b1..cb6ca9a8b 100644 --- a/app/src/main/java/eu/kanade/presentation/reader/ChapterTransition.kt +++ b/app/src/main/java/eu/kanade/presentation/reader/ChapterTransition.kt @@ -32,6 +32,7 @@ import androidx.compose.ui.text.Placeholder import androidx.compose.ui.text.PlaceholderVerticalAlign import androidx.compose.ui.text.buildAnnotatedString import androidx.compose.ui.text.style.TextOverflow +import androidx.compose.ui.tooling.preview.PreviewLightDark import androidx.compose.ui.unit.dp import androidx.compose.ui.unit.sp import eu.kanade.presentation.theme.TachiyomiTheme @@ -42,7 +43,6 @@ import eu.kanade.tachiyomi.data.database.models.toDomainChapter import eu.kanade.tachiyomi.ui.reader.model.ChapterTransition import eu.kanade.tachiyomi.ui.reader.model.ReaderChapter import tachiyomi.domain.chapter.service.calculateChapterGap -import tachiyomi.presentation.core.util.ThemePreviews import tachiyomi.presentation.core.util.secondaryItemAlpha @Composable @@ -304,7 +304,7 @@ private val FakeChapterLongTitle = previewChapter( chapterNumber = 1f, ) -@ThemePreviews +@PreviewLightDark @Composable private fun TransitionTextPreview() { TachiyomiTheme { @@ -318,7 +318,7 @@ private fun TransitionTextPreview() { } } -@ThemePreviews +@PreviewLightDark @Composable private fun TransitionTextLongTitlePreview() { TachiyomiTheme { @@ -332,7 +332,7 @@ private fun TransitionTextLongTitlePreview() { } } -@ThemePreviews +@PreviewLightDark @Composable private fun TransitionTextWithGapPreview() { TachiyomiTheme { @@ -346,7 +346,7 @@ private fun TransitionTextWithGapPreview() { } } -@ThemePreviews +@PreviewLightDark @Composable private fun TransitionTextNoNextPreview() { TachiyomiTheme { @@ -360,7 +360,7 @@ private fun TransitionTextNoNextPreview() { } } -@ThemePreviews +@PreviewLightDark @Composable private fun TransitionTextNoPreviousPreview() { TachiyomiTheme { diff --git a/app/src/main/java/eu/kanade/presentation/reader/OrientationSelectDialog.kt b/app/src/main/java/eu/kanade/presentation/reader/OrientationSelectDialog.kt index 08a08c08b..3d0e1143e 100644 --- a/app/src/main/java/eu/kanade/presentation/reader/OrientationSelectDialog.kt +++ b/app/src/main/java/eu/kanade/presentation/reader/OrientationSelectDialog.kt @@ -4,6 +4,7 @@ import androidx.compose.foundation.layout.Box import androidx.compose.foundation.layout.fillMaxWidth import androidx.compose.foundation.layout.padding import androidx.compose.foundation.lazy.grid.items +import androidx.compose.material3.Surface import androidx.compose.runtime.Composable import androidx.compose.runtime.collectAsState import androidx.compose.runtime.getValue @@ -12,6 +13,7 @@ import androidx.compose.ui.Modifier import androidx.compose.ui.graphics.vector.ImageVector import androidx.compose.ui.res.stringResource import androidx.compose.ui.res.vectorResource +import androidx.compose.ui.tooling.preview.PreviewLightDark import androidx.compose.ui.unit.dp import eu.kanade.domain.manga.model.readerOrientation import eu.kanade.presentation.components.AdaptiveSheet @@ -21,7 +23,6 @@ import eu.kanade.tachiyomi.ui.reader.setting.ReaderOrientation import eu.kanade.tachiyomi.ui.reader.setting.ReaderSettingsScreenModel import tachiyomi.presentation.core.components.SettingsIconGrid import tachiyomi.presentation.core.components.material.IconToggleButton -import tachiyomi.presentation.core.util.ThemePreviews @Composable fun OrientationSelectDialog( @@ -66,13 +67,15 @@ private fun DialogContent( } } -@ThemePreviews +@PreviewLightDark @Composable private fun DialogContentPreview() { TachiyomiTheme { - DialogContent( - orientation = ReaderOrientation.DEFAULT, - onChangeOrientation = {}, - ) + Surface { + DialogContent( + orientation = ReaderOrientation.DEFAULT, + onChangeOrientation = {}, + ) + } } } diff --git a/app/src/main/java/eu/kanade/presentation/reader/PageIndicatorText.kt b/app/src/main/java/eu/kanade/presentation/reader/PageIndicatorText.kt index 470a731c8..ab2b05095 100644 --- a/app/src/main/java/eu/kanade/presentation/reader/PageIndicatorText.kt +++ b/app/src/main/java/eu/kanade/presentation/reader/PageIndicatorText.kt @@ -2,6 +2,7 @@ package eu.kanade.presentation.reader import androidx.compose.foundation.layout.Box import androidx.compose.material3.MaterialTheme +import androidx.compose.material3.Surface import androidx.compose.material3.Text import androidx.compose.runtime.Composable import androidx.compose.ui.Alignment @@ -9,9 +10,9 @@ import androidx.compose.ui.graphics.Color import androidx.compose.ui.graphics.drawscope.Stroke import androidx.compose.ui.text.TextStyle import androidx.compose.ui.text.font.FontWeight +import androidx.compose.ui.tooling.preview.PreviewLightDark import androidx.compose.ui.unit.sp import eu.kanade.presentation.theme.TachiyomiTheme -import tachiyomi.presentation.core.util.ThemePreviews @Composable fun PageIndicatorText( @@ -47,10 +48,12 @@ fun PageIndicatorText( } } -@ThemePreviews +@PreviewLightDark @Composable private fun PageIndicatorTextPreview() { TachiyomiTheme { - PageIndicatorText(currentPage = 10, totalPages = 69) + Surface { + PageIndicatorText(currentPage = 10, totalPages = 69) + } } } diff --git a/app/src/main/java/eu/kanade/presentation/reader/ReadingModeSelectDialog.kt b/app/src/main/java/eu/kanade/presentation/reader/ReadingModeSelectDialog.kt index 2d976f92a..e9a669e17 100644 --- a/app/src/main/java/eu/kanade/presentation/reader/ReadingModeSelectDialog.kt +++ b/app/src/main/java/eu/kanade/presentation/reader/ReadingModeSelectDialog.kt @@ -5,6 +5,7 @@ import androidx.compose.foundation.layout.fillMaxWidth import androidx.compose.foundation.layout.padding import androidx.compose.foundation.lazy.grid.items import androidx.compose.material3.MaterialTheme +import androidx.compose.material3.Surface import androidx.compose.runtime.Composable import androidx.compose.runtime.collectAsState import androidx.compose.runtime.getValue @@ -13,6 +14,7 @@ import androidx.compose.ui.Modifier import androidx.compose.ui.graphics.vector.ImageVector import androidx.compose.ui.res.stringResource import androidx.compose.ui.res.vectorResource +import androidx.compose.ui.tooling.preview.PreviewLightDark import eu.kanade.domain.manga.model.readingMode import eu.kanade.presentation.components.AdaptiveSheet import eu.kanade.presentation.theme.TachiyomiTheme @@ -22,7 +24,6 @@ import eu.kanade.tachiyomi.ui.reader.setting.ReadingMode import tachiyomi.presentation.core.components.SettingsIconGrid import tachiyomi.presentation.core.components.material.IconToggleButton import tachiyomi.presentation.core.components.material.padding -import tachiyomi.presentation.core.util.ThemePreviews @Composable fun ReadingModeSelectDialog( @@ -67,13 +68,15 @@ private fun DialogContent( } } -@ThemePreviews +@PreviewLightDark @Composable private fun DialogContentPreview() { TachiyomiTheme { - DialogContent( - readingMode = ReadingMode.DEFAULT, - onChangeReadingMode = {}, - ) + Surface { + DialogContent( + readingMode = ReadingMode.DEFAULT, + onChangeReadingMode = {}, + ) + } } } diff --git a/app/src/main/java/eu/kanade/presentation/track/TrackInfoDialogHome.kt b/app/src/main/java/eu/kanade/presentation/track/TrackInfoDialogHome.kt index d0b31ca06..7125adbc0 100644 --- a/app/src/main/java/eu/kanade/presentation/track/TrackInfoDialogHome.kt +++ b/app/src/main/java/eu/kanade/presentation/track/TrackInfoDialogHome.kt @@ -28,6 +28,7 @@ import androidx.compose.material3.HorizontalDivider import androidx.compose.material3.Icon import androidx.compose.material3.IconButton import androidx.compose.material3.MaterialTheme +import androidx.compose.material3.Surface import androidx.compose.material3.Text import androidx.compose.material3.TextButton import androidx.compose.material3.VerticalDivider @@ -44,6 +45,7 @@ import androidx.compose.ui.platform.LocalContext import androidx.compose.ui.res.stringResource import androidx.compose.ui.text.style.TextAlign import androidx.compose.ui.text.style.TextOverflow +import androidx.compose.ui.tooling.preview.PreviewLightDark import androidx.compose.ui.tooling.preview.PreviewParameter import androidx.compose.ui.unit.dp import eu.kanade.domain.track.model.toDbTrack @@ -54,7 +56,6 @@ import eu.kanade.tachiyomi.R import eu.kanade.tachiyomi.data.track.Tracker import eu.kanade.tachiyomi.ui.manga.track.TrackItem import eu.kanade.tachiyomi.util.system.copyToClipboard -import tachiyomi.presentation.core.util.ThemePreviews import java.text.DateFormat private const val UnsetStatusTextAlpha = 0.5F @@ -318,11 +319,15 @@ private fun TrackInfoItemMenu( } } -@ThemePreviews +@PreviewLightDark @Composable private fun TrackInfoDialogHomePreviews( @PreviewParameter(TrackInfoDialogHomePreviewProvider::class) content: @Composable () -> Unit, ) { - TachiyomiTheme { content() } + TachiyomiTheme { + Surface { + content() + } + } } diff --git a/app/src/main/java/eu/kanade/presentation/track/TrackInfoDialogSelector.kt b/app/src/main/java/eu/kanade/presentation/track/TrackInfoDialogSelector.kt index b3afd2b28..012fc0466 100644 --- a/app/src/main/java/eu/kanade/presentation/track/TrackInfoDialogSelector.kt +++ b/app/src/main/java/eu/kanade/presentation/track/TrackInfoDialogSelector.kt @@ -20,6 +20,7 @@ import androidx.compose.material3.HorizontalDivider import androidx.compose.material3.MaterialTheme import androidx.compose.material3.RadioButton import androidx.compose.material3.SelectableDates +import androidx.compose.material3.Surface import androidx.compose.material3.Text import androidx.compose.material3.TextButton import androidx.compose.material3.minimumInteractiveComponentSize @@ -29,6 +30,7 @@ import androidx.compose.ui.Alignment import androidx.compose.ui.Modifier import androidx.compose.ui.draw.clip import androidx.compose.ui.res.stringResource +import androidx.compose.ui.tooling.preview.PreviewLightDark import androidx.compose.ui.unit.dp import eu.kanade.presentation.theme.TachiyomiTheme import eu.kanade.tachiyomi.R @@ -37,7 +39,6 @@ import tachiyomi.presentation.core.components.WheelNumberPicker import tachiyomi.presentation.core.components.WheelTextPicker import tachiyomi.presentation.core.components.material.AlertDialogContent import tachiyomi.presentation.core.components.material.padding -import tachiyomi.presentation.core.util.ThemePreviews import tachiyomi.presentation.core.util.isScrolledToEnd import tachiyomi.presentation.core.util.isScrolledToStart @@ -221,24 +222,26 @@ private fun BaseSelector( ) } -@ThemePreviews +@PreviewLightDark @Composable private fun TrackStatusSelectorPreviews() { TachiyomiTheme { - TrackStatusSelector( - selection = 1, - onSelectionChange = {}, - selections = mapOf( - // Anilist values - 1 to R.string.reading, - 2 to R.string.plan_to_read, - 3 to R.string.completed, - 4 to R.string.on_hold, - 5 to R.string.dropped, - 6 to R.string.repeating, - ), - onConfirm = {}, - onDismissRequest = {}, - ) + Surface { + TrackStatusSelector( + selection = 1, + onSelectionChange = {}, + selections = mapOf( + // Anilist values + 1 to R.string.reading, + 2 to R.string.plan_to_read, + 3 to R.string.completed, + 4 to R.string.on_hold, + 5 to R.string.dropped, + 6 to R.string.repeating, + ), + onConfirm = {}, + onDismissRequest = {}, + ) + } } } 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 df11b1ce1..63f2f3917 100644 --- a/app/src/main/java/eu/kanade/presentation/track/TrackerSearch.kt +++ b/app/src/main/java/eu/kanade/presentation/track/TrackerSearch.kt @@ -56,6 +56,7 @@ import androidx.compose.ui.text.input.TextFieldValue import androidx.compose.ui.text.intl.Locale import androidx.compose.ui.text.style.TextOverflow import androidx.compose.ui.text.toLowerCase +import androidx.compose.ui.tooling.preview.PreviewLightDark import androidx.compose.ui.tooling.preview.PreviewParameter import androidx.compose.ui.unit.dp import eu.kanade.presentation.manga.components.MangaCover @@ -67,7 +68,6 @@ import tachiyomi.presentation.core.components.material.Scaffold import tachiyomi.presentation.core.components.material.padding import tachiyomi.presentation.core.screens.EmptyScreen import tachiyomi.presentation.core.screens.LoadingScreen -import tachiyomi.presentation.core.util.ThemePreviews import tachiyomi.presentation.core.util.plus import tachiyomi.presentation.core.util.runOnEnterKeyPressed import tachiyomi.presentation.core.util.secondaryItemAlpha @@ -319,7 +319,7 @@ private fun SearchResultItemDetails( } } -@ThemePreviews +@PreviewLightDark @Composable private fun TrackerSearchPreviews( @PreviewParameter(TrackerSearchPreviewProvider::class) diff --git a/app/src/main/java/eu/kanade/presentation/track/components/TrackLogoIcon.kt b/app/src/main/java/eu/kanade/presentation/track/components/TrackLogoIcon.kt index 63b7c6d02..835cce95c 100644 --- a/app/src/main/java/eu/kanade/presentation/track/components/TrackLogoIcon.kt +++ b/app/src/main/java/eu/kanade/presentation/track/components/TrackLogoIcon.kt @@ -11,11 +11,11 @@ import androidx.compose.ui.Alignment import androidx.compose.ui.Modifier import androidx.compose.ui.graphics.Color import androidx.compose.ui.res.painterResource +import androidx.compose.ui.tooling.preview.PreviewLightDark import androidx.compose.ui.tooling.preview.PreviewParameter import androidx.compose.ui.unit.dp import eu.kanade.presentation.theme.TachiyomiTheme import eu.kanade.tachiyomi.data.track.Tracker -import tachiyomi.presentation.core.util.ThemePreviews import tachiyomi.presentation.core.util.clickableNoIndication @Composable @@ -43,7 +43,7 @@ fun TrackLogoIcon( } } -@ThemePreviews +@PreviewLightDark @Composable private fun TrackLogoIconPreviews( @PreviewParameter(TrackLogoIconPreviewProvider::class) diff --git a/presentation-core/src/main/java/tachiyomi/presentation/core/screens/InfoScreen.kt b/presentation-core/src/main/java/tachiyomi/presentation/core/screens/InfoScreen.kt index 74f8211d9..b1a57a50e 100644 --- a/presentation-core/src/main/java/tachiyomi/presentation/core/screens/InfoScreen.kt +++ b/presentation-core/src/main/java/tachiyomi/presentation/core/screens/InfoScreen.kt @@ -23,12 +23,12 @@ import androidx.compose.ui.Modifier import androidx.compose.ui.draw.drawBehind import androidx.compose.ui.geometry.Offset import androidx.compose.ui.graphics.vector.ImageVector +import androidx.compose.ui.tooling.preview.PreviewLightDark import androidx.compose.ui.unit.Dp import androidx.compose.ui.unit.dp import androidx.compose.ui.zIndex import tachiyomi.presentation.core.components.material.Scaffold import tachiyomi.presentation.core.components.material.padding -import tachiyomi.presentation.core.util.ThemePreviews import tachiyomi.presentation.core.util.secondaryItemAlpha @Composable @@ -121,7 +121,7 @@ fun InfoScreen( } } -@ThemePreviews +@PreviewLightDark @Composable private fun InfoScaffoldPreview() { InfoScreen( diff --git a/presentation-core/src/main/java/tachiyomi/presentation/core/util/ThemePreviews.kt b/presentation-core/src/main/java/tachiyomi/presentation/core/util/ThemePreviews.kt deleted file mode 100644 index 21dc9cabc..000000000 --- a/presentation-core/src/main/java/tachiyomi/presentation/core/util/ThemePreviews.kt +++ /dev/null @@ -1,15 +0,0 @@ -package tachiyomi.presentation.core.util - -import android.content.res.Configuration -import androidx.compose.ui.tooling.preview.Preview - -@Preview( - name = "Light", - showBackground = true, -) -@Preview( - name = "Dark", - showBackground = true, - uiMode = Configuration.UI_MODE_NIGHT_YES, -) -annotation class ThemePreviews