From 721bd79ce1806d5b94276af52d39b986edca8946 Mon Sep 17 00:00:00 2001 From: michaelbel Date: Mon, 22 Jul 2024 23:02:47 +0300 Subject: [PATCH] Update project --- .../provider/BooleanPreviewParameterProvider.kt | 7 ------- .../org/michaelbel/movies/ui/compose/AccountAvatar.kt | 4 +++- .../movies/ui/compose/iconbutton/PasswordIcon.kt | 4 +++- .../michaelbel/movies/ui/compose/movie/MovieColumn.kt | 4 +++- .../movies/ui/compose/movie/MovieColumnDesktop.kt | 4 +++- .../michaelbel/movies/ui/compose/movie/MovieRow.kt | 4 +++- .../movies/ui/compose/movie/MovieRowDesktop.kt | 4 +++- .../ui/preview}/AccountPreviewParameterProvider.kt | 4 ++-- .../ui/preview}/AppearancePreviewParameterProvider.kt | 4 ++-- .../ui/preview/BooleanPreviewParameterProvider.kt | 7 +++++++ .../ui/preview}/IconAliasPreviewParameterProvider.kt | 4 ++-- .../ui/preview}/MovieDbPreviewParameterProvider.kt | 7 ++++--- .../ui/preview}/MovieListPreviewParameterProvider.kt | 4 ++-- .../ui/preview}/MoviePreviewParameterProvider.kt | 7 ++++--- .../preview}/SuggestionDbPreviewParameterProvider.kt | 4 ++-- .../ui/preview}/ThemePreviewParameterProvider.kt | 4 ++-- .../ui/preview}/TitlePreviewParameterProvider.kt | 4 ++-- .../ui/preview}/VersionPreviewParameterProvider.kt | 4 ++-- .../base/CollectionPreviewParameterProvider.kt | 11 +++++++++++ .../movies/details/ui/DetailsContent.android.kt | 6 +++--- .../michaelbel/movies/details/ui/DetailsToolbar.kt | 4 +++- .../movies/search/ui/SearchRe\321\201entResult.kt" | 6 +++--- .../michaelbel/movies/search/ui/SearchSuggestion.kt | 6 +++--- .../org/michaelbel/movies/search/ui/SearchToolbar.kt | 6 +++--- .../movies/settings/ui/SettingsVersionBox.kt | 4 +++- .../movies/settings/ui/common/SettingAppIcon.kt | 4 +++- .../movies/settings/ui/common/SettingDialog.kt | 4 +++- .../movies/settings/ui/common/SettingSwitchItem.kt | 4 +++- 28 files changed, 87 insertions(+), 52 deletions(-) delete mode 100644 core/ui/src/androidMain/kotlin/org/michaelbel/movies/ui/preview/provider/BooleanPreviewParameterProvider.kt rename core/ui/src/{androidMain/kotlin/org/michaelbel/movies/ui/preview/provider => commonMain/kotlin/org/michaelbel/movies/ui/preview}/AccountPreviewParameterProvider.kt (75%) rename core/ui/src/{androidMain/kotlin/org/michaelbel/movies/ui/preview/provider => commonMain/kotlin/org/michaelbel/movies/ui/preview}/AppearancePreviewParameterProvider.kt (53%) create mode 100644 core/ui/src/commonMain/kotlin/org/michaelbel/movies/ui/preview/BooleanPreviewParameterProvider.kt rename core/ui/src/{androidMain/kotlin/org/michaelbel/movies/ui/preview/provider => commonMain/kotlin/org/michaelbel/movies/ui/preview}/IconAliasPreviewParameterProvider.kt (52%) rename core/ui/src/{androidMain/kotlin/org/michaelbel/movies/ui/preview/provider => commonMain/kotlin/org/michaelbel/movies/ui/preview}/MovieDbPreviewParameterProvider.kt (82%) rename core/ui/src/{androidMain/kotlin/org/michaelbel/movies/ui/preview/provider => commonMain/kotlin/org/michaelbel/movies/ui/preview}/MovieListPreviewParameterProvider.kt (53%) rename core/ui/src/{androidMain/kotlin/org/michaelbel/movies/ui/preview/provider => commonMain/kotlin/org/michaelbel/movies/ui/preview}/MoviePreviewParameterProvider.kt (83%) rename core/ui/src/{androidMain/kotlin/org/michaelbel/movies/ui/preview/provider => commonMain/kotlin/org/michaelbel/movies/ui/preview}/SuggestionDbPreviewParameterProvider.kt (82%) rename core/ui/src/{androidMain/kotlin/org/michaelbel/movies/ui/preview/provider => commonMain/kotlin/org/michaelbel/movies/ui/preview}/ThemePreviewParameterProvider.kt (52%) rename core/ui/src/{androidMain/kotlin/org/michaelbel/movies/ui/preview/provider => commonMain/kotlin/org/michaelbel/movies/ui/preview}/TitlePreviewParameterProvider.kt (57%) rename core/ui/src/{androidMain/kotlin/org/michaelbel/movies/ui/preview/provider => commonMain/kotlin/org/michaelbel/movies/ui/preview}/VersionPreviewParameterProvider.kt (71%) create mode 100644 core/ui/src/commonMain/kotlin/org/michaelbel/movies/ui/preview/base/CollectionPreviewParameterProvider.kt diff --git a/core/ui/src/androidMain/kotlin/org/michaelbel/movies/ui/preview/provider/BooleanPreviewParameterProvider.kt b/core/ui/src/androidMain/kotlin/org/michaelbel/movies/ui/preview/provider/BooleanPreviewParameterProvider.kt deleted file mode 100644 index 31e2cfa77..000000000 --- a/core/ui/src/androidMain/kotlin/org/michaelbel/movies/ui/preview/provider/BooleanPreviewParameterProvider.kt +++ /dev/null @@ -1,7 +0,0 @@ -package org.michaelbel.movies.ui.preview.provider - -import androidx.compose.ui.tooling.preview.datasource.CollectionPreviewParameterProvider - -class BooleanPreviewParameterProvider: CollectionPreviewParameterProvider( - listOf(true, false) -) \ No newline at end of file diff --git a/core/ui/src/commonMain/kotlin/org/michaelbel/movies/ui/compose/AccountAvatar.kt b/core/ui/src/commonMain/kotlin/org/michaelbel/movies/ui/compose/AccountAvatar.kt index a5d3b9ebd..705c367b2 100644 --- a/core/ui/src/commonMain/kotlin/org/michaelbel/movies/ui/compose/AccountAvatar.kt +++ b/core/ui/src/commonMain/kotlin/org/michaelbel/movies/ui/compose/AccountAvatar.kt @@ -19,10 +19,12 @@ import coil3.request.ImageRequest import coil3.request.crossfade import org.jetbrains.compose.resources.stringResource import org.jetbrains.compose.ui.tooling.preview.Preview +import org.jetbrains.compose.ui.tooling.preview.PreviewParameter import org.michaelbel.movies.persistence.database.entity.pojo.AccountPojo import org.michaelbel.movies.persistence.database.ktx.letters import org.michaelbel.movies.ui.accessibility.MoviesContentDescriptionCommon import org.michaelbel.movies.ui.ktx.lettersTextFontSizeSmall +import org.michaelbel.movies.ui.preview.AccountPreviewParameterProvider import org.michaelbel.movies.ui.theme.MoviesTheme @Composable @@ -62,7 +64,7 @@ fun AccountAvatar( @Preview @Composable private fun AccountAvatarPreview( - /*@PreviewParameter(AccountPreviewParameterProvider::class)*/ account: AccountPojo + @PreviewParameter(AccountPreviewParameterProvider::class) account: AccountPojo ) { MoviesTheme { AccountAvatar( diff --git a/core/ui/src/commonMain/kotlin/org/michaelbel/movies/ui/compose/iconbutton/PasswordIcon.kt b/core/ui/src/commonMain/kotlin/org/michaelbel/movies/ui/compose/iconbutton/PasswordIcon.kt index 2aef54072..5addee861 100644 --- a/core/ui/src/commonMain/kotlin/org/michaelbel/movies/ui/compose/iconbutton/PasswordIcon.kt +++ b/core/ui/src/commonMain/kotlin/org/michaelbel/movies/ui/compose/iconbutton/PasswordIcon.kt @@ -9,8 +9,10 @@ import androidx.compose.ui.Modifier import androidx.compose.ui.graphics.ColorFilter import org.jetbrains.compose.resources.stringResource import org.jetbrains.compose.ui.tooling.preview.Preview +import org.jetbrains.compose.ui.tooling.preview.PreviewParameter import org.michaelbel.movies.ui.accessibility.MoviesContentDescriptionCommon import org.michaelbel.movies.ui.icons.MoviesIcons +import org.michaelbel.movies.ui.preview.BooleanPreviewParameterProvider import org.michaelbel.movies.ui.theme.MoviesTheme @Composable @@ -34,7 +36,7 @@ fun PasswordIcon( @Preview @Composable private fun PasswordIconPreview( - /*@PreviewParameter(BooleanPreviewParameterProvider::class)*/ state: Boolean + @PreviewParameter(BooleanPreviewParameterProvider::class) state: Boolean ) { MoviesTheme { PasswordIcon( diff --git a/core/ui/src/commonMain/kotlin/org/michaelbel/movies/ui/compose/movie/MovieColumn.kt b/core/ui/src/commonMain/kotlin/org/michaelbel/movies/ui/compose/movie/MovieColumn.kt index 27e0093b7..a23ee8d4c 100644 --- a/core/ui/src/commonMain/kotlin/org/michaelbel/movies/ui/compose/movie/MovieColumn.kt +++ b/core/ui/src/commonMain/kotlin/org/michaelbel/movies/ui/compose/movie/MovieColumn.kt @@ -27,10 +27,12 @@ import movies.core.ui.generated.resources.Res import movies.core.ui.generated.resources.no_image import org.jetbrains.compose.resources.stringResource import org.jetbrains.compose.ui.tooling.preview.Preview +import org.jetbrains.compose.ui.tooling.preview.PreviewParameter import org.michaelbel.movies.network.config.formatPosterImage import org.michaelbel.movies.persistence.database.entity.pojo.MoviePojo import org.michaelbel.movies.ui.accessibility.MoviesContentDescriptionCommon import org.michaelbel.movies.ui.ktx.isErrorOrEmpty +import org.michaelbel.movies.ui.preview.MoviePreviewParameterProvider import org.michaelbel.movies.ui.theme.MoviesTheme @Composable @@ -103,7 +105,7 @@ internal fun MovieColumn( @Preview @Composable private fun MovieColumnPreview( - /*@PreviewParameter(MoviePreviewParameterProvider::class)*/ movie: MoviePojo + @PreviewParameter(MoviePreviewParameterProvider::class) movie: MoviePojo ) { MoviesTheme { MovieColumn( diff --git a/core/ui/src/commonMain/kotlin/org/michaelbel/movies/ui/compose/movie/MovieColumnDesktop.kt b/core/ui/src/commonMain/kotlin/org/michaelbel/movies/ui/compose/movie/MovieColumnDesktop.kt index 51326965f..692945f0d 100644 --- a/core/ui/src/commonMain/kotlin/org/michaelbel/movies/ui/compose/movie/MovieColumnDesktop.kt +++ b/core/ui/src/commonMain/kotlin/org/michaelbel/movies/ui/compose/movie/MovieColumnDesktop.kt @@ -29,10 +29,12 @@ import movies.core.ui.generated.resources.Res import movies.core.ui.generated.resources.no_image import org.jetbrains.compose.resources.stringResource import org.jetbrains.compose.ui.tooling.preview.Preview +import org.jetbrains.compose.ui.tooling.preview.PreviewParameter import org.michaelbel.movies.network.config.formatPosterImage import org.michaelbel.movies.persistence.database.entity.pojo.MoviePojo import org.michaelbel.movies.ui.accessibility.MoviesContentDescriptionCommon import org.michaelbel.movies.ui.ktx.isErrorOrEmpty +import org.michaelbel.movies.ui.preview.MoviePreviewParameterProvider import org.michaelbel.movies.ui.theme.MoviesTheme @Composable @@ -105,7 +107,7 @@ internal fun MovieColumnDesktop( @Preview @Composable private fun MovieColumnDesktopPreview( - /*@PreviewParameter(MoviePreviewParameterProvider::class)*/ movie: MoviePojo + @PreviewParameter(MoviePreviewParameterProvider::class) movie: MoviePojo ) { MoviesTheme { MovieColumnDesktop( diff --git a/core/ui/src/commonMain/kotlin/org/michaelbel/movies/ui/compose/movie/MovieRow.kt b/core/ui/src/commonMain/kotlin/org/michaelbel/movies/ui/compose/movie/MovieRow.kt index dc7a891d3..e9fac0d8d 100644 --- a/core/ui/src/commonMain/kotlin/org/michaelbel/movies/ui/compose/movie/MovieRow.kt +++ b/core/ui/src/commonMain/kotlin/org/michaelbel/movies/ui/compose/movie/MovieRow.kt @@ -25,10 +25,12 @@ import coil3.request.ImageRequest import coil3.request.crossfade import org.jetbrains.compose.resources.stringResource import org.jetbrains.compose.ui.tooling.preview.Preview +import org.jetbrains.compose.ui.tooling.preview.PreviewParameter import org.michaelbel.movies.network.config.formatBackdropImage import org.michaelbel.movies.persistence.database.entity.pojo.MoviePojo import org.michaelbel.movies.ui.accessibility.MoviesContentDescriptionCommon import org.michaelbel.movies.ui.ktx.isErrorOrEmpty +import org.michaelbel.movies.ui.preview.MoviePreviewParameterProvider import org.michaelbel.movies.ui.strings.MoviesStrings import org.michaelbel.movies.ui.theme.MoviesTheme @@ -103,7 +105,7 @@ internal fun MovieRow( @Preview @Composable private fun MovieRowPreview( - /*@PreviewParameter(MoviePreviewParameterProvider::class)*/ movie: MoviePojo + @PreviewParameter(MoviePreviewParameterProvider::class) movie: MoviePojo ) { MoviesTheme { MovieRow( diff --git a/core/ui/src/commonMain/kotlin/org/michaelbel/movies/ui/compose/movie/MovieRowDesktop.kt b/core/ui/src/commonMain/kotlin/org/michaelbel/movies/ui/compose/movie/MovieRowDesktop.kt index c5f0e0d14..8f4b45750 100644 --- a/core/ui/src/commonMain/kotlin/org/michaelbel/movies/ui/compose/movie/MovieRowDesktop.kt +++ b/core/ui/src/commonMain/kotlin/org/michaelbel/movies/ui/compose/movie/MovieRowDesktop.kt @@ -27,10 +27,12 @@ import coil3.request.ImageRequest import coil3.request.crossfade import org.jetbrains.compose.resources.stringResource import org.jetbrains.compose.ui.tooling.preview.Preview +import org.jetbrains.compose.ui.tooling.preview.PreviewParameter import org.michaelbel.movies.network.config.formatBackdropImage import org.michaelbel.movies.persistence.database.entity.pojo.MoviePojo import org.michaelbel.movies.ui.accessibility.MoviesContentDescriptionCommon import org.michaelbel.movies.ui.ktx.isErrorOrEmpty +import org.michaelbel.movies.ui.preview.MoviePreviewParameterProvider import org.michaelbel.movies.ui.strings.MoviesStrings import org.michaelbel.movies.ui.theme.MoviesTheme @@ -105,7 +107,7 @@ internal fun MovieRowDesktop( @Preview @Composable private fun MovieRowDesktopPreview( - /*@PreviewParameter(MoviePreviewParameterProvider::class)*/ movie: MoviePojo + @PreviewParameter(MoviePreviewParameterProvider::class) movie: MoviePojo ) { MoviesTheme { MovieRowDesktop( diff --git a/core/ui/src/androidMain/kotlin/org/michaelbel/movies/ui/preview/provider/AccountPreviewParameterProvider.kt b/core/ui/src/commonMain/kotlin/org/michaelbel/movies/ui/preview/AccountPreviewParameterProvider.kt similarity index 75% rename from core/ui/src/androidMain/kotlin/org/michaelbel/movies/ui/preview/provider/AccountPreviewParameterProvider.kt rename to core/ui/src/commonMain/kotlin/org/michaelbel/movies/ui/preview/AccountPreviewParameterProvider.kt index 6c3bb632a..0d43c7b96 100644 --- a/core/ui/src/androidMain/kotlin/org/michaelbel/movies/ui/preview/provider/AccountPreviewParameterProvider.kt +++ b/core/ui/src/commonMain/kotlin/org/michaelbel/movies/ui/preview/AccountPreviewParameterProvider.kt @@ -1,7 +1,7 @@ -package org.michaelbel.movies.ui.preview.provider +package org.michaelbel.movies.ui.preview -import androidx.compose.ui.tooling.preview.datasource.CollectionPreviewParameterProvider import org.michaelbel.movies.persistence.database.entity.pojo.AccountPojo +import org.michaelbel.movies.ui.preview.base.CollectionPreviewParameterProvider class AccountPreviewParameterProvider: CollectionPreviewParameterProvider( listOf( diff --git a/core/ui/src/androidMain/kotlin/org/michaelbel/movies/ui/preview/provider/AppearancePreviewParameterProvider.kt b/core/ui/src/commonMain/kotlin/org/michaelbel/movies/ui/preview/AppearancePreviewParameterProvider.kt similarity index 53% rename from core/ui/src/androidMain/kotlin/org/michaelbel/movies/ui/preview/provider/AppearancePreviewParameterProvider.kt rename to core/ui/src/commonMain/kotlin/org/michaelbel/movies/ui/preview/AppearancePreviewParameterProvider.kt index 8a3de6fae..bbc344a27 100644 --- a/core/ui/src/androidMain/kotlin/org/michaelbel/movies/ui/preview/provider/AppearancePreviewParameterProvider.kt +++ b/core/ui/src/commonMain/kotlin/org/michaelbel/movies/ui/preview/AppearancePreviewParameterProvider.kt @@ -1,6 +1,6 @@ -package org.michaelbel.movies.ui.preview.provider +package org.michaelbel.movies.ui.preview -import androidx.compose.ui.tooling.preview.datasource.CollectionPreviewParameterProvider import org.michaelbel.movies.common.appearance.FeedView +import org.michaelbel.movies.ui.preview.base.CollectionPreviewParameterProvider class AppearancePreviewParameterProvider: CollectionPreviewParameterProvider(FeedView.VALUES) \ No newline at end of file diff --git a/core/ui/src/commonMain/kotlin/org/michaelbel/movies/ui/preview/BooleanPreviewParameterProvider.kt b/core/ui/src/commonMain/kotlin/org/michaelbel/movies/ui/preview/BooleanPreviewParameterProvider.kt new file mode 100644 index 000000000..80f23daa8 --- /dev/null +++ b/core/ui/src/commonMain/kotlin/org/michaelbel/movies/ui/preview/BooleanPreviewParameterProvider.kt @@ -0,0 +1,7 @@ +package org.michaelbel.movies.ui.preview + +import org.michaelbel.movies.ui.preview.base.CollectionPreviewParameterProvider + +class BooleanPreviewParameterProvider: CollectionPreviewParameterProvider( + listOf(true, false) +) \ No newline at end of file diff --git a/core/ui/src/androidMain/kotlin/org/michaelbel/movies/ui/preview/provider/IconAliasPreviewParameterProvider.kt b/core/ui/src/commonMain/kotlin/org/michaelbel/movies/ui/preview/IconAliasPreviewParameterProvider.kt similarity index 52% rename from core/ui/src/androidMain/kotlin/org/michaelbel/movies/ui/preview/provider/IconAliasPreviewParameterProvider.kt rename to core/ui/src/commonMain/kotlin/org/michaelbel/movies/ui/preview/IconAliasPreviewParameterProvider.kt index 4a2d87875..0860e9dd7 100644 --- a/core/ui/src/androidMain/kotlin/org/michaelbel/movies/ui/preview/provider/IconAliasPreviewParameterProvider.kt +++ b/core/ui/src/commonMain/kotlin/org/michaelbel/movies/ui/preview/IconAliasPreviewParameterProvider.kt @@ -1,6 +1,6 @@ -package org.michaelbel.movies.ui.preview.provider +package org.michaelbel.movies.ui.preview -import androidx.compose.ui.tooling.preview.datasource.CollectionPreviewParameterProvider import org.michaelbel.movies.ui.appicon.IconAlias +import org.michaelbel.movies.ui.preview.base.CollectionPreviewParameterProvider class IconAliasPreviewParameterProvider: CollectionPreviewParameterProvider(IconAlias.VALUES) \ No newline at end of file diff --git a/core/ui/src/androidMain/kotlin/org/michaelbel/movies/ui/preview/provider/MovieDbPreviewParameterProvider.kt b/core/ui/src/commonMain/kotlin/org/michaelbel/movies/ui/preview/MovieDbPreviewParameterProvider.kt similarity index 82% rename from core/ui/src/androidMain/kotlin/org/michaelbel/movies/ui/preview/provider/MovieDbPreviewParameterProvider.kt rename to core/ui/src/commonMain/kotlin/org/michaelbel/movies/ui/preview/MovieDbPreviewParameterProvider.kt index 2c44ca822..7738b568f 100644 --- a/core/ui/src/androidMain/kotlin/org/michaelbel/movies/ui/preview/provider/MovieDbPreviewParameterProvider.kt +++ b/core/ui/src/commonMain/kotlin/org/michaelbel/movies/ui/preview/MovieDbPreviewParameterProvider.kt @@ -1,14 +1,15 @@ -package org.michaelbel.movies.ui.preview.provider +package org.michaelbel.movies.ui.preview -import androidx.compose.ui.tooling.preview.datasource.CollectionPreviewParameterProvider +import kotlinx.datetime.Clock import org.michaelbel.movies.network.model.Movie import org.michaelbel.movies.persistence.database.entity.pojo.MoviePojo +import org.michaelbel.movies.ui.preview.base.CollectionPreviewParameterProvider class MovieDbPreviewParameterProvider: CollectionPreviewParameterProvider( listOf( MoviePojo( movieList = Movie.NOW_PLAYING, - dateAdded = System.currentTimeMillis(), + dateAdded = Clock.System.now().toEpochMilliseconds(), page = null, position = 0, movieId = 438148, diff --git a/core/ui/src/androidMain/kotlin/org/michaelbel/movies/ui/preview/provider/MovieListPreviewParameterProvider.kt b/core/ui/src/commonMain/kotlin/org/michaelbel/movies/ui/preview/MovieListPreviewParameterProvider.kt similarity index 53% rename from core/ui/src/androidMain/kotlin/org/michaelbel/movies/ui/preview/provider/MovieListPreviewParameterProvider.kt rename to core/ui/src/commonMain/kotlin/org/michaelbel/movies/ui/preview/MovieListPreviewParameterProvider.kt index e20a14757..f942015c9 100644 --- a/core/ui/src/androidMain/kotlin/org/michaelbel/movies/ui/preview/provider/MovieListPreviewParameterProvider.kt +++ b/core/ui/src/commonMain/kotlin/org/michaelbel/movies/ui/preview/MovieListPreviewParameterProvider.kt @@ -1,6 +1,6 @@ -package org.michaelbel.movies.ui.preview.provider +package org.michaelbel.movies.ui.preview -import androidx.compose.ui.tooling.preview.datasource.CollectionPreviewParameterProvider import org.michaelbel.movies.common.list.MovieList +import org.michaelbel.movies.ui.preview.base.CollectionPreviewParameterProvider class MovieListPreviewParameterProvider: CollectionPreviewParameterProvider(MovieList.VALUES) \ No newline at end of file diff --git a/core/ui/src/androidMain/kotlin/org/michaelbel/movies/ui/preview/provider/MoviePreviewParameterProvider.kt b/core/ui/src/commonMain/kotlin/org/michaelbel/movies/ui/preview/MoviePreviewParameterProvider.kt similarity index 83% rename from core/ui/src/androidMain/kotlin/org/michaelbel/movies/ui/preview/provider/MoviePreviewParameterProvider.kt rename to core/ui/src/commonMain/kotlin/org/michaelbel/movies/ui/preview/MoviePreviewParameterProvider.kt index 2ac266bff..0cf34d638 100644 --- a/core/ui/src/androidMain/kotlin/org/michaelbel/movies/ui/preview/provider/MoviePreviewParameterProvider.kt +++ b/core/ui/src/commonMain/kotlin/org/michaelbel/movies/ui/preview/MoviePreviewParameterProvider.kt @@ -1,14 +1,15 @@ -package org.michaelbel.movies.ui.preview.provider +package org.michaelbel.movies.ui.preview -import androidx.compose.ui.tooling.preview.datasource.CollectionPreviewParameterProvider +import kotlinx.datetime.Clock import org.michaelbel.movies.network.model.Movie import org.michaelbel.movies.persistence.database.entity.pojo.MoviePojo +import org.michaelbel.movies.ui.preview.base.CollectionPreviewParameterProvider class MoviePreviewParameterProvider: CollectionPreviewParameterProvider( listOf( MoviePojo( movieList = Movie.NOW_PLAYING, - dateAdded = System.currentTimeMillis(), + dateAdded = Clock.System.now().toEpochMilliseconds(), page = null, position = 0, movieId = 438148, diff --git a/core/ui/src/androidMain/kotlin/org/michaelbel/movies/ui/preview/provider/SuggestionDbPreviewParameterProvider.kt b/core/ui/src/commonMain/kotlin/org/michaelbel/movies/ui/preview/SuggestionDbPreviewParameterProvider.kt similarity index 82% rename from core/ui/src/androidMain/kotlin/org/michaelbel/movies/ui/preview/provider/SuggestionDbPreviewParameterProvider.kt rename to core/ui/src/commonMain/kotlin/org/michaelbel/movies/ui/preview/SuggestionDbPreviewParameterProvider.kt index 2ae2c040b..20659dcac 100644 --- a/core/ui/src/androidMain/kotlin/org/michaelbel/movies/ui/preview/provider/SuggestionDbPreviewParameterProvider.kt +++ b/core/ui/src/commonMain/kotlin/org/michaelbel/movies/ui/preview/SuggestionDbPreviewParameterProvider.kt @@ -1,7 +1,7 @@ -package org.michaelbel.movies.ui.preview.provider +package org.michaelbel.movies.ui.preview -import androidx.compose.ui.tooling.preview.datasource.CollectionPreviewParameterProvider import org.michaelbel.movies.persistence.database.entity.pojo.SuggestionPojo +import org.michaelbel.movies.ui.preview.base.CollectionPreviewParameterProvider class SuggestionDbPreviewParameterProvider: CollectionPreviewParameterProvider>( listOf( diff --git a/core/ui/src/androidMain/kotlin/org/michaelbel/movies/ui/preview/provider/ThemePreviewParameterProvider.kt b/core/ui/src/commonMain/kotlin/org/michaelbel/movies/ui/preview/ThemePreviewParameterProvider.kt similarity index 52% rename from core/ui/src/androidMain/kotlin/org/michaelbel/movies/ui/preview/provider/ThemePreviewParameterProvider.kt rename to core/ui/src/commonMain/kotlin/org/michaelbel/movies/ui/preview/ThemePreviewParameterProvider.kt index 96e2496aa..2625dac27 100644 --- a/core/ui/src/androidMain/kotlin/org/michaelbel/movies/ui/preview/provider/ThemePreviewParameterProvider.kt +++ b/core/ui/src/commonMain/kotlin/org/michaelbel/movies/ui/preview/ThemePreviewParameterProvider.kt @@ -1,6 +1,6 @@ -package org.michaelbel.movies.ui.preview.provider +package org.michaelbel.movies.ui.preview -import androidx.compose.ui.tooling.preview.datasource.CollectionPreviewParameterProvider import org.michaelbel.movies.common.theme.AppTheme +import org.michaelbel.movies.ui.preview.base.CollectionPreviewParameterProvider class ThemePreviewParameterProvider: CollectionPreviewParameterProvider(AppTheme.VALUES) \ No newline at end of file diff --git a/core/ui/src/androidMain/kotlin/org/michaelbel/movies/ui/preview/provider/TitlePreviewParameterProvider.kt b/core/ui/src/commonMain/kotlin/org/michaelbel/movies/ui/preview/TitlePreviewParameterProvider.kt similarity index 57% rename from core/ui/src/androidMain/kotlin/org/michaelbel/movies/ui/preview/provider/TitlePreviewParameterProvider.kt rename to core/ui/src/commonMain/kotlin/org/michaelbel/movies/ui/preview/TitlePreviewParameterProvider.kt index d14128c7e..6f5d8c469 100644 --- a/core/ui/src/androidMain/kotlin/org/michaelbel/movies/ui/preview/provider/TitlePreviewParameterProvider.kt +++ b/core/ui/src/commonMain/kotlin/org/michaelbel/movies/ui/preview/TitlePreviewParameterProvider.kt @@ -1,6 +1,6 @@ -package org.michaelbel.movies.ui.preview.provider +package org.michaelbel.movies.ui.preview -import androidx.compose.ui.tooling.preview.datasource.CollectionPreviewParameterProvider +import org.michaelbel.movies.ui.preview.base.CollectionPreviewParameterProvider class TitlePreviewParameterProvider: CollectionPreviewParameterProvider( listOf( diff --git a/core/ui/src/androidMain/kotlin/org/michaelbel/movies/ui/preview/provider/VersionPreviewParameterProvider.kt b/core/ui/src/commonMain/kotlin/org/michaelbel/movies/ui/preview/VersionPreviewParameterProvider.kt similarity index 71% rename from core/ui/src/androidMain/kotlin/org/michaelbel/movies/ui/preview/provider/VersionPreviewParameterProvider.kt rename to core/ui/src/commonMain/kotlin/org/michaelbel/movies/ui/preview/VersionPreviewParameterProvider.kt index 1d56c5ce9..8fb6a8860 100644 --- a/core/ui/src/androidMain/kotlin/org/michaelbel/movies/ui/preview/provider/VersionPreviewParameterProvider.kt +++ b/core/ui/src/commonMain/kotlin/org/michaelbel/movies/ui/preview/VersionPreviewParameterProvider.kt @@ -1,7 +1,7 @@ -package org.michaelbel.movies.ui.preview.provider +package org.michaelbel.movies.ui.preview -import androidx.compose.ui.tooling.preview.datasource.CollectionPreviewParameterProvider import org.michaelbel.movies.common.version.AppVersionData +import org.michaelbel.movies.ui.preview.base.CollectionPreviewParameterProvider class VersionPreviewParameterProvider: CollectionPreviewParameterProvider( listOf( diff --git a/core/ui/src/commonMain/kotlin/org/michaelbel/movies/ui/preview/base/CollectionPreviewParameterProvider.kt b/core/ui/src/commonMain/kotlin/org/michaelbel/movies/ui/preview/base/CollectionPreviewParameterProvider.kt new file mode 100644 index 000000000..eef7133a7 --- /dev/null +++ b/core/ui/src/commonMain/kotlin/org/michaelbel/movies/ui/preview/base/CollectionPreviewParameterProvider.kt @@ -0,0 +1,11 @@ +package org.michaelbel.movies.ui.preview.base + +import org.jetbrains.compose.ui.tooling.preview.PreviewParameterProvider + +open class CollectionPreviewParameterProvider( + private val collection: Collection +): PreviewParameterProvider { + + override val values: Sequence + get() = collection.asSequence() +} \ No newline at end of file diff --git a/feature/details-impl/src/androidMain/kotlin/org/michaelbel/movies/details/ui/DetailsContent.android.kt b/feature/details-impl/src/androidMain/kotlin/org/michaelbel/movies/details/ui/DetailsContent.android.kt index f9d43a73a..4e1124733 100644 --- a/feature/details-impl/src/androidMain/kotlin/org/michaelbel/movies/details/ui/DetailsContent.android.kt +++ b/feature/details-impl/src/androidMain/kotlin/org/michaelbel/movies/details/ui/DetailsContent.android.kt @@ -21,8 +21,6 @@ import androidx.compose.ui.layout.ContentScale import androidx.compose.ui.platform.LocalContext import androidx.compose.ui.res.stringResource import androidx.compose.ui.text.style.TextOverflow -import androidx.compose.ui.tooling.preview.Preview -import androidx.compose.ui.tooling.preview.PreviewParameter import androidx.compose.ui.unit.dp import androidx.constraintlayout.compose.ConstraintLayout import androidx.constraintlayout.compose.Dimension @@ -33,6 +31,8 @@ import coil.compose.AsyncImage import coil.compose.AsyncImagePainter import coil.request.ImageRequest import coil.request.SuccessResult +import org.jetbrains.compose.ui.tooling.preview.Preview +import org.jetbrains.compose.ui.tooling.preview.PreviewParameter import org.michaelbel.movies.network.config.formatBackdropImage import org.michaelbel.movies.persistence.database.entity.pojo.MoviePojo import org.michaelbel.movies.persistence.database.ktx.isNotEmpty @@ -40,7 +40,7 @@ import org.michaelbel.movies.ui.accessibility.MoviesContentDescription import org.michaelbel.movies.ui.placeholder.PlaceholderHighlight import org.michaelbel.movies.ui.placeholder.material3.fade import org.michaelbel.movies.ui.placeholder.placeholder -import org.michaelbel.movies.ui.preview.provider.MovieDbPreviewParameterProvider +import org.michaelbel.movies.ui.preview.MovieDbPreviewParameterProvider import org.michaelbel.movies.ui.theme.MoviesTheme @Composable diff --git a/feature/details-impl/src/commonMain/kotlin/org/michaelbel/movies/details/ui/DetailsToolbar.kt b/feature/details-impl/src/commonMain/kotlin/org/michaelbel/movies/details/ui/DetailsToolbar.kt index 7829eaef8..5c79ac0b5 100644 --- a/feature/details-impl/src/commonMain/kotlin/org/michaelbel/movies/details/ui/DetailsToolbar.kt +++ b/feature/details-impl/src/commonMain/kotlin/org/michaelbel/movies/details/ui/DetailsToolbar.kt @@ -16,9 +16,11 @@ import androidx.compose.ui.Modifier import androidx.compose.ui.graphics.Color import androidx.compose.ui.text.style.TextOverflow import org.jetbrains.compose.ui.tooling.preview.Preview +import org.jetbrains.compose.ui.tooling.preview.PreviewParameter import org.michaelbel.movies.ui.compose.iconbutton.BackIcon import org.michaelbel.movies.ui.compose.iconbutton.ShareIcon import org.michaelbel.movies.ui.ktx.modifierDisplayCutoutWindowInsets +import org.michaelbel.movies.ui.preview.TitlePreviewParameterProvider import org.michaelbel.movies.ui.theme.MoviesTheme @Composable @@ -74,7 +76,7 @@ internal fun DetailsToolbar( @Preview @Composable private fun DetailsToolbarPreview( - /*@PreviewParameter(TitlePreviewParameterProvider::class)*/ title: String + @PreviewParameter(TitlePreviewParameterProvider::class) title: String ) { MoviesTheme { DetailsToolbar( diff --git "a/feature/search-impl/src/androidMain/kotlin/org/michaelbel/movies/search/ui/SearchRe\321\201entResult.kt" "b/feature/search-impl/src/androidMain/kotlin/org/michaelbel/movies/search/ui/SearchRe\321\201entResult.kt" index a23366af6..5ea785ae6 100644 --- "a/feature/search-impl/src/androidMain/kotlin/org/michaelbel/movies/search/ui/SearchRe\321\201entResult.kt" +++ "b/feature/search-impl/src/androidMain/kotlin/org/michaelbel/movies/search/ui/SearchRe\321\201entResult.kt" @@ -11,16 +11,16 @@ import androidx.compose.ui.Modifier 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.Preview -import androidx.compose.ui.tooling.preview.PreviewParameter import androidx.compose.ui.unit.dp import androidx.constraintlayout.compose.ConstraintLayout import androidx.constraintlayout.compose.Dimension +import org.jetbrains.compose.ui.tooling.preview.Preview +import org.jetbrains.compose.ui.tooling.preview.PreviewParameter import org.michaelbel.movies.persistence.database.entity.pojo.MoviePojo import org.michaelbel.movies.ui.accessibility.MoviesContentDescription import org.michaelbel.movies.ui.compose.iconbutton.CloseIcon import org.michaelbel.movies.ui.icons.MoviesIcons -import org.michaelbel.movies.ui.preview.provider.MoviePreviewParameterProvider +import org.michaelbel.movies.ui.preview.MoviePreviewParameterProvider import org.michaelbel.movies.ui.theme.MoviesTheme @Composable diff --git a/feature/search-impl/src/androidMain/kotlin/org/michaelbel/movies/search/ui/SearchSuggestion.kt b/feature/search-impl/src/androidMain/kotlin/org/michaelbel/movies/search/ui/SearchSuggestion.kt index 2297a20ed..c84b72365 100644 --- a/feature/search-impl/src/androidMain/kotlin/org/michaelbel/movies/search/ui/SearchSuggestion.kt +++ b/feature/search-impl/src/androidMain/kotlin/org/michaelbel/movies/search/ui/SearchSuggestion.kt @@ -12,11 +12,11 @@ import androidx.compose.ui.Alignment import androidx.compose.ui.Modifier import androidx.compose.ui.text.style.TextAlign import androidx.compose.ui.text.style.TextOverflow -import androidx.compose.ui.tooling.preview.Preview -import androidx.compose.ui.tooling.preview.PreviewParameter import androidx.compose.ui.unit.dp +import org.jetbrains.compose.ui.tooling.preview.Preview +import org.jetbrains.compose.ui.tooling.preview.PreviewParameter import org.michaelbel.movies.persistence.database.entity.pojo.SuggestionPojo -import org.michaelbel.movies.ui.preview.provider.SuggestionDbPreviewParameterProvider +import org.michaelbel.movies.ui.preview.SuggestionDbPreviewParameterProvider import org.michaelbel.movies.ui.theme.MoviesTheme @Composable diff --git a/feature/search-impl/src/androidMain/kotlin/org/michaelbel/movies/search/ui/SearchToolbar.kt b/feature/search-impl/src/androidMain/kotlin/org/michaelbel/movies/search/ui/SearchToolbar.kt index 554c1ee01..d27fa00e3 100644 --- a/feature/search-impl/src/androidMain/kotlin/org/michaelbel/movies/search/ui/SearchToolbar.kt +++ b/feature/search-impl/src/androidMain/kotlin/org/michaelbel/movies/search/ui/SearchToolbar.kt @@ -20,9 +20,9 @@ import androidx.compose.runtime.Composable import androidx.compose.ui.Alignment import androidx.compose.ui.Modifier import androidx.compose.ui.res.stringResource -import androidx.compose.ui.tooling.preview.Preview -import androidx.compose.ui.tooling.preview.PreviewParameter import androidx.compose.ui.unit.dp +import org.jetbrains.compose.ui.tooling.preview.Preview +import org.jetbrains.compose.ui.tooling.preview.PreviewParameter import org.michaelbel.movies.persistence.database.entity.pojo.MoviePojo import org.michaelbel.movies.persistence.database.entity.pojo.SuggestionPojo import org.michaelbel.movies.persistence.database.typealiases.MovieId @@ -31,7 +31,7 @@ import org.michaelbel.movies.search_impl.R import org.michaelbel.movies.ui.compose.iconbutton.BackIcon import org.michaelbel.movies.ui.compose.iconbutton.CloseIcon import org.michaelbel.movies.ui.compose.iconbutton.VoiceIcon -import org.michaelbel.movies.ui.preview.provider.SuggestionDbPreviewParameterProvider +import org.michaelbel.movies.ui.preview.SuggestionDbPreviewParameterProvider import org.michaelbel.movies.ui.theme.MoviesTheme @Composable diff --git a/feature/settings-impl/src/commonMain/kotlin/org/michaelbel/movies/settings/ui/SettingsVersionBox.kt b/feature/settings-impl/src/commonMain/kotlin/org/michaelbel/movies/settings/ui/SettingsVersionBox.kt index 4e4616512..9e94973a3 100644 --- a/feature/settings-impl/src/commonMain/kotlin/org/michaelbel/movies/settings/ui/SettingsVersionBox.kt +++ b/feature/settings-impl/src/commonMain/kotlin/org/michaelbel/movies/settings/ui/SettingsVersionBox.kt @@ -15,10 +15,12 @@ import androidx.compose.ui.Modifier import androidx.compose.ui.unit.dp import org.jetbrains.compose.resources.stringResource import org.jetbrains.compose.ui.tooling.preview.Preview +import org.jetbrains.compose.ui.tooling.preview.PreviewParameter import org.michaelbel.movies.common.version.AppVersionData import org.michaelbel.movies.settings.model.SettingsData import org.michaelbel.movies.ui.accessibility.MoviesContentDescriptionCommon import org.michaelbel.movies.ui.icons.MoviesIcons +import org.michaelbel.movies.ui.preview.VersionPreviewParameterProvider import org.michaelbel.movies.ui.strings.MoviesStrings import org.michaelbel.movies.ui.theme.MoviesTheme @@ -72,7 +74,7 @@ internal fun SettingsVersionBox( @Preview @Composable private fun SettingsVersionBoxPreview( - /*@PreviewParameter(VersionPreviewParameterProvider::class)*/ appVersionData: AppVersionData + @PreviewParameter(VersionPreviewParameterProvider::class) appVersionData: AppVersionData ) { MoviesTheme { SettingsVersionBox( diff --git a/feature/settings-impl/src/commonMain/kotlin/org/michaelbel/movies/settings/ui/common/SettingAppIcon.kt b/feature/settings-impl/src/commonMain/kotlin/org/michaelbel/movies/settings/ui/common/SettingAppIcon.kt index 55c09d78b..374b1f16f 100644 --- a/feature/settings-impl/src/commonMain/kotlin/org/michaelbel/movies/settings/ui/common/SettingAppIcon.kt +++ b/feature/settings-impl/src/commonMain/kotlin/org/michaelbel/movies/settings/ui/common/SettingAppIcon.kt @@ -24,9 +24,11 @@ import androidx.compose.ui.unit.dp import org.jetbrains.compose.resources.painterResource import org.jetbrains.compose.resources.stringResource import org.jetbrains.compose.ui.tooling.preview.Preview +import org.jetbrains.compose.ui.tooling.preview.PreviewParameter import org.michaelbel.movies.ui.accessibility.MoviesContentDescriptionCommon import org.michaelbel.movies.ui.appicon.IconAlias import org.michaelbel.movies.ui.icons.MoviesIcons +import org.michaelbel.movies.ui.preview.IconAliasPreviewParameterProvider import org.michaelbel.movies.ui.theme.MoviesTheme @Composable @@ -87,7 +89,7 @@ internal fun RowScope.SettingAppIcon( @Preview @Composable private fun SettingAppIconPreview( - /*@PreviewParameter(IconAliasPreviewParameterProvider::class)*/ iconAlias: IconAlias + @PreviewParameter(IconAliasPreviewParameterProvider::class) iconAlias: IconAlias ) { MoviesTheme { Row { diff --git a/feature/settings-impl/src/commonMain/kotlin/org/michaelbel/movies/settings/ui/common/SettingDialog.kt b/feature/settings-impl/src/commonMain/kotlin/org/michaelbel/movies/settings/ui/common/SettingDialog.kt index 3943b53d9..b95991813 100644 --- a/feature/settings-impl/src/commonMain/kotlin/org/michaelbel/movies/settings/ui/common/SettingDialog.kt +++ b/feature/settings-impl/src/commonMain/kotlin/org/michaelbel/movies/settings/ui/common/SettingDialog.kt @@ -23,11 +23,13 @@ import androidx.compose.ui.graphics.vector.ImageVector import androidx.compose.ui.unit.dp import org.jetbrains.compose.resources.stringResource import org.jetbrains.compose.ui.tooling.preview.Preview +import org.jetbrains.compose.ui.tooling.preview.PreviewParameter import org.michaelbel.movies.common.SealedString import org.michaelbel.movies.interactor.entity.AppLanguage import org.michaelbel.movies.settings.ktx.stringText import org.michaelbel.movies.ui.accessibility.MoviesContentDescriptionCommon import org.michaelbel.movies.ui.icons.MoviesIcons +import org.michaelbel.movies.ui.preview.AppearancePreviewParameterProvider import org.michaelbel.movies.ui.strings.MoviesStrings import org.michaelbel.movies.ui.theme.MoviesTheme @@ -112,7 +114,7 @@ internal fun SettingsDialog( @Preview @Composable private fun SettingDialogPreview( - /*@PreviewParameter(AppearancePreviewParameterProvider::class)*/ appLanguage: AppLanguage + @PreviewParameter(AppearancePreviewParameterProvider::class) appLanguage: AppLanguage ) { MoviesTheme { SettingsDialog( diff --git a/feature/settings-impl/src/commonMain/kotlin/org/michaelbel/movies/settings/ui/common/SettingSwitchItem.kt b/feature/settings-impl/src/commonMain/kotlin/org/michaelbel/movies/settings/ui/common/SettingSwitchItem.kt index d62427833..22d09cf20 100644 --- a/feature/settings-impl/src/commonMain/kotlin/org/michaelbel/movies/settings/ui/common/SettingSwitchItem.kt +++ b/feature/settings-impl/src/commonMain/kotlin/org/michaelbel/movies/settings/ui/common/SettingSwitchItem.kt @@ -18,9 +18,11 @@ import androidx.compose.ui.unit.dp import androidx.constraintlayout.compose.ConstraintLayout import androidx.constraintlayout.compose.Dimension import org.jetbrains.compose.ui.tooling.preview.Preview +import org.jetbrains.compose.ui.tooling.preview.PreviewParameter import org.michaelbel.movies.ui.accessibility.MoviesContentDescriptionCommon import org.michaelbel.movies.ui.compose.SwitchCheckIcon import org.michaelbel.movies.ui.icons.MoviesIcons +import org.michaelbel.movies.ui.preview.BooleanPreviewParameterProvider import org.michaelbel.movies.ui.theme.MoviesTheme @Composable @@ -166,7 +168,7 @@ internal fun SettingSwitchItem( @Preview @Composable private fun SettingSwitchItemPreview( - /*@PreviewParameter(BooleanPreviewParameterProvider::class)*/ checked: Boolean + @PreviewParameter(BooleanPreviewParameterProvider::class) checked: Boolean ) { MoviesTheme { SettingSwitchItem(