From e6a6c83519265a8aebdfe512acd3977440939728 Mon Sep 17 00:00:00 2001 From: Chiko Shimizu Date: Tue, 14 May 2024 18:30:38 +0900 Subject: [PATCH 01/20] apply spotless --- .../benchmark/BaselineProfileGenerator.kt | 5 +- .../jetstream/benchmark/StartupBenchmark.kt | 4 +- JetStreamCompose/buildscripts/init.gradle.kts | 72 +++++++ .../google/jetstream/JetStreamApplication.kt | 3 +- .../java/com/google/jetstream/MainActivity.kt | 17 +- .../google/jetstream/data/entities/Movie.kt | 4 +- .../jetstream/data/entities/MovieCast.kt | 2 +- .../jetstream/data/entities/MovieCategory.kt | 2 +- .../data/entities/MovieCategoryDetails.kt | 2 +- .../data/entities/MovieCategoryList.kt | 2 +- .../jetstream/data/entities/MovieList.kt | 4 +- .../data/entities/MovieReviewsAndRatings.kt | 2 +- .../data/models/MovieCastResponse.kt | 2 +- .../data/models/MovieCategoriesResponse.kt | 3 +- .../jetstream/data/models/MoviesResponse.kt | 2 +- .../data/repositories/CachedDataReader.kt | 4 +- .../data/repositories/MovieCastDataSource.kt | 6 +- .../repositories/MovieCategoryDataSource.kt | 5 +- .../data/repositories/MovieDataSource.kt | 4 +- .../data/repositories/MovieRepository.kt | 3 +- .../data/repositories/MovieRepositoryImpl.kt | 8 +- .../data/repositories/TvDataSource.kt | 5 +- .../google/jetstream/data/util/AssetReader.kt | 3 +- .../jetstream/data/util/StringConstants.kt | 22 +-- .../com/google/jetstream/presentation/App.kt | 2 +- .../presentation/common/MoviesRow.kt | 178 +++++++----------- .../jetstream/presentation/screens/Screens.kt | 2 +- .../screens/categories/CategoriesScreen.kt | 119 +++++------- .../categories/CategoriesScreenViewModel.kt | 14 +- .../categories/CategoryMovieListScreen.kt | 109 +++-------- .../CategoryMovieListScreenViewModel.kt | 7 +- .../screens/dashboard/DashboardScreen.kt | 2 +- .../dashboard/DashboardTopBarItemIndicator.kt | 2 +- .../favourites/FavouriteScreenViewModel.kt | 8 +- .../screens/favourites/FavouritesScreen.kt | 29 ++- .../screens/favourites/MovieFilterChip.kt | 11 +- .../screens/favourites/MovieFilterChipRow.kt | 4 +- .../screens/home/FeaturedMoviesCarousel.kt | 9 +- .../screens/home/HomeScreenViewModel.kt | 23 ++- .../screens/movies/CastAndCrewList.kt | 2 +- .../screens/movies/DotSeparatedRow.kt | 2 +- .../screens/movies/MovieDetails.kt | 3 +- .../movies/MovieDetailsScreenViewModel.kt | 10 +- .../screens/movies/MovieReviews.kt | 2 +- .../screens/movies/MoviesScreenMovieList.kt | 3 +- .../screens/movies/MoviesScreenViewModel.kt | 19 +- .../screens/movies/TitleValueText.kt | 2 +- .../screens/profile/AboutSection.kt | 2 +- .../screens/profile/AccountsSection.kt | 2 +- .../profile/AccountsSectionDeleteDialog.kt | 2 +- .../profile/AccountsSectionDialogButton.kt | 2 +- .../screens/profile/AccountsSelectionItem.kt | 2 +- .../screens/profile/LanguageSection.kt | 5 +- .../screens/profile/ProfileScreen.kt | 3 +- .../screens/profile/ProfileScreens.kt | 2 +- .../screens/profile/SearchHistorySection.kt | 2 +- .../screens/profile/SubtitlesSection.kt | 2 +- .../screens/search/SearchScreen.kt | 10 +- .../screens/search/SearchScreenViewModel.kt | 7 +- .../screens/shows/ShowScreenViewModel.kt | 15 +- .../videoPlayer/VideoPlayerScreenViewModel.kt | 6 +- .../components/VideoPlayerControllerText.kt | 4 +- .../components/VideoPlayerControlsIcon.kt | 2 +- .../components/VideoPlayerIndicator.kt | 2 +- .../components/VideoPlayerMainFrame.kt | 19 +- .../components/VideoPlayerMediaTitle.kt | 18 +- .../components/VideoPlayerOverlay.kt | 10 +- .../components/VideoPlayerPulse.kt | 18 +- .../components/VideoPlayerSeeker.kt | 22 ++- .../components/VideoPlayerState.kt | 2 +- .../presentation/theme/JetStreamFocusTheme.kt | 4 +- .../jetstream/presentation/theme/Theme.kt | 2 +- .../jetstream/presentation/theme/Type.kt | 2 +- .../BringIntoViewIfChildrenAreFocused.kt | 4 +- .../jetstream/presentation/utils/Colors.kt | 2 +- .../presentation/utils/GradientBg.kt | 5 +- .../presentation/utils/ModifierUtils.kt | 15 +- .../jetstream/presentation/utils/Padding.kt | 4 +- .../com/google/jetstream/tvmaterial/Dialog.kt | 6 +- .../com/google/jetstream/tvmaterial/Shapes.kt | 2 +- JetStreamCompose/spotless/copyright.kt | 16 ++ 81 files changed, 501 insertions(+), 468 deletions(-) create mode 100644 JetStreamCompose/buildscripts/init.gradle.kts create mode 100644 JetStreamCompose/spotless/copyright.kt diff --git a/JetStreamCompose/benchmark/src/main/java/com/google/jetstream/benchmark/BaselineProfileGenerator.kt b/JetStreamCompose/benchmark/src/main/java/com/google/jetstream/benchmark/BaselineProfileGenerator.kt index 682a366f..9697535f 100644 --- a/JetStreamCompose/benchmark/src/main/java/com/google/jetstream/benchmark/BaselineProfileGenerator.kt +++ b/JetStreamCompose/benchmark/src/main/java/com/google/jetstream/benchmark/BaselineProfileGenerator.kt @@ -5,7 +5,7 @@ * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * - * https://www.apache.org/licenses/LICENSE-2.0 + * https://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, @@ -69,7 +69,6 @@ class BaselineProfileGenerator { waitForIdle() repeat(2) { pressDPadRight(); waitForIdle() } - // Navigate to Movies tab pressDPadUp() waitForIdle() @@ -127,7 +126,6 @@ class BaselineProfileGenerator { pressDPadRight() waitForIdle() - // Navigate to Search tab repeat(3) { pressDPadUp(); waitForIdle() } pressDPadRight() @@ -188,7 +186,6 @@ class BaselineProfileGenerator { } } - private const val JETSTREAM_PACKAGE_NAME = "com.google.jetstream" private const val INITIAL_WAIT_TIMEOUT = 2000L diff --git a/JetStreamCompose/benchmark/src/main/java/com/google/jetstream/benchmark/StartupBenchmark.kt b/JetStreamCompose/benchmark/src/main/java/com/google/jetstream/benchmark/StartupBenchmark.kt index 8cadda3a..44206835 100644 --- a/JetStreamCompose/benchmark/src/main/java/com/google/jetstream/benchmark/StartupBenchmark.kt +++ b/JetStreamCompose/benchmark/src/main/java/com/google/jetstream/benchmark/StartupBenchmark.kt @@ -5,7 +5,7 @@ * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * - * https://www.apache.org/licenses/LICENSE-2.0 + * https://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, @@ -71,4 +71,4 @@ class StartupBenchmark { } private const val JETSTREAM_PACKAGE_NAME = "com.google.jetstream" -private const val STARTUP_TEST_ITERATIONS = 5 \ No newline at end of file +private const val STARTUP_TEST_ITERATIONS = 5 diff --git a/JetStreamCompose/buildscripts/init.gradle.kts b/JetStreamCompose/buildscripts/init.gradle.kts new file mode 100644 index 00000000..1b7a5426 --- /dev/null +++ b/JetStreamCompose/buildscripts/init.gradle.kts @@ -0,0 +1,72 @@ +/* + * Copyright 2022 The Android Open Source Project + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +val ktlintVersion = "0.46.1" + +initscript { + val spotlessVersion = "6.10.0" + + repositories { + mavenCentral() + } + + dependencies { + classpath("com.diffplug.spotless:spotless-plugin-gradle:$spotlessVersion") + } +} + +allprojects { + if (this == rootProject) { + return@allprojects + } + apply() + extensions.configure { + kotlin { + target("**/*.kt") + targetExclude("**/build/**/*.kt") + ktlint(ktlintVersion).editorConfigOverride( + mapOf( + "ktlint_code_style" to "android", + "ij_kotlin_allow_trailing_comma" to true, + // These rules were introduced in ktlint 0.46.0 and should not be + // enabled without further discussion. They are disabled for now. + // See: https://github.com/pinterest/ktlint/releases/tag/0.46.0 + "disabled_rules" to + "filename," + + "annotation,annotation-spacing," + + "argument-list-wrapping," + + "double-colon-spacing," + + "enum-entry-name-case," + + "multiline-if-else," + + "no-empty-first-line-in-method-block," + + "package-name," + + "trailing-comma," + + "spacing-around-angle-brackets," + + "spacing-between-declarations-with-annotations," + + "spacing-between-declarations-with-comments," + + "unary-op-spacing" + ) + ) + licenseHeaderFile(rootProject.file("spotless/copyright.kt")) + } + format("kts") { + target("**/*.kts") + targetExclude("**/build/**/*.kts") + // Look for the first line that doesn't have a block comment (assumed to be the license) + licenseHeaderFile(rootProject.file("spotless/copyright.kt"), "(^(?![\\/ ]\\*).*$)") + } + } +} \ No newline at end of file diff --git a/JetStreamCompose/jetstream/src/main/java/com/google/jetstream/JetStreamApplication.kt b/JetStreamCompose/jetstream/src/main/java/com/google/jetstream/JetStreamApplication.kt index d88d5b8c..1600a312 100644 --- a/JetStreamCompose/jetstream/src/main/java/com/google/jetstream/JetStreamApplication.kt +++ b/JetStreamCompose/jetstream/src/main/java/com/google/jetstream/JetStreamApplication.kt @@ -5,7 +5,7 @@ * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * - * http://www.apache.org/licenses/LICENSE-2.0 + * https://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, @@ -36,5 +36,4 @@ abstract class MovieRepositoryModule { abstract fun bindMovieRepository( movieRepositoryImpl: MovieRepositoryImpl ): MovieRepository - } diff --git a/JetStreamCompose/jetstream/src/main/java/com/google/jetstream/MainActivity.kt b/JetStreamCompose/jetstream/src/main/java/com/google/jetstream/MainActivity.kt index 871388c4..7c5392bf 100644 --- a/JetStreamCompose/jetstream/src/main/java/com/google/jetstream/MainActivity.kt +++ b/JetStreamCompose/jetstream/src/main/java/com/google/jetstream/MainActivity.kt @@ -1,3 +1,19 @@ +/* + * Copyright 2024 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + package com.google.jetstream import android.os.Bundle @@ -40,4 +56,3 @@ class MainActivity : ComponentActivity() { } } } - diff --git a/JetStreamCompose/jetstream/src/main/java/com/google/jetstream/data/entities/Movie.kt b/JetStreamCompose/jetstream/src/main/java/com/google/jetstream/data/entities/Movie.kt index 2c15c937..59541b80 100644 --- a/JetStreamCompose/jetstream/src/main/java/com/google/jetstream/data/entities/Movie.kt +++ b/JetStreamCompose/jetstream/src/main/java/com/google/jetstream/data/entities/Movie.kt @@ -5,7 +5,7 @@ * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * - * https://www.apache.org/licenses/LICENSE-2.0 + * https://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, @@ -45,4 +45,4 @@ fun MoviesResponseItem.toMovie(thumbnailType: ThumbnailType = ThumbnailType.Stan enum class ThumbnailType { Standard, Long -} \ No newline at end of file +} diff --git a/JetStreamCompose/jetstream/src/main/java/com/google/jetstream/data/entities/MovieCast.kt b/JetStreamCompose/jetstream/src/main/java/com/google/jetstream/data/entities/MovieCast.kt index 694b1aed..a79a159b 100644 --- a/JetStreamCompose/jetstream/src/main/java/com/google/jetstream/data/entities/MovieCast.kt +++ b/JetStreamCompose/jetstream/src/main/java/com/google/jetstream/data/entities/MovieCast.kt @@ -5,7 +5,7 @@ * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * - * https://www.apache.org/licenses/LICENSE-2.0 + * https://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, diff --git a/JetStreamCompose/jetstream/src/main/java/com/google/jetstream/data/entities/MovieCategory.kt b/JetStreamCompose/jetstream/src/main/java/com/google/jetstream/data/entities/MovieCategory.kt index 8f25c942..feb469b0 100644 --- a/JetStreamCompose/jetstream/src/main/java/com/google/jetstream/data/entities/MovieCategory.kt +++ b/JetStreamCompose/jetstream/src/main/java/com/google/jetstream/data/entities/MovieCategory.kt @@ -5,7 +5,7 @@ * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * - * https://www.apache.org/licenses/LICENSE-2.0 + * https://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, diff --git a/JetStreamCompose/jetstream/src/main/java/com/google/jetstream/data/entities/MovieCategoryDetails.kt b/JetStreamCompose/jetstream/src/main/java/com/google/jetstream/data/entities/MovieCategoryDetails.kt index 6355896d..23995682 100644 --- a/JetStreamCompose/jetstream/src/main/java/com/google/jetstream/data/entities/MovieCategoryDetails.kt +++ b/JetStreamCompose/jetstream/src/main/java/com/google/jetstream/data/entities/MovieCategoryDetails.kt @@ -5,7 +5,7 @@ * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * - * https://www.apache.org/licenses/LICENSE-2.0 + * https://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, diff --git a/JetStreamCompose/jetstream/src/main/java/com/google/jetstream/data/entities/MovieCategoryList.kt b/JetStreamCompose/jetstream/src/main/java/com/google/jetstream/data/entities/MovieCategoryList.kt index 9a38ee24..6bb78bf5 100644 --- a/JetStreamCompose/jetstream/src/main/java/com/google/jetstream/data/entities/MovieCategoryList.kt +++ b/JetStreamCompose/jetstream/src/main/java/com/google/jetstream/data/entities/MovieCategoryList.kt @@ -5,7 +5,7 @@ * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * - * http://www.apache.org/licenses/LICENSE-2.0 + * https://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, diff --git a/JetStreamCompose/jetstream/src/main/java/com/google/jetstream/data/entities/MovieList.kt b/JetStreamCompose/jetstream/src/main/java/com/google/jetstream/data/entities/MovieList.kt index 09e03de9..65f49411 100644 --- a/JetStreamCompose/jetstream/src/main/java/com/google/jetstream/data/entities/MovieList.kt +++ b/JetStreamCompose/jetstream/src/main/java/com/google/jetstream/data/entities/MovieList.kt @@ -5,7 +5,7 @@ * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * - * http://www.apache.org/licenses/LICENSE-2.0 + * https://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, @@ -21,4 +21,4 @@ import androidx.compose.runtime.Immutable @Immutable data class MovieList( val value: List = emptyList() -) : List by value \ No newline at end of file +) : List by value diff --git a/JetStreamCompose/jetstream/src/main/java/com/google/jetstream/data/entities/MovieReviewsAndRatings.kt b/JetStreamCompose/jetstream/src/main/java/com/google/jetstream/data/entities/MovieReviewsAndRatings.kt index 6004d417..70b3ea24 100644 --- a/JetStreamCompose/jetstream/src/main/java/com/google/jetstream/data/entities/MovieReviewsAndRatings.kt +++ b/JetStreamCompose/jetstream/src/main/java/com/google/jetstream/data/entities/MovieReviewsAndRatings.kt @@ -5,7 +5,7 @@ * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * - * https://www.apache.org/licenses/LICENSE-2.0 + * https://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, diff --git a/JetStreamCompose/jetstream/src/main/java/com/google/jetstream/data/models/MovieCastResponse.kt b/JetStreamCompose/jetstream/src/main/java/com/google/jetstream/data/models/MovieCastResponse.kt index 5ec4e7ec..6356bc47 100644 --- a/JetStreamCompose/jetstream/src/main/java/com/google/jetstream/data/models/MovieCastResponse.kt +++ b/JetStreamCompose/jetstream/src/main/java/com/google/jetstream/data/models/MovieCastResponse.kt @@ -5,7 +5,7 @@ * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * - * https://www.apache.org/licenses/LICENSE-2.0 + * https://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, diff --git a/JetStreamCompose/jetstream/src/main/java/com/google/jetstream/data/models/MovieCategoriesResponse.kt b/JetStreamCompose/jetstream/src/main/java/com/google/jetstream/data/models/MovieCategoriesResponse.kt index dd36854a..bcdbc76b 100644 --- a/JetStreamCompose/jetstream/src/main/java/com/google/jetstream/data/models/MovieCategoriesResponse.kt +++ b/JetStreamCompose/jetstream/src/main/java/com/google/jetstream/data/models/MovieCategoriesResponse.kt @@ -5,7 +5,7 @@ * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * - * https://www.apache.org/licenses/LICENSE-2.0 + * https://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, @@ -18,7 +18,6 @@ package com.google.jetstream.data.models import kotlinx.serialization.Serializable - @Serializable data class MovieCategoriesResponseItem( val id: String, diff --git a/JetStreamCompose/jetstream/src/main/java/com/google/jetstream/data/models/MoviesResponse.kt b/JetStreamCompose/jetstream/src/main/java/com/google/jetstream/data/models/MoviesResponse.kt index 36a6cbb4..18c2adaa 100644 --- a/JetStreamCompose/jetstream/src/main/java/com/google/jetstream/data/models/MoviesResponse.kt +++ b/JetStreamCompose/jetstream/src/main/java/com/google/jetstream/data/models/MoviesResponse.kt @@ -5,7 +5,7 @@ * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * - * https://www.apache.org/licenses/LICENSE-2.0 + * https://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, diff --git a/JetStreamCompose/jetstream/src/main/java/com/google/jetstream/data/repositories/CachedDataReader.kt b/JetStreamCompose/jetstream/src/main/java/com/google/jetstream/data/repositories/CachedDataReader.kt index 3f1b097f..753e8a99 100644 --- a/JetStreamCompose/jetstream/src/main/java/com/google/jetstream/data/repositories/CachedDataReader.kt +++ b/JetStreamCompose/jetstream/src/main/java/com/google/jetstream/data/repositories/CachedDataReader.kt @@ -5,7 +5,7 @@ * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * - * http://www.apache.org/licenses/LICENSE-2.0 + * https://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, @@ -72,4 +72,4 @@ internal suspend fun readMovieCategoryData( assetsReader.getJsonDataFromAsset(resourceId).map { Json.decodeFromString>(it) }.getOrDefault(emptyList()) -} \ No newline at end of file +} diff --git a/JetStreamCompose/jetstream/src/main/java/com/google/jetstream/data/repositories/MovieCastDataSource.kt b/JetStreamCompose/jetstream/src/main/java/com/google/jetstream/data/repositories/MovieCastDataSource.kt index 6f79e808..cc7aca6f 100644 --- a/JetStreamCompose/jetstream/src/main/java/com/google/jetstream/data/repositories/MovieCastDataSource.kt +++ b/JetStreamCompose/jetstream/src/main/java/com/google/jetstream/data/repositories/MovieCastDataSource.kt @@ -5,7 +5,7 @@ * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * - * http://www.apache.org/licenses/LICENSE-2.0 + * https://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, @@ -32,6 +32,4 @@ class MovieCastDataSource @Inject constructor( } suspend fun getMovieCastList() = movieCastDataReader.read() - - -} \ No newline at end of file +} diff --git a/JetStreamCompose/jetstream/src/main/java/com/google/jetstream/data/repositories/MovieCategoryDataSource.kt b/JetStreamCompose/jetstream/src/main/java/com/google/jetstream/data/repositories/MovieCategoryDataSource.kt index c7739635..c8bb0fb8 100644 --- a/JetStreamCompose/jetstream/src/main/java/com/google/jetstream/data/repositories/MovieCategoryDataSource.kt +++ b/JetStreamCompose/jetstream/src/main/java/com/google/jetstream/data/repositories/MovieCategoryDataSource.kt @@ -5,7 +5,7 @@ * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * - * http://www.apache.org/licenses/LICENSE-2.0 + * https://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, @@ -32,5 +32,4 @@ class MovieCategoryDataSource @Inject constructor( } suspend fun getMovieCategoryList() = movieCategoryDataReader.read() - -} \ No newline at end of file +} diff --git a/JetStreamCompose/jetstream/src/main/java/com/google/jetstream/data/repositories/MovieDataSource.kt b/JetStreamCompose/jetstream/src/main/java/com/google/jetstream/data/repositories/MovieDataSource.kt index c942eda2..cb88c9de 100644 --- a/JetStreamCompose/jetstream/src/main/java/com/google/jetstream/data/repositories/MovieDataSource.kt +++ b/JetStreamCompose/jetstream/src/main/java/com/google/jetstream/data/repositories/MovieDataSource.kt @@ -5,7 +5,7 @@ * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * - * http://www.apache.org/licenses/LICENSE-2.0 + * https://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, @@ -71,7 +71,6 @@ class MovieDataSource @Inject constructor( suspend fun getTop10MovieList() = movieWithLongThumbnailDataReader.read().subList(20, 30) - suspend fun getNowPlayingMovieList() = nowPlayingMovieDataReader.read() @@ -80,5 +79,4 @@ class MovieDataSource @Inject constructor( suspend fun getFavoriteMovieList() = movieDataReader.read().subList(0, 28) - } diff --git a/JetStreamCompose/jetstream/src/main/java/com/google/jetstream/data/repositories/MovieRepository.kt b/JetStreamCompose/jetstream/src/main/java/com/google/jetstream/data/repositories/MovieRepository.kt index 758d42ca..757f6311 100644 --- a/JetStreamCompose/jetstream/src/main/java/com/google/jetstream/data/repositories/MovieRepository.kt +++ b/JetStreamCompose/jetstream/src/main/java/com/google/jetstream/data/repositories/MovieRepository.kt @@ -5,7 +5,7 @@ * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * - * https://www.apache.org/licenses/LICENSE-2.0 + * https://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, @@ -38,4 +38,3 @@ interface MovieRepository { fun getBingeWatchDramas(): Flow fun getFavouriteMovies(): Flow } - diff --git a/JetStreamCompose/jetstream/src/main/java/com/google/jetstream/data/repositories/MovieRepositoryImpl.kt b/JetStreamCompose/jetstream/src/main/java/com/google/jetstream/data/repositories/MovieRepositoryImpl.kt index 040a791c..0d87f8ae 100644 --- a/JetStreamCompose/jetstream/src/main/java/com/google/jetstream/data/repositories/MovieRepositoryImpl.kt +++ b/JetStreamCompose/jetstream/src/main/java/com/google/jetstream/data/repositories/MovieRepositoryImpl.kt @@ -5,7 +5,7 @@ * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * - * https://www.apache.org/licenses/LICENSE-2.0 + * https://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, @@ -27,10 +27,10 @@ import com.google.jetstream.data.util.StringConstants.Movie.Reviewer.DefaultCoun import com.google.jetstream.data.util.StringConstants.Movie.Reviewer.DefaultRating import com.google.jetstream.data.util.StringConstants.Movie.Reviewer.FreshTomatoes import com.google.jetstream.data.util.StringConstants.Movie.Reviewer.ReviewerName -import kotlinx.coroutines.flow.Flow -import kotlinx.coroutines.flow.flow import javax.inject.Inject import javax.inject.Singleton +import kotlinx.coroutines.flow.Flow +import kotlinx.coroutines.flow.flow @Singleton class MovieRepositoryImpl @Inject constructor( @@ -157,6 +157,4 @@ class MovieRepositoryImpl @Inject constructor( val list = movieDataSource.getFavoriteMovieList() emit(MovieList(list)) } - } - diff --git a/JetStreamCompose/jetstream/src/main/java/com/google/jetstream/data/repositories/TvDataSource.kt b/JetStreamCompose/jetstream/src/main/java/com/google/jetstream/data/repositories/TvDataSource.kt index a964c5af..3679a2e8 100644 --- a/JetStreamCompose/jetstream/src/main/java/com/google/jetstream/data/repositories/TvDataSource.kt +++ b/JetStreamCompose/jetstream/src/main/java/com/google/jetstream/data/repositories/TvDataSource.kt @@ -5,7 +5,7 @@ * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * - * http://www.apache.org/licenses/LICENSE-2.0 + * https://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, @@ -36,5 +36,4 @@ class TvDataSource @Inject constructor( suspend fun getBingeWatchDramaList() = mostPopularTvShowsReader.read().subList(6, 15).map { it.toMovie() } - -} \ No newline at end of file +} diff --git a/JetStreamCompose/jetstream/src/main/java/com/google/jetstream/data/util/AssetReader.kt b/JetStreamCompose/jetstream/src/main/java/com/google/jetstream/data/util/AssetReader.kt index f0b94602..484963be 100644 --- a/JetStreamCompose/jetstream/src/main/java/com/google/jetstream/data/util/AssetReader.kt +++ b/JetStreamCompose/jetstream/src/main/java/com/google/jetstream/data/util/AssetReader.kt @@ -5,7 +5,7 @@ * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * - * https://www.apache.org/licenses/LICENSE-2.0 + * https://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, @@ -32,5 +32,4 @@ class AssetsReader @Inject constructor( Result.failure(e) } } - } diff --git a/JetStreamCompose/jetstream/src/main/java/com/google/jetstream/data/util/StringConstants.kt b/JetStreamCompose/jetstream/src/main/java/com/google/jetstream/data/util/StringConstants.kt index 19e7c620..a93571b4 100644 --- a/JetStreamCompose/jetstream/src/main/java/com/google/jetstream/data/util/StringConstants.kt +++ b/JetStreamCompose/jetstream/src/main/java/com/google/jetstream/data/util/StringConstants.kt @@ -5,7 +5,7 @@ * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * - * https://www.apache.org/licenses/LICENSE-2.0 + * https://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, @@ -71,16 +71,16 @@ object StringConstants { object Placeholders { const val AboutSectionTitle = "About JetStream" const val AboutSectionDescription = "Welcome to Jetstream! We are a new and" + - " exciting streaming platform that offers a vast selection of movies," + - " TV shows, and original content for you to enjoy. Our team is dedicated" + - " to providing an intuitive and seamless streaming experience for all" + - " users. With a simple and intuitive interface, you can easily find and" + - " watch your favourite content in just a few clicks. We are constantly" + - " updating and expanding our library, so there is always something new" + - " to discover. We also offer personalised recommendations based on your" + - " viewing history, so you can easily find new and exciting content to" + - " enjoy. Thank you for choosing Jetstream for all of your entertainment" + - " needs. We hope you have a great time streaming!" + " exciting streaming platform that offers a vast selection of movies," + + " TV shows, and original content for you to enjoy. Our team is dedicated" + + " to providing an intuitive and seamless streaming experience for all" + + " users. With a simple and intuitive interface, you can easily find and" + + " watch your favourite content in just a few clicks. We are constantly" + + " updating and expanding our library, so there is always something new" + + " to discover. We also offer personalised recommendations based on your" + + " viewing history, so you can easily find new and exciting content to" + + " enjoy. Thank you for choosing Jetstream for all of your entertainment" + + " needs. We hope you have a great time streaming!" const val AboutSectionAppVersionTitle = "Application Version" const val LanguageSectionTitle = "Language" val LanguageSectionItems = listOf( diff --git a/JetStreamCompose/jetstream/src/main/java/com/google/jetstream/presentation/App.kt b/JetStreamCompose/jetstream/src/main/java/com/google/jetstream/presentation/App.kt index 7f3397ef..285bec45 100644 --- a/JetStreamCompose/jetstream/src/main/java/com/google/jetstream/presentation/App.kt +++ b/JetStreamCompose/jetstream/src/main/java/com/google/jetstream/presentation/App.kt @@ -5,7 +5,7 @@ * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * - * http://www.apache.org/licenses/LICENSE-2.0 + * https://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, diff --git a/JetStreamCompose/jetstream/src/main/java/com/google/jetstream/presentation/common/MoviesRow.kt b/JetStreamCompose/jetstream/src/main/java/com/google/jetstream/presentation/common/MoviesRow.kt index 304fcc73..66393013 100644 --- a/JetStreamCompose/jetstream/src/main/java/com/google/jetstream/presentation/common/MoviesRow.kt +++ b/JetStreamCompose/jetstream/src/main/java/com/google/jetstream/presentation/common/MoviesRow.kt @@ -5,7 +5,7 @@ * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * - * https://www.apache.org/licenses/LICENSE-2.0 + * https://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, @@ -18,7 +18,6 @@ package com.google.jetstream.presentation.common import androidx.compose.animation.AnimatedContent import androidx.compose.animation.core.animateFloatAsState -import androidx.compose.foundation.BorderStroke import androidx.compose.foundation.focusGroup import androidx.compose.foundation.layout.Arrangement import androidx.compose.foundation.layout.Box @@ -29,7 +28,6 @@ import androidx.compose.foundation.layout.fillMaxWidth import androidx.compose.foundation.layout.padding import androidx.compose.runtime.Composable import androidx.compose.runtime.getValue -import androidx.compose.runtime.key import androidx.compose.runtime.mutableStateOf import androidx.compose.runtime.remember import androidx.compose.runtime.setValue @@ -40,13 +38,10 @@ import androidx.compose.ui.draw.alpha import androidx.compose.ui.draw.drawWithContent import androidx.compose.ui.focus.FocusRequester import androidx.compose.ui.focus.focusProperties -import androidx.compose.ui.focus.focusRestorer import androidx.compose.ui.focus.onFocusChanged import androidx.compose.ui.geometry.Offset import androidx.compose.ui.graphics.Color import androidx.compose.ui.graphics.Shadow -import androidx.compose.ui.layout.ContentScale -import androidx.compose.ui.platform.LocalContext import androidx.compose.ui.text.TextStyle import androidx.compose.ui.text.font.FontWeight import androidx.compose.ui.text.style.TextAlign @@ -57,20 +52,11 @@ import androidx.compose.ui.unit.sp import androidx.tv.foundation.PivotOffsets import androidx.tv.foundation.lazy.list.TvLazyRow import androidx.tv.foundation.lazy.list.itemsIndexed -import androidx.tv.material3.Border -import androidx.tv.material3.CardDefaults -import androidx.tv.material3.CardLayoutDefaults -import androidx.tv.material3.ExperimentalTvMaterial3Api -import androidx.tv.material3.ImmersiveListScope import androidx.tv.material3.MaterialTheme -import androidx.tv.material3.StandardCardLayout import androidx.tv.material3.Text -import coil.compose.AsyncImage -import coil.request.ImageRequest import com.google.jetstream.data.entities.Movie +import com.google.jetstream.data.entities.MovieList import com.google.jetstream.presentation.screens.dashboard.rememberChildPadding -import com.google.jetstream.presentation.theme.JetStreamBorderWidth -import com.google.jetstream.presentation.theme.JetStreamCardShape import com.google.jetstream.presentation.utils.createInitialFocusRestorerModifiers import com.google.jetstream.presentation.utils.ifElse @@ -79,9 +65,9 @@ enum class ItemDirection(val aspectRatio: Float) { Horizontal(16f / 9f); } -@OptIn(ExperimentalTvMaterial3Api::class) @Composable fun MoviesRow( + movieList: MovieList, modifier: Modifier = Modifier, itemDirection: ItemDirection = ItemDirection.Vertical, startPadding: Dp = rememberChildPadding().start, @@ -93,26 +79,22 @@ fun MoviesRow( ), showItemTitle: Boolean = true, showIndexOverImage: Boolean = false, - focusedItemIndex: (index: Int) -> Unit = {}, - movies: List, - onMovieClick: (movie: Movie) -> Unit = {} + onMovieSelected: (movie: Movie) -> Unit = {} ) { Column( modifier = modifier.focusGroup() ) { - title?.let { nnTitle -> + if (title != null) { Text( - text = nnTitle, + text = title, style = titleStyle, modifier = Modifier .alpha(1f) - .padding(start = startPadding) - .padding(vertical = 16.dp) + .padding(start = startPadding, top = 16.dp, bottom = 16.dp) ) } - AnimatedContent( - targetState = movies, + targetState = movieList, label = "", ) { movieState -> val focusRestorerModifiers = createInitialFocusRestorerModifiers() @@ -135,10 +117,9 @@ fun MoviesRow( focusRestorerModifiers.childModifier ) .weight(1f), - focusedItemIndex = focusedItemIndex, index = index, itemDirection = itemDirection, - onMovieClick = onMovieClick, + onMovieSelected = onMovieSelected, movie = movie, showItemTitle = showItemTitle, showIndexOverImage = showIndexOverImage @@ -149,9 +130,10 @@ fun MoviesRow( } } -@OptIn(ExperimentalComposeUiApi::class, ExperimentalTvMaterial3Api::class) +@OptIn(ExperimentalComposeUiApi::class) @Composable -fun ImmersiveListScope.ImmersiveListMoviesRow( +fun ImmersiveListMoviesRow( + movieList: MovieList, modifier: Modifier = Modifier, itemDirection: ItemDirection = ItemDirection.Vertical, startPadding: Dp = rememberChildPadding().start, @@ -163,16 +145,15 @@ fun ImmersiveListScope.ImmersiveListMoviesRow( ), showItemTitle: Boolean = true, showIndexOverImage: Boolean = false, - focusedItemIndex: (index: Int) -> Unit = {}, - movies: List, - onMovieClick: (movie: Movie) -> Unit = {} + onMovieSelected: (Movie) -> Unit = {}, + onMovieFocused: (Movie) -> Unit = {} ) { Column( modifier = modifier.focusGroup() ) { - title?.let { nnTitle -> + if (title != null) { Text( - text = nnTitle, + text = title, style = titleStyle, modifier = Modifier .alpha(1f) @@ -180,34 +161,32 @@ fun ImmersiveListScope.ImmersiveListMoviesRow( .padding(vertical = 16.dp) ) } - AnimatedContent( - targetState = movies, + targetState = movieList, label = "", ) { movieState -> TvLazyRow( - modifier = Modifier.focusRestorer(), + // modifier = Modifier.focusRestorer(), pivotOffsets = PivotOffsets(parentFraction = 0.07f), contentPadding = PaddingValues(start = startPadding, end = endPadding), horizontalArrangement = Arrangement.spacedBy(20.dp) ) { - movieState.forEachIndexed { index, movie -> - item { - key(movie.id) { - MoviesRowItem( - modifier = Modifier - .weight(1f) - .immersiveListItem(index), - focusedItemIndex = focusedItemIndex, - index = index, - itemDirection = itemDirection, - onMovieClick = onMovieClick, - movie = movie, - showItemTitle = showItemTitle, - showIndexOverImage = showIndexOverImage - ) - } + itemsIndexed( + movieState, + key = { _, movie -> + movie.id } + ) { index, movie -> + MoviesRowItem( + modifier = Modifier.weight(1f), + index = index, + itemDirection = itemDirection, + onMovieSelected = onMovieSelected, + onMovieFocused = onMovieFocused, + movie = movie, + showItemTitle = showItemTitle, + showIndexOverImage = showIndexOverImage + ) } } } @@ -215,77 +194,63 @@ fun ImmersiveListScope.ImmersiveListMoviesRow( } @Composable -@OptIn(ExperimentalComposeUiApi::class, ExperimentalTvMaterial3Api::class) +@OptIn(ExperimentalComposeUiApi::class) private fun MoviesRowItem( - modifier: Modifier = Modifier, - focusedItemIndex: (index: Int) -> Unit, index: Int, - itemDirection: ItemDirection, - onMovieClick: (movie: Movie) -> Unit, movie: Movie, + onMovieSelected: (Movie) -> Unit, showItemTitle: Boolean, - showIndexOverImage: Boolean + showIndexOverImage: Boolean, + modifier: Modifier = Modifier, + itemDirection: ItemDirection = ItemDirection.Vertical, + onMovieFocused: (Movie) -> Unit = {}, ) { - var isItemFocused by remember { mutableStateOf(false) } + var isFocused by remember { mutableStateOf(false) } - StandardCardLayout( - modifier = Modifier - .onFocusChanged { - isItemFocused = it.isFocused - if (isItemFocused) { - focusedItemIndex(index) - } - } - .focusProperties { - if (index == 0) { - left = FocusRequester.Cancel - } - } - .then(modifier), + MovieCard( + onClick = { onMovieSelected(movie) }, title = { MoviesRowItemText( showItemTitle = showItemTitle, - isItemFocused = isItemFocused, + isItemFocused = isFocused, movie = movie ) }, - imageCard = { - CardLayoutDefaults.ImageCard( - onClick = { onMovieClick(movie) }, - shape = CardDefaults.shape(JetStreamCardShape), - border = CardDefaults.border( - focusedBorder = Border( - border = BorderStroke( - width = JetStreamBorderWidth, - color = MaterialTheme.colorScheme.onSurface - ), - shape = JetStreamCardShape - ) - ), - scale = CardDefaults.scale(focusedScale = 1f), - interactionSource = it - ) { - MoviesRowItemImage( - modifier = Modifier.aspectRatio(itemDirection.aspectRatio), - showIndexOverImage = showIndexOverImage, - movie = movie, - index = index - ) + modifier = Modifier + .onFocusChanged { + isFocused = it.isFocused + if (it.isFocused) { + onMovieFocused(movie) + } } - }, - ) + .focusProperties { + left = if (index == 0) { + FocusRequester.Cancel + } else { + FocusRequester.Default + } + } + .then(modifier) + ) { + MoviesRowItemImage( + modifier = Modifier.aspectRatio(itemDirection.aspectRatio), + showIndexOverImage = showIndexOverImage, + movie = movie, + index = index + ) + } } -@OptIn(ExperimentalTvMaterial3Api::class) @Composable private fun MoviesRowItemImage( - showIndexOverImage: Boolean, movie: Movie, + showIndexOverImage: Boolean, index: Int, modifier: Modifier = Modifier, ) { Box(contentAlignment = Alignment.CenterStart) { - AsyncImage( + PosterImage( + movie = movie, modifier = modifier .fillMaxWidth() .drawWithContent { @@ -298,12 +263,6 @@ private fun MoviesRowItemImage( ) } }, - model = ImageRequest.Builder(LocalContext.current) - .crossfade(true) - .data(movie.posterUri) - .build(), - contentDescription = "movie poster of ${movie.name}", - contentScale = ContentScale.Crop ) if (showIndexOverImage) { Text( @@ -323,7 +282,6 @@ private fun MoviesRowItemImage( } } -@OptIn(ExperimentalTvMaterial3Api::class) @Composable private fun MoviesRowItemText( showItemTitle: Boolean, diff --git a/JetStreamCompose/jetstream/src/main/java/com/google/jetstream/presentation/screens/Screens.kt b/JetStreamCompose/jetstream/src/main/java/com/google/jetstream/presentation/screens/Screens.kt index 8a48495c..b9cd2cd6 100644 --- a/JetStreamCompose/jetstream/src/main/java/com/google/jetstream/presentation/screens/Screens.kt +++ b/JetStreamCompose/jetstream/src/main/java/com/google/jetstream/presentation/screens/Screens.kt @@ -5,7 +5,7 @@ * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * - * https://www.apache.org/licenses/LICENSE-2.0 + * https://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, diff --git a/JetStreamCompose/jetstream/src/main/java/com/google/jetstream/presentation/screens/categories/CategoriesScreen.kt b/JetStreamCompose/jetstream/src/main/java/com/google/jetstream/presentation/screens/categories/CategoriesScreen.kt index 2ba7e7c2..88491cd8 100644 --- a/JetStreamCompose/jetstream/src/main/java/com/google/jetstream/presentation/screens/categories/CategoriesScreen.kt +++ b/JetStreamCompose/jetstream/src/main/java/com/google/jetstream/presentation/screens/categories/CategoriesScreen.kt @@ -5,7 +5,7 @@ * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * - * https://www.apache.org/licenses/LICENSE-2.0 + * https://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, @@ -18,7 +18,6 @@ package com.google.jetstream.presentation.screens.categories import androidx.compose.animation.AnimatedContent import androidx.compose.animation.core.animateFloatAsState -import androidx.compose.foundation.BorderStroke import androidx.compose.foundation.layout.Box import androidx.compose.foundation.layout.aspectRatio import androidx.compose.foundation.layout.fillMaxSize @@ -45,17 +44,12 @@ import androidx.tv.foundation.lazy.grid.TvGridCells import androidx.tv.foundation.lazy.grid.TvLazyVerticalGrid import androidx.tv.foundation.lazy.grid.itemsIndexed import androidx.tv.foundation.lazy.grid.rememberTvLazyGridState -import androidx.tv.material3.Border -import androidx.tv.material3.CardDefaults -import androidx.tv.material3.CardLayoutDefaults -import androidx.tv.material3.ExperimentalTvMaterial3Api import androidx.tv.material3.MaterialTheme -import androidx.tv.material3.StandardCardLayout import androidx.tv.material3.Text import com.google.jetstream.data.entities.MovieCategoryList +import com.google.jetstream.presentation.common.Loading +import com.google.jetstream.presentation.common.MovieCard import com.google.jetstream.presentation.screens.dashboard.rememberChildPadding -import com.google.jetstream.presentation.theme.JetStreamBorderWidth -import com.google.jetstream.presentation.theme.JetStreamCardShape import com.google.jetstream.presentation.utils.GradientBg @Composable @@ -69,9 +63,10 @@ fun CategoriesScreen( val uiState by categoriesScreenViewModel.uiState.collectAsStateWithLifecycle() when (val s = uiState) { - is CategoriesScreenUiState.Loading -> { + CategoriesScreenUiState.Loading -> { Loading() } + is CategoriesScreenUiState.Ready -> { Catalog( gridColumns = gridColumns, @@ -82,10 +77,9 @@ fun CategoriesScreen( ) } } - } -@OptIn(ExperimentalComposeUiApi::class, ExperimentalTvMaterial3Api::class) +@OptIn(ExperimentalComposeUiApi::class) @Composable private fun Catalog( movieCategories: MovieCategoryList, @@ -99,7 +93,7 @@ private fun Catalog( val shouldShowTopBar by remember { derivedStateOf { tvLazyGridState.firstVisibleItemIndex == 0 && - tvLazyGridState.firstVisibleItemScrollOffset < 100 + tvLazyGridState.firstVisibleItemScrollOffset < 100 } } LaunchedEffect(shouldShowTopBar) { @@ -117,73 +111,44 @@ private fun Catalog( state = tvLazyGridState, modifier = modifier, columns = TvGridCells.Fixed(gridColumns), - content = { - itemsIndexed(it) { index, movieCategory -> - var isFocused by remember { mutableStateOf(false) } - StandardCardLayout( - imageCard = { - CardLayoutDefaults.ImageCard( - shape = CardDefaults.shape(shape = JetStreamCardShape), - border = CardDefaults.border( - focusedBorder = Border( - border = BorderStroke( - width = JetStreamBorderWidth, - color = MaterialTheme.colorScheme.onSurface - ), - shape = JetStreamCardShape - ), - pressedBorder = Border( - border = BorderStroke( - width = JetStreamBorderWidth, - color = MaterialTheme.colorScheme.border - ), - shape = JetStreamCardShape - ) - ), - scale = CardDefaults.scale(focusedScale = 1f), - onClick = { onCategoryClick(movieCategory.id) }, - interactionSource = it - ) { - val itemAlpha by animateFloatAsState( - targetValue = if (isFocused) .6f else 0.2f, - label = "" - ) - val textColor = if (isFocused) Color.White else Color.White - - Box(contentAlignment = Alignment.Center) { - Box(modifier = Modifier.alpha(itemAlpha)) { - GradientBg() - } - Text( - text = movieCategory.name, - style = MaterialTheme.typography.titleMedium.copy( - color = textColor, - ) - ) - } - } - }, - modifier = Modifier - .padding(8.dp) - .aspectRatio(16 / 9f) - .onFocusChanged { - isFocused = it.isFocused || it.hasFocus + ) { + itemsIndexed(it) { index, movieCategory -> + var isFocused by remember { mutableStateOf(false) } + MovieCard( + onClick = { + onCategoryClick(movieCategory.id) + }, + modifier = Modifier + .padding(8.dp) + .aspectRatio(16 / 9f) + .onFocusChanged { + isFocused = it.isFocused || it.hasFocus + } + .focusProperties { + if (index % gridColumns == 0) { + left = FocusRequester.Cancel } - .focusProperties { - if (index % gridColumns == 0) { - left = FocusRequester.Cancel - } - }, - title = {} + } + ) { + val itemAlpha by animateFloatAsState( + targetValue = if (isFocused) .6f else 0.2f, + label = "" ) + val textColor = if (isFocused) Color.White else Color.White + + Box(contentAlignment = Alignment.Center) { + Box(modifier = Modifier.alpha(itemAlpha)) { + GradientBg() + } + Text( + text = movieCategory.name, + style = MaterialTheme.typography.titleMedium.copy( + color = textColor, + ) + ) + } } } - ) + } } } - -@OptIn(ExperimentalTvMaterial3Api::class) -@Composable -private fun Loading(modifier: Modifier = Modifier) { - Text(text = "Loading...", modifier = modifier) -} \ No newline at end of file diff --git a/JetStreamCompose/jetstream/src/main/java/com/google/jetstream/presentation/screens/categories/CategoriesScreenViewModel.kt b/JetStreamCompose/jetstream/src/main/java/com/google/jetstream/presentation/screens/categories/CategoriesScreenViewModel.kt index eadfd8f0..6a2127d3 100644 --- a/JetStreamCompose/jetstream/src/main/java/com/google/jetstream/presentation/screens/categories/CategoriesScreenViewModel.kt +++ b/JetStreamCompose/jetstream/src/main/java/com/google/jetstream/presentation/screens/categories/CategoriesScreenViewModel.kt @@ -5,7 +5,7 @@ * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * - * http://www.apache.org/licenses/LICENSE-2.0 + * https://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, @@ -21,15 +21,15 @@ import androidx.lifecycle.viewModelScope import com.google.jetstream.data.entities.MovieCategoryList import com.google.jetstream.data.repositories.MovieRepository import dagger.hilt.android.lifecycle.HiltViewModel +import javax.inject.Inject import kotlinx.coroutines.flow.SharingStarted import kotlinx.coroutines.flow.map import kotlinx.coroutines.flow.stateIn -import javax.inject.Inject @HiltViewModel class CategoriesScreenViewModel @Inject constructor( movieRepository: MovieRepository -): ViewModel() { +) : ViewModel() { val uiState = movieRepository.getMovieCategories().map { CategoriesScreenUiState.Ready(categoryList = it) @@ -38,12 +38,10 @@ class CategoriesScreenViewModel @Inject constructor( started = SharingStarted.WhileSubscribed(5_000), initialValue = CategoriesScreenUiState.Loading ) - } sealed interface CategoriesScreenUiState { - object Loading: CategoriesScreenUiState - data class Ready(val categoryList: MovieCategoryList): CategoriesScreenUiState - -} \ No newline at end of file + data object Loading : CategoriesScreenUiState + data class Ready(val categoryList: MovieCategoryList) : CategoriesScreenUiState +} diff --git a/JetStreamCompose/jetstream/src/main/java/com/google/jetstream/presentation/screens/categories/CategoryMovieListScreen.kt b/JetStreamCompose/jetstream/src/main/java/com/google/jetstream/presentation/screens/categories/CategoryMovieListScreen.kt index 5a6b02a7..8a3da6f5 100644 --- a/JetStreamCompose/jetstream/src/main/java/com/google/jetstream/presentation/screens/categories/CategoryMovieListScreen.kt +++ b/JetStreamCompose/jetstream/src/main/java/com/google/jetstream/presentation/screens/categories/CategoryMovieListScreen.kt @@ -5,7 +5,7 @@ * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * - * https://www.apache.org/licenses/LICENSE-2.0 + * https://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, @@ -17,7 +17,6 @@ package com.google.jetstream.presentation.screens.categories import androidx.activity.compose.BackHandler -import androidx.compose.foundation.BorderStroke import androidx.compose.foundation.layout.Column import androidx.compose.foundation.layout.PaddingValues import androidx.compose.foundation.layout.aspectRatio @@ -25,35 +24,27 @@ import androidx.compose.foundation.layout.fillMaxSize import androidx.compose.foundation.layout.padding import androidx.compose.runtime.Composable import androidx.compose.runtime.getValue -import androidx.compose.runtime.key import androidx.compose.runtime.mutableStateOf import androidx.compose.runtime.remember import androidx.compose.ui.Alignment import androidx.compose.ui.Modifier -import androidx.compose.ui.layout.ContentScale -import androidx.compose.ui.platform.LocalContext import androidx.compose.ui.text.font.FontWeight import androidx.compose.ui.unit.dp import androidx.hilt.navigation.compose.hiltViewModel import androidx.lifecycle.compose.collectAsStateWithLifecycle import androidx.tv.foundation.lazy.grid.TvGridCells import androidx.tv.foundation.lazy.grid.TvLazyVerticalGrid -import androidx.tv.material3.Border -import androidx.tv.material3.CardDefaults -import androidx.tv.material3.CardLayoutDefaults -import androidx.tv.material3.ExperimentalTvMaterial3Api +import androidx.tv.foundation.lazy.grid.itemsIndexed import androidx.tv.material3.MaterialTheme -import androidx.tv.material3.StandardCardLayout import androidx.tv.material3.Text -import coil.compose.AsyncImage -import coil.request.ImageRequest import com.google.jetstream.data.entities.Movie import com.google.jetstream.data.entities.MovieCategoryDetails -import com.google.jetstream.data.util.StringConstants +import com.google.jetstream.presentation.common.Error +import com.google.jetstream.presentation.common.Loading +import com.google.jetstream.presentation.common.MovieCard +import com.google.jetstream.presentation.common.PosterImage import com.google.jetstream.presentation.screens.dashboard.rememberChildPadding -import com.google.jetstream.presentation.theme.JetStreamBorderWidth import com.google.jetstream.presentation.theme.JetStreamBottomListPadding -import com.google.jetstream.presentation.theme.JetStreamCardShape import com.google.jetstream.presentation.utils.focusOnInitialVisibility object CategoryMovieListScreen { @@ -69,11 +60,11 @@ fun CategoryMovieListScreen( val uiState by categoryMovieListScreenViewModel.uiState.collectAsStateWithLifecycle() when (val s = uiState) { - is CategoryMovieListScreenUiState.Loading -> { + CategoryMovieListScreenUiState.Loading -> { Loading() } - is CategoryMovieListScreenUiState.Error -> { + CategoryMovieListScreenUiState.Error -> { Error() } @@ -86,10 +77,8 @@ fun CategoryMovieListScreen( ) } } - } -@OptIn(ExperimentalTvMaterial3Api::class) @Composable private fun CategoryDetails( categoryDetails: MovieCategoryDetails, @@ -119,72 +108,26 @@ private fun CategoryDetails( columns = TvGridCells.Fixed(6), contentPadding = PaddingValues(bottom = JetStreamBottomListPadding) ) { - categoryDetails.movies.forEachIndexed { index, movie -> - item { - key(movie.id) { - StandardCardLayout( - modifier = Modifier - .aspectRatio(1 / 1.5f) - .padding(8.dp) - .then( - if (index == 0) - Modifier.focusOnInitialVisibility(isFirstItemVisible) - else Modifier - ), - imageCard = { - CardLayoutDefaults.ImageCard( - shape = CardDefaults.shape(shape = JetStreamCardShape), - border = CardDefaults.border( - focusedBorder = Border( - border = BorderStroke( - width = JetStreamBorderWidth, - color = MaterialTheme.colorScheme.onSurface - ), - shape = JetStreamCardShape - ), - pressedBorder = Border( - border = BorderStroke( - width = JetStreamBorderWidth, - color = MaterialTheme.colorScheme.border - ), - shape = JetStreamCardShape - ), - ), - scale = CardDefaults.scale(focusedScale = 1f), - onClick = { onMovieSelected(movie) }, - interactionSource = it - ) { - AsyncImage( - model = ImageRequest.Builder(LocalContext.current) - .data(movie.posterUri) - .crossfade(true) - .build(), - contentDescription = StringConstants - .Composable - .ContentDescription - .moviePoster(movie.name), - contentScale = ContentScale.Crop, - modifier = Modifier.fillMaxSize() - ) - } - }, - title = {}, - ) - } + itemsIndexed( + categoryDetails.movies, + key = { _, movie -> + movie.id + } + ) { index, movie -> + MovieCard( + onClick = { onMovieSelected(movie) }, + modifier = Modifier + .aspectRatio(1 / 1.5f) + .padding(8.dp) + .then( + if (index == 0) + Modifier.focusOnInitialVisibility(isFirstItemVisible) + else Modifier + ), + ) { + PosterImage(movie = movie, modifier = Modifier.fillMaxSize()) } } } } } - -@OptIn(ExperimentalTvMaterial3Api::class) -@Composable -private fun Loading(modifier: Modifier = Modifier) { - Text(text = "Loading...", modifier = modifier) -} - -@OptIn(ExperimentalTvMaterial3Api::class) -@Composable -private fun Error(modifier: Modifier = Modifier) { - Text(text = "Wops, something went wrong...", modifier = modifier) -} \ No newline at end of file diff --git a/JetStreamCompose/jetstream/src/main/java/com/google/jetstream/presentation/screens/categories/CategoryMovieListScreenViewModel.kt b/JetStreamCompose/jetstream/src/main/java/com/google/jetstream/presentation/screens/categories/CategoryMovieListScreenViewModel.kt index 27e5c414..623a6ebf 100644 --- a/JetStreamCompose/jetstream/src/main/java/com/google/jetstream/presentation/screens/categories/CategoryMovieListScreenViewModel.kt +++ b/JetStreamCompose/jetstream/src/main/java/com/google/jetstream/presentation/screens/categories/CategoryMovieListScreenViewModel.kt @@ -5,7 +5,7 @@ * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * - * http://www.apache.org/licenses/LICENSE-2.0 + * https://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, @@ -22,10 +22,10 @@ import androidx.lifecycle.viewModelScope import com.google.jetstream.data.entities.MovieCategoryDetails import com.google.jetstream.data.repositories.MovieRepository import dagger.hilt.android.lifecycle.HiltViewModel +import javax.inject.Inject import kotlinx.coroutines.flow.SharingStarted import kotlinx.coroutines.flow.map import kotlinx.coroutines.flow.stateIn -import javax.inject.Inject @HiltViewModel class CategoryMovieListScreenViewModel @Inject constructor( @@ -49,11 +49,10 @@ class CategoryMovieListScreenViewModel @Inject constructor( started = SharingStarted.WhileSubscribed(5_000), initialValue = CategoryMovieListScreenUiState.Loading ) - } sealed interface CategoryMovieListScreenUiState { object Loading : CategoryMovieListScreenUiState object Error : CategoryMovieListScreenUiState data class Done(val movieCategoryDetails: MovieCategoryDetails) : CategoryMovieListScreenUiState -} \ No newline at end of file +} diff --git a/JetStreamCompose/jetstream/src/main/java/com/google/jetstream/presentation/screens/dashboard/DashboardScreen.kt b/JetStreamCompose/jetstream/src/main/java/com/google/jetstream/presentation/screens/dashboard/DashboardScreen.kt index 8b47a10b..a84ccf74 100644 --- a/JetStreamCompose/jetstream/src/main/java/com/google/jetstream/presentation/screens/dashboard/DashboardScreen.kt +++ b/JetStreamCompose/jetstream/src/main/java/com/google/jetstream/presentation/screens/dashboard/DashboardScreen.kt @@ -5,7 +5,7 @@ * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * - * https://www.apache.org/licenses/LICENSE-2.0 + * https://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, diff --git a/JetStreamCompose/jetstream/src/main/java/com/google/jetstream/presentation/screens/dashboard/DashboardTopBarItemIndicator.kt b/JetStreamCompose/jetstream/src/main/java/com/google/jetstream/presentation/screens/dashboard/DashboardTopBarItemIndicator.kt index 145a8786..5d724366 100644 --- a/JetStreamCompose/jetstream/src/main/java/com/google/jetstream/presentation/screens/dashboard/DashboardTopBarItemIndicator.kt +++ b/JetStreamCompose/jetstream/src/main/java/com/google/jetstream/presentation/screens/dashboard/DashboardTopBarItemIndicator.kt @@ -5,7 +5,7 @@ * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * - * https://www.apache.org/licenses/LICENSE-2.0 + * https://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, diff --git a/JetStreamCompose/jetstream/src/main/java/com/google/jetstream/presentation/screens/favourites/FavouriteScreenViewModel.kt b/JetStreamCompose/jetstream/src/main/java/com/google/jetstream/presentation/screens/favourites/FavouriteScreenViewModel.kt index f0825f1b..b77b785f 100644 --- a/JetStreamCompose/jetstream/src/main/java/com/google/jetstream/presentation/screens/favourites/FavouriteScreenViewModel.kt +++ b/JetStreamCompose/jetstream/src/main/java/com/google/jetstream/presentation/screens/favourites/FavouriteScreenViewModel.kt @@ -5,7 +5,7 @@ * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * - * http://www.apache.org/licenses/LICENSE-2.0 + * https://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, @@ -24,19 +24,18 @@ import com.google.jetstream.R import com.google.jetstream.data.entities.MovieList import com.google.jetstream.data.repositories.MovieRepository import dagger.hilt.android.lifecycle.HiltViewModel +import javax.inject.Inject import kotlinx.coroutines.flow.MutableStateFlow import kotlinx.coroutines.flow.SharingStarted import kotlinx.coroutines.flow.StateFlow import kotlinx.coroutines.flow.combine import kotlinx.coroutines.flow.stateIn -import javax.inject.Inject @HiltViewModel class FavouriteScreenViewModel @Inject constructor( movieRepository: MovieRepository ) : ViewModel() { - private val selectedFilterList = MutableStateFlow(FilterList()) val uiState: StateFlow = combine( @@ -74,7 +73,6 @@ sealed interface FavouriteScreenUiState { data object Loading : FavouriteScreenUiState data class Ready(val favouriteMovieList: MovieList, val selectedFilterList: FilterList) : FavouriteScreenUiState - } @Immutable @@ -98,4 +96,4 @@ enum class FilterCondition(val idList: List, @StringRes val labelId: Int) { TvShows((10..17).toList(), R.string.favorites_tv_shows), AddedLastWeek((18..23).toList(), R.string.favorites_added_last_week), AvailableIn4K((24..28).toList(), R.string.favorites_available_in_4k), -} \ No newline at end of file +} diff --git a/JetStreamCompose/jetstream/src/main/java/com/google/jetstream/presentation/screens/favourites/FavouritesScreen.kt b/JetStreamCompose/jetstream/src/main/java/com/google/jetstream/presentation/screens/favourites/FavouritesScreen.kt index 3bb87022..b9e2b6ff 100644 --- a/JetStreamCompose/jetstream/src/main/java/com/google/jetstream/presentation/screens/favourites/FavouritesScreen.kt +++ b/JetStreamCompose/jetstream/src/main/java/com/google/jetstream/presentation/screens/favourites/FavouritesScreen.kt @@ -5,7 +5,7 @@ * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * - * https://www.apache.org/licenses/LICENSE-2.0 + * https://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, @@ -85,7 +85,7 @@ private fun Catalog( val shouldShowTopBar by remember { derivedStateOf { filteredMoviesGridState.firstVisibleItemIndex == 0 && - filteredMoviesGridState.firstVisibleItemScrollOffset < 100 + filteredMoviesGridState.firstVisibleItemScrollOffset < 100 } } @@ -104,17 +104,16 @@ private fun Catalog( horizontalAlignment = Alignment.CenterHorizontally, modifier = modifier.padding(horizontal = childPadding.start) ) { - MovieFilterChipRow( - filterList = filterList, - selectedFilterList = selectedFilterList, - modifier = Modifier.padding(top = chipRowTopPadding), - onSelectedFilterListUpdated = onSelectedFilterListUpdated - ) - FilteredMoviesGrid( - state = filteredMoviesGridState, - movieList = favouriteMovieList, - onMovieClick = onMovieClick - ) - } - + MovieFilterChipRow( + filterList = filterList, + selectedFilterList = selectedFilterList, + modifier = Modifier.padding(top = chipRowTopPadding), + onSelectedFilterListUpdated = onSelectedFilterListUpdated + ) + FilteredMoviesGrid( + state = filteredMoviesGridState, + movieList = favouriteMovieList, + onMovieClick = onMovieClick + ) + } } diff --git a/JetStreamCompose/jetstream/src/main/java/com/google/jetstream/presentation/screens/favourites/MovieFilterChip.kt b/JetStreamCompose/jetstream/src/main/java/com/google/jetstream/presentation/screens/favourites/MovieFilterChip.kt index d63d5758..14b6e0fa 100644 --- a/JetStreamCompose/jetstream/src/main/java/com/google/jetstream/presentation/screens/favourites/MovieFilterChip.kt +++ b/JetStreamCompose/jetstream/src/main/java/com/google/jetstream/presentation/screens/favourites/MovieFilterChip.kt @@ -5,7 +5,7 @@ * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * - * https://www.apache.org/licenses/LICENSE-2.0 + * https://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, @@ -75,7 +75,8 @@ fun MovieFilterChip( AnimatedVisibility(visible = isChecked) { Icon( Icons.Default.Check, - contentDescription = StringConstants.Composable.ContentDescription.FilterSelected, + contentDescription = + StringConstants.Composable.ContentDescription.FilterSelected, modifier = Modifier.size(16.dp) ) } @@ -85,7 +86,8 @@ fun MovieFilterChip( border = Border( border = BorderStroke( width = 1.dp, color = MaterialTheme.colorScheme.border.copy(alpha = 0.5f) - ), shape = JetStreamCardShape + ), + shape = JetStreamCardShape ), focusedBorder = ChipFocusedBorder, ), @@ -115,5 +117,6 @@ private val ChipFocusedBorder border = BorderStroke( width = 1.5.dp, color = MaterialTheme.colorScheme.onSurface, - ), shape = JetStreamCardShape + ), + shape = JetStreamCardShape ) diff --git a/JetStreamCompose/jetstream/src/main/java/com/google/jetstream/presentation/screens/favourites/MovieFilterChipRow.kt b/JetStreamCompose/jetstream/src/main/java/com/google/jetstream/presentation/screens/favourites/MovieFilterChipRow.kt index 3f62ecfa..81f08d99 100644 --- a/JetStreamCompose/jetstream/src/main/java/com/google/jetstream/presentation/screens/favourites/MovieFilterChipRow.kt +++ b/JetStreamCompose/jetstream/src/main/java/com/google/jetstream/presentation/screens/favourites/MovieFilterChipRow.kt @@ -5,7 +5,7 @@ * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * - * https://www.apache.org/licenses/LICENSE-2.0 + * https://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, @@ -61,4 +61,4 @@ fun MovieFilterChipRow( ) } } -} \ No newline at end of file +} diff --git a/JetStreamCompose/jetstream/src/main/java/com/google/jetstream/presentation/screens/home/FeaturedMoviesCarousel.kt b/JetStreamCompose/jetstream/src/main/java/com/google/jetstream/presentation/screens/home/FeaturedMoviesCarousel.kt index 8bb187a0..0abab438 100644 --- a/JetStreamCompose/jetstream/src/main/java/com/google/jetstream/presentation/screens/home/FeaturedMoviesCarousel.kt +++ b/JetStreamCompose/jetstream/src/main/java/com/google/jetstream/presentation/screens/home/FeaturedMoviesCarousel.kt @@ -5,7 +5,7 @@ * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * - * https://www.apache.org/licenses/LICENSE-2.0 + * https://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, @@ -92,13 +92,18 @@ fun FeaturedMoviesCarousel( ) { val carouselState = rememberSaveable(saver = CarouselSaver) { CarouselState(0) } var isCarouselFocused by remember { mutableStateOf(false) } + val alpha = if (isCarouselFocused) { + 1f + } else { + 0f + } Carousel( modifier = modifier .padding(start = padding.start, end = padding.start, top = padding.top) .border( width = JetStreamBorderWidth, - color = MaterialTheme.colorScheme.onSurface.copy(alpha = if (isCarouselFocused) 1f else 0f), + color = MaterialTheme.colorScheme.onSurface.copy(alpha = alpha), shape = ShapeDefaults.Medium, ) .clip(ShapeDefaults.Medium) diff --git a/JetStreamCompose/jetstream/src/main/java/com/google/jetstream/presentation/screens/home/HomeScreenViewModel.kt b/JetStreamCompose/jetstream/src/main/java/com/google/jetstream/presentation/screens/home/HomeScreenViewModel.kt index 9d660336..7a52e210 100644 --- a/JetStreamCompose/jetstream/src/main/java/com/google/jetstream/presentation/screens/home/HomeScreenViewModel.kt +++ b/JetStreamCompose/jetstream/src/main/java/com/google/jetstream/presentation/screens/home/HomeScreenViewModel.kt @@ -5,7 +5,7 @@ * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * - * http://www.apache.org/licenses/LICENSE-2.0 + * https://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, @@ -21,14 +21,14 @@ import androidx.lifecycle.viewModelScope import com.google.jetstream.data.entities.MovieList import com.google.jetstream.data.repositories.MovieRepository import dagger.hilt.android.lifecycle.HiltViewModel +import javax.inject.Inject import kotlinx.coroutines.flow.SharingStarted import kotlinx.coroutines.flow.StateFlow import kotlinx.coroutines.flow.combine import kotlinx.coroutines.flow.stateIn -import javax.inject.Inject @HiltViewModel -class HomeScreeViewModel @Inject constructor(movieRepository: MovieRepository): ViewModel() { +class HomeScreeViewModel @Inject constructor(movieRepository: MovieRepository) : ViewModel() { val uiState: StateFlow = combine( movieRepository.getFeaturedMovies(), @@ -36,23 +36,26 @@ class HomeScreeViewModel @Inject constructor(movieRepository: MovieRepository): movieRepository.getTop10Movies(), movieRepository.getNowPlayingMovies(), ) { featuredMovieList, trendingMovieList, top10MovieList, nowPlayingMovieList -> - HomeScreenUiState.Ready(featuredMovieList, trendingMovieList, top10MovieList, nowPlayingMovieList) + HomeScreenUiState.Ready( + featuredMovieList, + trendingMovieList, + top10MovieList, + nowPlayingMovieList + ) }.stateIn( scope = viewModelScope, started = SharingStarted.WhileSubscribed(5_000), initialValue = HomeScreenUiState.Loading ) - } sealed interface HomeScreenUiState { - data object Loading: HomeScreenUiState - data object Error: HomeScreenUiState + data object Loading : HomeScreenUiState + data object Error : HomeScreenUiState data class Ready( val featuredMovieList: MovieList, val trendingMovieList: MovieList, val top10MovieList: MovieList, val nowPlayingMovieList: MovieList - ): HomeScreenUiState - -} \ No newline at end of file + ) : HomeScreenUiState +} diff --git a/JetStreamCompose/jetstream/src/main/java/com/google/jetstream/presentation/screens/movies/CastAndCrewList.kt b/JetStreamCompose/jetstream/src/main/java/com/google/jetstream/presentation/screens/movies/CastAndCrewList.kt index a318645a..f90ddd5e 100644 --- a/JetStreamCompose/jetstream/src/main/java/com/google/jetstream/presentation/screens/movies/CastAndCrewList.kt +++ b/JetStreamCompose/jetstream/src/main/java/com/google/jetstream/presentation/screens/movies/CastAndCrewList.kt @@ -5,7 +5,7 @@ * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * - * https://www.apache.org/licenses/LICENSE-2.0 + * https://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, diff --git a/JetStreamCompose/jetstream/src/main/java/com/google/jetstream/presentation/screens/movies/DotSeparatedRow.kt b/JetStreamCompose/jetstream/src/main/java/com/google/jetstream/presentation/screens/movies/DotSeparatedRow.kt index 068f99b1..324e0d64 100644 --- a/JetStreamCompose/jetstream/src/main/java/com/google/jetstream/presentation/screens/movies/DotSeparatedRow.kt +++ b/JetStreamCompose/jetstream/src/main/java/com/google/jetstream/presentation/screens/movies/DotSeparatedRow.kt @@ -5,7 +5,7 @@ * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * - * https://www.apache.org/licenses/LICENSE-2.0 + * https://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, diff --git a/JetStreamCompose/jetstream/src/main/java/com/google/jetstream/presentation/screens/movies/MovieDetails.kt b/JetStreamCompose/jetstream/src/main/java/com/google/jetstream/presentation/screens/movies/MovieDetails.kt index aa350864..b7ded2f1 100644 --- a/JetStreamCompose/jetstream/src/main/java/com/google/jetstream/presentation/screens/movies/MovieDetails.kt +++ b/JetStreamCompose/jetstream/src/main/java/com/google/jetstream/presentation/screens/movies/MovieDetails.kt @@ -5,7 +5,7 @@ * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * - * https://www.apache.org/licenses/LICENSE-2.0 + * https://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, @@ -122,7 +122,6 @@ fun MovieDetails( } } - @OptIn(ExperimentalTvMaterial3Api::class) @Composable private fun WatchTrailerButton( diff --git a/JetStreamCompose/jetstream/src/main/java/com/google/jetstream/presentation/screens/movies/MovieDetailsScreenViewModel.kt b/JetStreamCompose/jetstream/src/main/java/com/google/jetstream/presentation/screens/movies/MovieDetailsScreenViewModel.kt index aff42cb6..2a405df1 100644 --- a/JetStreamCompose/jetstream/src/main/java/com/google/jetstream/presentation/screens/movies/MovieDetailsScreenViewModel.kt +++ b/JetStreamCompose/jetstream/src/main/java/com/google/jetstream/presentation/screens/movies/MovieDetailsScreenViewModel.kt @@ -5,7 +5,7 @@ * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * - * http://www.apache.org/licenses/LICENSE-2.0 + * https://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, @@ -22,10 +22,10 @@ import androidx.lifecycle.viewModelScope import com.google.jetstream.data.entities.MovieDetails import com.google.jetstream.data.repositories.MovieRepository import dagger.hilt.android.lifecycle.HiltViewModel +import javax.inject.Inject import kotlinx.coroutines.flow.SharingStarted import kotlinx.coroutines.flow.map import kotlinx.coroutines.flow.stateIn -import javax.inject.Inject @HiltViewModel class MovieDetailsScreenViewModel @Inject constructor( @@ -49,7 +49,7 @@ class MovieDetailsScreenViewModel @Inject constructor( } sealed class MovieDetailsScreenUiState { - object Loading : MovieDetailsScreenUiState() - object Error : MovieDetailsScreenUiState() + data object Loading : MovieDetailsScreenUiState() + data object Error : MovieDetailsScreenUiState() data class Done(val movieDetails: MovieDetails) : MovieDetailsScreenUiState() -} \ No newline at end of file +} diff --git a/JetStreamCompose/jetstream/src/main/java/com/google/jetstream/presentation/screens/movies/MovieReviews.kt b/JetStreamCompose/jetstream/src/main/java/com/google/jetstream/presentation/screens/movies/MovieReviews.kt index 72af38ee..c2355b67 100644 --- a/JetStreamCompose/jetstream/src/main/java/com/google/jetstream/presentation/screens/movies/MovieReviews.kt +++ b/JetStreamCompose/jetstream/src/main/java/com/google/jetstream/presentation/screens/movies/MovieReviews.kt @@ -5,7 +5,7 @@ * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * - * https://www.apache.org/licenses/LICENSE-2.0 + * https://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, diff --git a/JetStreamCompose/jetstream/src/main/java/com/google/jetstream/presentation/screens/movies/MoviesScreenMovieList.kt b/JetStreamCompose/jetstream/src/main/java/com/google/jetstream/presentation/screens/movies/MoviesScreenMovieList.kt index 10ff1032..7549ce52 100644 --- a/JetStreamCompose/jetstream/src/main/java/com/google/jetstream/presentation/screens/movies/MoviesScreenMovieList.kt +++ b/JetStreamCompose/jetstream/src/main/java/com/google/jetstream/presentation/screens/movies/MoviesScreenMovieList.kt @@ -5,7 +5,7 @@ * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * - * https://www.apache.org/licenses/LICENSE-2.0 + * https://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, @@ -87,7 +87,6 @@ fun MoviesScreenMovieList( } } - @OptIn(ExperimentalTvMaterial3Api::class) @Composable private fun MovieListItem( diff --git a/JetStreamCompose/jetstream/src/main/java/com/google/jetstream/presentation/screens/movies/MoviesScreenViewModel.kt b/JetStreamCompose/jetstream/src/main/java/com/google/jetstream/presentation/screens/movies/MoviesScreenViewModel.kt index 30bc2958..f8a16dba 100644 --- a/JetStreamCompose/jetstream/src/main/java/com/google/jetstream/presentation/screens/movies/MoviesScreenViewModel.kt +++ b/JetStreamCompose/jetstream/src/main/java/com/google/jetstream/presentation/screens/movies/MoviesScreenViewModel.kt @@ -5,7 +5,7 @@ * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * - * http://www.apache.org/licenses/LICENSE-2.0 + * https://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, @@ -21,10 +21,10 @@ import androidx.lifecycle.viewModelScope import com.google.jetstream.data.entities.MovieList import com.google.jetstream.data.repositories.MovieRepository import dagger.hilt.android.lifecycle.HiltViewModel +import javax.inject.Inject import kotlinx.coroutines.flow.SharingStarted import kotlinx.coroutines.flow.combine import kotlinx.coroutines.flow.stateIn -import javax.inject.Inject @HiltViewModel class MoviesScreenViewModel @Inject constructor( @@ -35,16 +35,21 @@ class MoviesScreenViewModel @Inject constructor( movieRepository.getMoviesWithLongThumbnail(), movieRepository.getPopularFilmsThisWeek(), ) { (movieList, popularFilmsThisWeek) -> - MoviesScreenUiState.Ready(movieList = movieList, popularFilmsThisWeek = popularFilmsThisWeek) + MoviesScreenUiState.Ready( + movieList = movieList, + popularFilmsThisWeek = popularFilmsThisWeek + ) }.stateIn( scope = viewModelScope, started = SharingStarted.WhileSubscribed(5_000), initialValue = MoviesScreenUiState.Loading ) - } sealed interface MoviesScreenUiState { - object Loading: MoviesScreenUiState - data class Ready(val movieList: MovieList, val popularFilmsThisWeek: MovieList): MoviesScreenUiState -} \ No newline at end of file + data object Loading : MoviesScreenUiState + data class Ready( + val movieList: MovieList, + val popularFilmsThisWeek: MovieList + ) : MoviesScreenUiState +} diff --git a/JetStreamCompose/jetstream/src/main/java/com/google/jetstream/presentation/screens/movies/TitleValueText.kt b/JetStreamCompose/jetstream/src/main/java/com/google/jetstream/presentation/screens/movies/TitleValueText.kt index 8a744429..208070dd 100644 --- a/JetStreamCompose/jetstream/src/main/java/com/google/jetstream/presentation/screens/movies/TitleValueText.kt +++ b/JetStreamCompose/jetstream/src/main/java/com/google/jetstream/presentation/screens/movies/TitleValueText.kt @@ -5,7 +5,7 @@ * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * - * https://www.apache.org/licenses/LICENSE-2.0 + * https://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, diff --git a/JetStreamCompose/jetstream/src/main/java/com/google/jetstream/presentation/screens/profile/AboutSection.kt b/JetStreamCompose/jetstream/src/main/java/com/google/jetstream/presentation/screens/profile/AboutSection.kt index 4dd2c4bc..b81c1fd0 100644 --- a/JetStreamCompose/jetstream/src/main/java/com/google/jetstream/presentation/screens/profile/AboutSection.kt +++ b/JetStreamCompose/jetstream/src/main/java/com/google/jetstream/presentation/screens/profile/AboutSection.kt @@ -5,7 +5,7 @@ * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * - * https://www.apache.org/licenses/LICENSE-2.0 + * https://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, diff --git a/JetStreamCompose/jetstream/src/main/java/com/google/jetstream/presentation/screens/profile/AccountsSection.kt b/JetStreamCompose/jetstream/src/main/java/com/google/jetstream/presentation/screens/profile/AccountsSection.kt index dde52b50..c073041a 100644 --- a/JetStreamCompose/jetstream/src/main/java/com/google/jetstream/presentation/screens/profile/AccountsSection.kt +++ b/JetStreamCompose/jetstream/src/main/java/com/google/jetstream/presentation/screens/profile/AccountsSection.kt @@ -5,7 +5,7 @@ * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * - * https://www.apache.org/licenses/LICENSE-2.0 + * https://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, diff --git a/JetStreamCompose/jetstream/src/main/java/com/google/jetstream/presentation/screens/profile/AccountsSectionDeleteDialog.kt b/JetStreamCompose/jetstream/src/main/java/com/google/jetstream/presentation/screens/profile/AccountsSectionDeleteDialog.kt index faae746e..c433386d 100644 --- a/JetStreamCompose/jetstream/src/main/java/com/google/jetstream/presentation/screens/profile/AccountsSectionDeleteDialog.kt +++ b/JetStreamCompose/jetstream/src/main/java/com/google/jetstream/presentation/screens/profile/AccountsSectionDeleteDialog.kt @@ -5,7 +5,7 @@ * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * - * https://www.apache.org/licenses/LICENSE-2.0 + * https://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, diff --git a/JetStreamCompose/jetstream/src/main/java/com/google/jetstream/presentation/screens/profile/AccountsSectionDialogButton.kt b/JetStreamCompose/jetstream/src/main/java/com/google/jetstream/presentation/screens/profile/AccountsSectionDialogButton.kt index 223c5416..a449081e 100644 --- a/JetStreamCompose/jetstream/src/main/java/com/google/jetstream/presentation/screens/profile/AccountsSectionDialogButton.kt +++ b/JetStreamCompose/jetstream/src/main/java/com/google/jetstream/presentation/screens/profile/AccountsSectionDialogButton.kt @@ -5,7 +5,7 @@ * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * - * https://www.apache.org/licenses/LICENSE-2.0 + * https://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, diff --git a/JetStreamCompose/jetstream/src/main/java/com/google/jetstream/presentation/screens/profile/AccountsSelectionItem.kt b/JetStreamCompose/jetstream/src/main/java/com/google/jetstream/presentation/screens/profile/AccountsSelectionItem.kt index b50f2a64..52fb6f7c 100644 --- a/JetStreamCompose/jetstream/src/main/java/com/google/jetstream/presentation/screens/profile/AccountsSelectionItem.kt +++ b/JetStreamCompose/jetstream/src/main/java/com/google/jetstream/presentation/screens/profile/AccountsSelectionItem.kt @@ -5,7 +5,7 @@ * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * - * https://www.apache.org/licenses/LICENSE-2.0 + * https://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, diff --git a/JetStreamCompose/jetstream/src/main/java/com/google/jetstream/presentation/screens/profile/LanguageSection.kt b/JetStreamCompose/jetstream/src/main/java/com/google/jetstream/presentation/screens/profile/LanguageSection.kt index fe3e4736..9df80590 100644 --- a/JetStreamCompose/jetstream/src/main/java/com/google/jetstream/presentation/screens/profile/LanguageSection.kt +++ b/JetStreamCompose/jetstream/src/main/java/com/google/jetstream/presentation/screens/profile/LanguageSection.kt @@ -5,7 +5,7 @@ * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * - * https://www.apache.org/licenses/LICENSE-2.0 + * https://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, @@ -59,7 +59,8 @@ fun LanguageSection( Icon( Icons.Default.Check, contentDescription = stringResource( - id = R.string.language_section_listItem_icon_content_description, + id = + R.string.language_section_listItem_icon_content_description, LanguageSectionItems[index] ) ) diff --git a/JetStreamCompose/jetstream/src/main/java/com/google/jetstream/presentation/screens/profile/ProfileScreen.kt b/JetStreamCompose/jetstream/src/main/java/com/google/jetstream/presentation/screens/profile/ProfileScreen.kt index 9194e0d1..10aa3834 100644 --- a/JetStreamCompose/jetstream/src/main/java/com/google/jetstream/presentation/screens/profile/ProfileScreen.kt +++ b/JetStreamCompose/jetstream/src/main/java/com/google/jetstream/presentation/screens/profile/ProfileScreen.kt @@ -5,7 +5,7 @@ * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * - * https://www.apache.org/licenses/LICENSE-2.0 + * https://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, @@ -213,7 +213,6 @@ fun ProfileScreen( } } - @OptIn(ExperimentalTvMaterial3Api::class) @Preview(device = Devices.TV_1080p) @Composable diff --git a/JetStreamCompose/jetstream/src/main/java/com/google/jetstream/presentation/screens/profile/ProfileScreens.kt b/JetStreamCompose/jetstream/src/main/java/com/google/jetstream/presentation/screens/profile/ProfileScreens.kt index 91ef4360..cae5284c 100644 --- a/JetStreamCompose/jetstream/src/main/java/com/google/jetstream/presentation/screens/profile/ProfileScreens.kt +++ b/JetStreamCompose/jetstream/src/main/java/com/google/jetstream/presentation/screens/profile/ProfileScreens.kt @@ -5,7 +5,7 @@ * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * - * https://www.apache.org/licenses/LICENSE-2.0 + * https://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, diff --git a/JetStreamCompose/jetstream/src/main/java/com/google/jetstream/presentation/screens/profile/SearchHistorySection.kt b/JetStreamCompose/jetstream/src/main/java/com/google/jetstream/presentation/screens/profile/SearchHistorySection.kt index 5ac26506..763a09cb 100644 --- a/JetStreamCompose/jetstream/src/main/java/com/google/jetstream/presentation/screens/profile/SearchHistorySection.kt +++ b/JetStreamCompose/jetstream/src/main/java/com/google/jetstream/presentation/screens/profile/SearchHistorySection.kt @@ -5,7 +5,7 @@ * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * - * https://www.apache.org/licenses/LICENSE-2.0 + * https://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, diff --git a/JetStreamCompose/jetstream/src/main/java/com/google/jetstream/presentation/screens/profile/SubtitlesSection.kt b/JetStreamCompose/jetstream/src/main/java/com/google/jetstream/presentation/screens/profile/SubtitlesSection.kt index 00df5847..1feb30b9 100644 --- a/JetStreamCompose/jetstream/src/main/java/com/google/jetstream/presentation/screens/profile/SubtitlesSection.kt +++ b/JetStreamCompose/jetstream/src/main/java/com/google/jetstream/presentation/screens/profile/SubtitlesSection.kt @@ -5,7 +5,7 @@ * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * - * https://www.apache.org/licenses/LICENSE-2.0 + * https://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, diff --git a/JetStreamCompose/jetstream/src/main/java/com/google/jetstream/presentation/screens/search/SearchScreen.kt b/JetStreamCompose/jetstream/src/main/java/com/google/jetstream/presentation/screens/search/SearchScreen.kt index 5d449167..2d19a996 100644 --- a/JetStreamCompose/jetstream/src/main/java/com/google/jetstream/presentation/screens/search/SearchScreen.kt +++ b/JetStreamCompose/jetstream/src/main/java/com/google/jetstream/presentation/screens/search/SearchScreen.kt @@ -5,7 +5,7 @@ * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * - * https://www.apache.org/licenses/LICENSE-2.0 + * https://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, @@ -77,7 +77,7 @@ fun SearchScreen( val shouldShowTopBar by remember { derivedStateOf { tvLazyColumnState.firstVisibleItemIndex == 0 && - tvLazyColumnState.firstVisibleItemScrollOffset < 100 + tvLazyColumnState.firstVisibleItemScrollOffset < 100 } } @@ -101,7 +101,6 @@ fun SearchScreen( ) } } - } @OptIn(ExperimentalComposeUiApi::class, ExperimentalTvMaterial3Api::class) @@ -141,7 +140,8 @@ fun SearchResult( width = if (isTfFocused) 2.dp else 1.dp, color = animateColorAsState( targetValue = if (isTfFocused) MaterialTheme.colorScheme.primary - else MaterialTheme.colorScheme.border, label = "" + else MaterialTheme.colorScheme.border, + label = "" ).value ), shape = JetStreamCardShape @@ -226,7 +226,7 @@ fun SearchResult( modifier = Modifier .fillMaxSize() .padding(top = childPadding.top * 2), - movies = movieList + movieList = movieList ) { selectedMovie -> onMovieClick(selectedMovie) } } } diff --git a/JetStreamCompose/jetstream/src/main/java/com/google/jetstream/presentation/screens/search/SearchScreenViewModel.kt b/JetStreamCompose/jetstream/src/main/java/com/google/jetstream/presentation/screens/search/SearchScreenViewModel.kt index c3c15d93..ed9c09dd 100644 --- a/JetStreamCompose/jetstream/src/main/java/com/google/jetstream/presentation/screens/search/SearchScreenViewModel.kt +++ b/JetStreamCompose/jetstream/src/main/java/com/google/jetstream/presentation/screens/search/SearchScreenViewModel.kt @@ -5,7 +5,7 @@ * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * - * http://www.apache.org/licenses/LICENSE-2.0 + * https://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, @@ -21,11 +21,11 @@ import androidx.lifecycle.viewModelScope import com.google.jetstream.data.entities.MovieList import com.google.jetstream.data.repositories.MovieRepository import dagger.hilt.android.lifecycle.HiltViewModel +import javax.inject.Inject import kotlinx.coroutines.flow.MutableSharedFlow import kotlinx.coroutines.flow.SharingStarted import kotlinx.coroutines.flow.stateIn import kotlinx.coroutines.launch -import javax.inject.Inject @HiltViewModel class SearchScreenViewModel @Inject constructor( @@ -49,10 +49,9 @@ class SearchScreenViewModel @Inject constructor( started = SharingStarted.WhileSubscribed(5_000), initialValue = SearchState.Done(MovieList()) ) - } sealed interface SearchState { data object Searching : SearchState data class Done(val movieList: MovieList) : SearchState -} \ No newline at end of file +} diff --git a/JetStreamCompose/jetstream/src/main/java/com/google/jetstream/presentation/screens/shows/ShowScreenViewModel.kt b/JetStreamCompose/jetstream/src/main/java/com/google/jetstream/presentation/screens/shows/ShowScreenViewModel.kt index 37da36d7..7b572509 100644 --- a/JetStreamCompose/jetstream/src/main/java/com/google/jetstream/presentation/screens/shows/ShowScreenViewModel.kt +++ b/JetStreamCompose/jetstream/src/main/java/com/google/jetstream/presentation/screens/shows/ShowScreenViewModel.kt @@ -5,7 +5,7 @@ * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * - * http://www.apache.org/licenses/LICENSE-2.0 + * https://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, @@ -21,10 +21,10 @@ import androidx.lifecycle.viewModelScope import com.google.jetstream.data.entities.MovieList import com.google.jetstream.data.repositories.MovieRepository import dagger.hilt.android.lifecycle.HiltViewModel +import javax.inject.Inject import kotlinx.coroutines.flow.SharingStarted import kotlinx.coroutines.flow.combine import kotlinx.coroutines.flow.stateIn -import javax.inject.Inject @HiltViewModel class ShowScreenViewModel @Inject constructor( @@ -41,11 +41,12 @@ class ShowScreenViewModel @Inject constructor( started = SharingStarted.WhileSubscribed(5_000), initialValue = ShowScreenUiState.Loading ) - } sealed interface ShowScreenUiState { - object Loading : ShowScreenUiState - data class Ready(val bingeWatchDramaList: MovieList, val tvShowList: MovieList): ShowScreenUiState - -} \ No newline at end of file + data object Loading : ShowScreenUiState + data class Ready( + val bingeWatchDramaList: MovieList, + val tvShowList: MovieList + ) : ShowScreenUiState +} diff --git a/JetStreamCompose/jetstream/src/main/java/com/google/jetstream/presentation/screens/videoPlayer/VideoPlayerScreenViewModel.kt b/JetStreamCompose/jetstream/src/main/java/com/google/jetstream/presentation/screens/videoPlayer/VideoPlayerScreenViewModel.kt index 86bd0c49..4f056728 100644 --- a/JetStreamCompose/jetstream/src/main/java/com/google/jetstream/presentation/screens/videoPlayer/VideoPlayerScreenViewModel.kt +++ b/JetStreamCompose/jetstream/src/main/java/com/google/jetstream/presentation/screens/videoPlayer/VideoPlayerScreenViewModel.kt @@ -5,7 +5,7 @@ * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * - * http://www.apache.org/licenses/LICENSE-2.0 + * https://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, @@ -23,10 +23,10 @@ import androidx.lifecycle.viewModelScope import com.google.jetstream.data.entities.MovieDetails import com.google.jetstream.data.repositories.MovieRepository import dagger.hilt.android.lifecycle.HiltViewModel +import javax.inject.Inject import kotlinx.coroutines.flow.SharingStarted import kotlinx.coroutines.flow.map import kotlinx.coroutines.flow.stateIn -import javax.inject.Inject @HiltViewModel class VideoPlayerScreenViewModel @Inject constructor( @@ -54,4 +54,4 @@ sealed class VideoPlayerScreenUiState { object Loading : VideoPlayerScreenUiState() object Error : VideoPlayerScreenUiState() data class Done(val movieDetails: MovieDetails) : VideoPlayerScreenUiState() -} \ No newline at end of file +} diff --git a/JetStreamCompose/jetstream/src/main/java/com/google/jetstream/presentation/screens/videoPlayer/components/VideoPlayerControllerText.kt b/JetStreamCompose/jetstream/src/main/java/com/google/jetstream/presentation/screens/videoPlayer/components/VideoPlayerControllerText.kt index eefa05c4..f7f8f849 100644 --- a/JetStreamCompose/jetstream/src/main/java/com/google/jetstream/presentation/screens/videoPlayer/components/VideoPlayerControllerText.kt +++ b/JetStreamCompose/jetstream/src/main/java/com/google/jetstream/presentation/screens/videoPlayer/components/VideoPlayerControllerText.kt @@ -5,7 +5,7 @@ * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * - * https://www.apache.org/licenses/LICENSE-2.0 + * https://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, @@ -22,8 +22,8 @@ import androidx.compose.ui.Modifier import androidx.compose.ui.text.font.FontWeight import androidx.compose.ui.unit.dp import androidx.tv.material3.ExperimentalTvMaterial3Api -import androidx.tv.material3.Text import androidx.tv.material3.MaterialTheme +import androidx.tv.material3.Text @OptIn(ExperimentalTvMaterial3Api::class) @Composable diff --git a/JetStreamCompose/jetstream/src/main/java/com/google/jetstream/presentation/screens/videoPlayer/components/VideoPlayerControlsIcon.kt b/JetStreamCompose/jetstream/src/main/java/com/google/jetstream/presentation/screens/videoPlayer/components/VideoPlayerControlsIcon.kt index 6f3d6931..bded77c2 100644 --- a/JetStreamCompose/jetstream/src/main/java/com/google/jetstream/presentation/screens/videoPlayer/components/VideoPlayerControlsIcon.kt +++ b/JetStreamCompose/jetstream/src/main/java/com/google/jetstream/presentation/screens/videoPlayer/components/VideoPlayerControlsIcon.kt @@ -5,7 +5,7 @@ * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * - * https://www.apache.org/licenses/LICENSE-2.0 + * https://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, diff --git a/JetStreamCompose/jetstream/src/main/java/com/google/jetstream/presentation/screens/videoPlayer/components/VideoPlayerIndicator.kt b/JetStreamCompose/jetstream/src/main/java/com/google/jetstream/presentation/screens/videoPlayer/components/VideoPlayerIndicator.kt index 8fc8393b..e385d642 100644 --- a/JetStreamCompose/jetstream/src/main/java/com/google/jetstream/presentation/screens/videoPlayer/components/VideoPlayerIndicator.kt +++ b/JetStreamCompose/jetstream/src/main/java/com/google/jetstream/presentation/screens/videoPlayer/components/VideoPlayerIndicator.kt @@ -5,7 +5,7 @@ * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * - * https://www.apache.org/licenses/LICENSE-2.0 + * https://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, diff --git a/JetStreamCompose/jetstream/src/main/java/com/google/jetstream/presentation/screens/videoPlayer/components/VideoPlayerMainFrame.kt b/JetStreamCompose/jetstream/src/main/java/com/google/jetstream/presentation/screens/videoPlayer/components/VideoPlayerMainFrame.kt index f2d60611..0e3c7012 100644 --- a/JetStreamCompose/jetstream/src/main/java/com/google/jetstream/presentation/screens/videoPlayer/components/VideoPlayerMainFrame.kt +++ b/JetStreamCompose/jetstream/src/main/java/com/google/jetstream/presentation/screens/videoPlayer/components/VideoPlayerMainFrame.kt @@ -1,3 +1,19 @@ +/* + * Copyright 2024 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + package com.google.jetstream.presentation.screens.videoPlayer.components import androidx.compose.foundation.background @@ -44,7 +60,6 @@ fun VideoPlayerMainFrame( } } - @Preview(device = "id:tv_4k") @Composable private fun MediaPlayerMainFramePreviewLayout() { @@ -118,4 +133,4 @@ private fun MediaPlayerMainFramePreviewLayoutWithoutMore() { }, more = null, ) -} \ No newline at end of file +} diff --git a/JetStreamCompose/jetstream/src/main/java/com/google/jetstream/presentation/screens/videoPlayer/components/VideoPlayerMediaTitle.kt b/JetStreamCompose/jetstream/src/main/java/com/google/jetstream/presentation/screens/videoPlayer/components/VideoPlayerMediaTitle.kt index 9de5c8a8..273985bd 100644 --- a/JetStreamCompose/jetstream/src/main/java/com/google/jetstream/presentation/screens/videoPlayer/components/VideoPlayerMediaTitle.kt +++ b/JetStreamCompose/jetstream/src/main/java/com/google/jetstream/presentation/screens/videoPlayer/components/VideoPlayerMediaTitle.kt @@ -1,3 +1,19 @@ +/* + * Copyright 2024 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + package com.google.jetstream.presentation.screens.videoPlayer.components import androidx.compose.foundation.background @@ -130,4 +146,4 @@ private fun VideoPlayerMediaTitlePreviewAd() { ) } } -} \ No newline at end of file +} diff --git a/JetStreamCompose/jetstream/src/main/java/com/google/jetstream/presentation/screens/videoPlayer/components/VideoPlayerOverlay.kt b/JetStreamCompose/jetstream/src/main/java/com/google/jetstream/presentation/screens/videoPlayer/components/VideoPlayerOverlay.kt index 2c2e4c2d..acf052ca 100644 --- a/JetStreamCompose/jetstream/src/main/java/com/google/jetstream/presentation/screens/videoPlayer/components/VideoPlayerOverlay.kt +++ b/JetStreamCompose/jetstream/src/main/java/com/google/jetstream/presentation/screens/videoPlayer/components/VideoPlayerOverlay.kt @@ -5,7 +5,7 @@ * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * - * https://www.apache.org/licenses/LICENSE-2.0 + * https://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, @@ -78,8 +78,10 @@ fun VideoPlayerOverlay( } Column { - Box(Modifier.weight(1f), - contentAlignment = Alignment.BottomCenter) { + Box( + Modifier.weight(1f), + contentAlignment = Alignment.BottomCenter + ) { subtitles() } @@ -150,4 +152,4 @@ private fun VideoPlayerOverlayPreview() { ) } } -} \ No newline at end of file +} diff --git a/JetStreamCompose/jetstream/src/main/java/com/google/jetstream/presentation/screens/videoPlayer/components/VideoPlayerPulse.kt b/JetStreamCompose/jetstream/src/main/java/com/google/jetstream/presentation/screens/videoPlayer/components/VideoPlayerPulse.kt index 55f56304..73fa6b95 100644 --- a/JetStreamCompose/jetstream/src/main/java/com/google/jetstream/presentation/screens/videoPlayer/components/VideoPlayerPulse.kt +++ b/JetStreamCompose/jetstream/src/main/java/com/google/jetstream/presentation/screens/videoPlayer/components/VideoPlayerPulse.kt @@ -1,3 +1,19 @@ +/* + * Copyright 2024 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + package com.google.jetstream.presentation.screens.videoPlayer.components import androidx.compose.foundation.background @@ -19,10 +35,10 @@ import androidx.compose.ui.unit.dp import androidx.tv.material3.ExperimentalTvMaterial3Api import androidx.tv.material3.Icon import com.google.jetstream.presentation.screens.videoPlayer.components.VideoPlayerPulse.Type.NONE +import kotlin.time.Duration.Companion.seconds import kotlinx.coroutines.channels.Channel import kotlinx.coroutines.flow.consumeAsFlow import kotlinx.coroutines.flow.debounce -import kotlin.time.Duration.Companion.seconds object VideoPlayerPulse { enum class Type { FORWARD, BACK, NONE } diff --git a/JetStreamCompose/jetstream/src/main/java/com/google/jetstream/presentation/screens/videoPlayer/components/VideoPlayerSeeker.kt b/JetStreamCompose/jetstream/src/main/java/com/google/jetstream/presentation/screens/videoPlayer/components/VideoPlayerSeeker.kt index d8afb4b5..a3cdee81 100644 --- a/JetStreamCompose/jetstream/src/main/java/com/google/jetstream/presentation/screens/videoPlayer/components/VideoPlayerSeeker.kt +++ b/JetStreamCompose/jetstream/src/main/java/com/google/jetstream/presentation/screens/videoPlayer/components/VideoPlayerSeeker.kt @@ -1,3 +1,19 @@ +/* + * Copyright 2024 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + package com.google.jetstream.presentation.screens.videoPlayer.components import androidx.compose.foundation.layout.Row @@ -24,21 +40,19 @@ fun VideoPlayerSeeker( ) { val contentProgressString = contentProgress.toComponents { h, m, s, _ -> - if(h > 0) { + if (h > 0) { "$h:${m.padStartWith0()}:${s.padStartWith0()}" } else { "${m.padStartWith0()}:${s.padStartWith0()}" } - } val contentDurationString = contentDuration.toComponents { h, m, s, _ -> - if(h > 0) { + if (h > 0) { "$h:${m.padStartWith0()}:${s.padStartWith0()}" } else { "${m.padStartWith0()}:${s.padStartWith0()}" } - } Row( diff --git a/JetStreamCompose/jetstream/src/main/java/com/google/jetstream/presentation/screens/videoPlayer/components/VideoPlayerState.kt b/JetStreamCompose/jetstream/src/main/java/com/google/jetstream/presentation/screens/videoPlayer/components/VideoPlayerState.kt index 51b67aa6..a71676b6 100644 --- a/JetStreamCompose/jetstream/src/main/java/com/google/jetstream/presentation/screens/videoPlayer/components/VideoPlayerState.kt +++ b/JetStreamCompose/jetstream/src/main/java/com/google/jetstream/presentation/screens/videoPlayer/components/VideoPlayerState.kt @@ -5,7 +5,7 @@ * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * - * https://www.apache.org/licenses/LICENSE-2.0 + * https://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, diff --git a/JetStreamCompose/jetstream/src/main/java/com/google/jetstream/presentation/theme/JetStreamFocusTheme.kt b/JetStreamCompose/jetstream/src/main/java/com/google/jetstream/presentation/theme/JetStreamFocusTheme.kt index 81619be9..b8dc861a 100644 --- a/JetStreamCompose/jetstream/src/main/java/com/google/jetstream/presentation/theme/JetStreamFocusTheme.kt +++ b/JetStreamCompose/jetstream/src/main/java/com/google/jetstream/presentation/theme/JetStreamFocusTheme.kt @@ -5,7 +5,7 @@ * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * - * https://www.apache.org/licenses/LICENSE-2.0 + * https://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, @@ -30,4 +30,4 @@ val JetStreamBorderWidth = 3.dp /** * Space to be given below every Lazy (or scrollable) vertical list throughout the app */ -val JetStreamBottomListPadding = 28.dp \ No newline at end of file +val JetStreamBottomListPadding = 28.dp diff --git a/JetStreamCompose/jetstream/src/main/java/com/google/jetstream/presentation/theme/Theme.kt b/JetStreamCompose/jetstream/src/main/java/com/google/jetstream/presentation/theme/Theme.kt index 8e93ece4..46bcc7cd 100644 --- a/JetStreamCompose/jetstream/src/main/java/com/google/jetstream/presentation/theme/Theme.kt +++ b/JetStreamCompose/jetstream/src/main/java/com/google/jetstream/presentation/theme/Theme.kt @@ -5,7 +5,7 @@ * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * - * https://www.apache.org/licenses/LICENSE-2.0 + * https://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, diff --git a/JetStreamCompose/jetstream/src/main/java/com/google/jetstream/presentation/theme/Type.kt b/JetStreamCompose/jetstream/src/main/java/com/google/jetstream/presentation/theme/Type.kt index a5896ced..5d3cc4c9 100644 --- a/JetStreamCompose/jetstream/src/main/java/com/google/jetstream/presentation/theme/Type.kt +++ b/JetStreamCompose/jetstream/src/main/java/com/google/jetstream/presentation/theme/Type.kt @@ -5,7 +5,7 @@ * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * - * https://www.apache.org/licenses/LICENSE-2.0 + * https://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, diff --git a/JetStreamCompose/jetstream/src/main/java/com/google/jetstream/presentation/utils/BringIntoViewIfChildrenAreFocused.kt b/JetStreamCompose/jetstream/src/main/java/com/google/jetstream/presentation/utils/BringIntoViewIfChildrenAreFocused.kt index 91523f5b..f71b6e85 100644 --- a/JetStreamCompose/jetstream/src/main/java/com/google/jetstream/presentation/utils/BringIntoViewIfChildrenAreFocused.kt +++ b/JetStreamCompose/jetstream/src/main/java/com/google/jetstream/presentation/utils/BringIntoViewIfChildrenAreFocused.kt @@ -5,7 +5,7 @@ * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * - *https://www.apache.org/licenses/LICENSE-2.0 + * https://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, @@ -52,4 +52,4 @@ internal fun Modifier.bringIntoViewIfChildrenAreFocused(): Modifier = composed( } ) } -) \ No newline at end of file +) diff --git a/JetStreamCompose/jetstream/src/main/java/com/google/jetstream/presentation/utils/Colors.kt b/JetStreamCompose/jetstream/src/main/java/com/google/jetstream/presentation/utils/Colors.kt index c544db89..73634abc 100644 --- a/JetStreamCompose/jetstream/src/main/java/com/google/jetstream/presentation/utils/Colors.kt +++ b/JetStreamCompose/jetstream/src/main/java/com/google/jetstream/presentation/utils/Colors.kt @@ -5,7 +5,7 @@ * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * - * http://www.apache.org/licenses/LICENSE-2.0 + * https://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, diff --git a/JetStreamCompose/jetstream/src/main/java/com/google/jetstream/presentation/utils/GradientBg.kt b/JetStreamCompose/jetstream/src/main/java/com/google/jetstream/presentation/utils/GradientBg.kt index b5efb447..23dd0a64 100644 --- a/JetStreamCompose/jetstream/src/main/java/com/google/jetstream/presentation/utils/GradientBg.kt +++ b/JetStreamCompose/jetstream/src/main/java/com/google/jetstream/presentation/utils/GradientBg.kt @@ -5,7 +5,7 @@ * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * - * http://www.apache.org/licenses/LICENSE-2.0 + * https://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, @@ -25,7 +25,6 @@ import androidx.compose.ui.Modifier import androidx.compose.ui.graphics.Brush import androidx.compose.ui.unit.dp - val pairs = listOf( Coral to LightYellow, Red300 to BlueGray300, @@ -48,4 +47,4 @@ fun GradientBg() { .fillMaxWidth() .height(200.dp) ) -} \ No newline at end of file +} diff --git a/JetStreamCompose/jetstream/src/main/java/com/google/jetstream/presentation/utils/ModifierUtils.kt b/JetStreamCompose/jetstream/src/main/java/com/google/jetstream/presentation/utils/ModifierUtils.kt index 38bb53bc..15766738 100644 --- a/JetStreamCompose/jetstream/src/main/java/com/google/jetstream/presentation/utils/ModifierUtils.kt +++ b/JetStreamCompose/jetstream/src/main/java/com/google/jetstream/presentation/utils/ModifierUtils.kt @@ -5,7 +5,7 @@ * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * - * https://www.apache.org/licenses/LICENSE-2.0 + * https://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, @@ -66,12 +66,14 @@ fun Modifier.handleDPadKeyEvents( return@onPreviewKeyEvent true } } + KeyEvent.KEYCODE_DPAD_RIGHT, KeyEvent.KEYCODE_SYSTEM_NAVIGATION_RIGHT -> { onRight?.apply { onActionUp(::invoke) return@onPreviewKeyEvent true } } + KeyEvent.KEYCODE_DPAD_CENTER, KeyEvent.KEYCODE_ENTER, KeyEvent.KEYCODE_NUMPAD_ENTER -> { onEnter?.apply { onActionUp(::invoke) @@ -94,20 +96,27 @@ fun Modifier.handleDPadKeyEvents( onEnter: (() -> Unit)? = null ) = onKeyEvent { - if (DPadEventsKeyCodes.contains(it.nativeKeyEvent.keyCode) && it.nativeKeyEvent.action == KeyEvent.ACTION_UP) { + if ( + DPadEventsKeyCodes.contains(it.nativeKeyEvent.keyCode) && + it.nativeKeyEvent.action == KeyEvent.ACTION_UP + ) { when (it.nativeKeyEvent.keyCode) { KeyEvent.KEYCODE_DPAD_LEFT, KeyEvent.KEYCODE_SYSTEM_NAVIGATION_LEFT -> { onLeft?.invoke().also { return@onKeyEvent true } } + KeyEvent.KEYCODE_DPAD_RIGHT, KeyEvent.KEYCODE_SYSTEM_NAVIGATION_RIGHT -> { onRight?.invoke().also { return@onKeyEvent true } } + KeyEvent.KEYCODE_DPAD_UP, KeyEvent.KEYCODE_SYSTEM_NAVIGATION_UP -> { onUp?.invoke().also { return@onKeyEvent true } } + KeyEvent.KEYCODE_DPAD_DOWN, KeyEvent.KEYCODE_SYSTEM_NAVIGATION_DOWN -> { onDown?.invoke().also { return@onKeyEvent true } } + KeyEvent.KEYCODE_DPAD_CENTER, KeyEvent.KEYCODE_ENTER, KeyEvent.KEYCODE_NUMPAD_ENTER -> { onEnter?.invoke().also { return@onKeyEvent true } } @@ -207,4 +216,4 @@ fun Modifier.ifElse( condition: Boolean, ifTrueModifier: Modifier, ifFalseModifier: Modifier = Modifier -): Modifier = ifElse({ condition }, ifTrueModifier, ifFalseModifier) \ No newline at end of file +): Modifier = ifElse({ condition }, ifTrueModifier, ifFalseModifier) diff --git a/JetStreamCompose/jetstream/src/main/java/com/google/jetstream/presentation/utils/Padding.kt b/JetStreamCompose/jetstream/src/main/java/com/google/jetstream/presentation/utils/Padding.kt index 7b835ffa..17df211b 100644 --- a/JetStreamCompose/jetstream/src/main/java/com/google/jetstream/presentation/utils/Padding.kt +++ b/JetStreamCompose/jetstream/src/main/java/com/google/jetstream/presentation/utils/Padding.kt @@ -5,7 +5,7 @@ * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * - * https://www.apache.org/licenses/LICENSE-2.0 + * https://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, @@ -25,4 +25,4 @@ data class Padding( val top: Dp, val end: Dp, val bottom: Dp, -) \ No newline at end of file +) diff --git a/JetStreamCompose/jetstream/src/main/java/com/google/jetstream/tvmaterial/Dialog.kt b/JetStreamCompose/jetstream/src/main/java/com/google/jetstream/tvmaterial/Dialog.kt index dfd151ea..ab4072ad 100644 --- a/JetStreamCompose/jetstream/src/main/java/com/google/jetstream/tvmaterial/Dialog.kt +++ b/JetStreamCompose/jetstream/src/main/java/com/google/jetstream/tvmaterial/Dialog.kt @@ -5,7 +5,7 @@ * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * - * https://www.apache.org/licenses/LICENSE-2.0 + * https://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, @@ -484,7 +484,7 @@ internal fun DialogFlowRow( // Return whether the placeable can be added to the current sequence. fun canAddToCurrentSequence(placeable: Placeable) = currentSequence.isEmpty() || currentMainAxisSize + mainAxisSpacing.roundToPx() + - placeable.width <= constraints.maxWidth + placeable.width <= constraints.maxWidth // Store current sequence information and start a new sequence. fun startNewSequence() { @@ -531,7 +531,7 @@ internal fun DialogFlowRow( sequences.forEachIndexed { i, placeables -> val childrenMainAxisSizes = IntArray(placeables.size) { j -> placeables[j].width + - if (j < placeables.lastIndex) mainAxisSpacing.roundToPx() else 0 + if (j < placeables.lastIndex) mainAxisSpacing.roundToPx() else 0 } val arrangement = Arrangement.Bottom // Handle vertical direction diff --git a/JetStreamCompose/jetstream/src/main/java/com/google/jetstream/tvmaterial/Shapes.kt b/JetStreamCompose/jetstream/src/main/java/com/google/jetstream/tvmaterial/Shapes.kt index 6aa34947..fea6d915 100644 --- a/JetStreamCompose/jetstream/src/main/java/com/google/jetstream/tvmaterial/Shapes.kt +++ b/JetStreamCompose/jetstream/src/main/java/com/google/jetstream/tvmaterial/Shapes.kt @@ -5,7 +5,7 @@ * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * - * https://www.apache.org/licenses/LICENSE-2.0 + * https://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, diff --git a/JetStreamCompose/spotless/copyright.kt b/JetStreamCompose/spotless/copyright.kt new file mode 100644 index 00000000..d4be1cf0 --- /dev/null +++ b/JetStreamCompose/spotless/copyright.kt @@ -0,0 +1,16 @@ +/* + * Copyright $YEAR Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + From 7803fb43f182e5da4267cdf1399c9c9ce9e29b16 Mon Sep 17 00:00:00 2001 From: Chiko Shimizu Date: Tue, 14 May 2024 18:32:54 +0900 Subject: [PATCH 02/20] Update dependencies --- JetStreamCompose/gradle/libs.versions.toml | 21 ++++++++------- .../gradle/wrapper/gradle-wrapper.properties | 2 +- JetStreamCompose/jetstream/build.gradle.kts | 2 +- .../jetstream/presentation/common/Error.kt | 26 +++++++++++++++++++ .../jetstream/presentation/common/Loading.kt | 26 +++++++++++++++++++ 5 files changed, 65 insertions(+), 12 deletions(-) create mode 100644 JetStreamCompose/jetstream/src/main/java/com/google/jetstream/presentation/common/Error.kt create mode 100644 JetStreamCompose/jetstream/src/main/java/com/google/jetstream/presentation/common/Loading.kt diff --git a/JetStreamCompose/gradle/libs.versions.toml b/JetStreamCompose/gradle/libs.versions.toml index 1c485555..023813ca 100644 --- a/JetStreamCompose/gradle/libs.versions.toml +++ b/JetStreamCompose/gradle/libs.versions.toml @@ -1,19 +1,20 @@ [versions] activity-compose = "1.9.0" -android-gradle-plugin = "8.3.2" -android-test-plugin = "8.3.2" +android-gradle-plugin = "8.4.0" +android-test-plugin = "8.4.0" benchmark-macro-junit4 = "1.2.4" coil-compose = "2.6.0" -compose-bom = "2024.04.01" -compose-for-tv = "1.0.0-alpha10" -core-ktx = "1.13.0" +compose-bom = "2024.05.00" +tv-foundation = "1.0.0-alpha10" +tv-material = "1.0.0-beta01" +core-ktx = "1.13.1" core-splashscreen = "1.0.1" hilt-navigation-compose = "1.2.0" -hilt-android = "2.51" +hilt-android = "2.51.1" junit = "1.1.5" -kotlin-android = "1.9.0" +kotlin-android = "1.9.23" kotlinx-serialization = "1.6.0" -ksp = "1.9.0-1.0.13" +ksp = "1.9.23-1.0.20" lifecycle-runtime-ktx = "2.7.0" media3-ui = "1.3.1" media3-exoplayer = "1.3.1" @@ -40,8 +41,8 @@ androidx-media3-ui = { module = "androidx.media3:media3-ui", version.ref = "medi androidx-media3-exoplayer = { module = "androidx.media3:media3-exoplayer", version.ref = "media3-exoplayer" } androidx-navigation-compose = { module = "androidx.navigation:navigation-compose", version.ref = "navigation-compose" } androidx-profileinstaller = { module = "androidx.profileinstaller:profileinstaller", version.ref = "profileinstaller" } -androidx-tv-foundation = { module = "androidx.tv:tv-foundation", version.ref = "compose-for-tv" } -androidx-tv-material = { module = "androidx.tv:tv-material", version.ref = "compose-for-tv" } +androidx-tv-foundation = { module = "androidx.tv:tv-foundation", version.ref = "tv-foundation" } +androidx-tv-material = { module = "androidx.tv:tv-material", version.ref = "tv-material" } androidx-uiautomator = { module = "androidx.test.uiautomator:uiautomator", version.ref = "uiautomator" } coil-compose = { module = "io.coil-kt:coil-compose", version.ref = "coil-compose" } hilt-android = { module = "com.google.dagger:hilt-android", version.ref = "hilt-android" } diff --git a/JetStreamCompose/gradle/wrapper/gradle-wrapper.properties b/JetStreamCompose/gradle/wrapper/gradle-wrapper.properties index 3499ded5..509c4a29 100644 --- a/JetStreamCompose/gradle/wrapper/gradle-wrapper.properties +++ b/JetStreamCompose/gradle/wrapper/gradle-wrapper.properties @@ -1,6 +1,6 @@ distributionBase=GRADLE_USER_HOME distributionPath=wrapper/dists -distributionUrl=https\://services.gradle.org/distributions/gradle-8.5-bin.zip +distributionUrl=https\://services.gradle.org/distributions/gradle-8.6-bin.zip networkTimeout=10000 zipStoreBase=GRADLE_USER_HOME zipStorePath=wrapper/dists diff --git a/JetStreamCompose/jetstream/build.gradle.kts b/JetStreamCompose/jetstream/build.gradle.kts index d5771b75..6757a360 100644 --- a/JetStreamCompose/jetstream/build.gradle.kts +++ b/JetStreamCompose/jetstream/build.gradle.kts @@ -70,7 +70,7 @@ android { buildConfig = true } composeOptions { - kotlinCompilerExtensionVersion = "1.5.0" + kotlinCompilerExtensionVersion = "1.5.13" } packaging { resources { diff --git a/JetStreamCompose/jetstream/src/main/java/com/google/jetstream/presentation/common/Error.kt b/JetStreamCompose/jetstream/src/main/java/com/google/jetstream/presentation/common/Error.kt new file mode 100644 index 00000000..b5367672 --- /dev/null +++ b/JetStreamCompose/jetstream/src/main/java/com/google/jetstream/presentation/common/Error.kt @@ -0,0 +1,26 @@ +/* + * Copyright 2024 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.jetstream.presentation.common + +import androidx.compose.runtime.Composable +import androidx.compose.ui.Modifier +import androidx.tv.material3.Text + +@Composable +fun Error(modifier: Modifier = Modifier) { + Text(text = "Wops, something went wrong...", modifier = modifier) +} diff --git a/JetStreamCompose/jetstream/src/main/java/com/google/jetstream/presentation/common/Loading.kt b/JetStreamCompose/jetstream/src/main/java/com/google/jetstream/presentation/common/Loading.kt new file mode 100644 index 00000000..5051df95 --- /dev/null +++ b/JetStreamCompose/jetstream/src/main/java/com/google/jetstream/presentation/common/Loading.kt @@ -0,0 +1,26 @@ +/* + * Copyright 2024 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.jetstream.presentation.common + +import androidx.compose.runtime.Composable +import androidx.compose.ui.Modifier +import androidx.tv.material3.Text + +@Composable +fun Loading(modifier: Modifier = Modifier) { + Text(text = "Loading...", modifier = modifier) +} From 98637d8da4f199e53b8ba1060cf5714f5c4b7870 Mon Sep 17 00:00:00 2001 From: Chiko Shimizu Date: Wed, 15 May 2024 13:13:20 +0900 Subject: [PATCH 03/20] Update code to fix warnings --- .../presentation/screens/profile/ProfileScreen.kt | 12 ++++-------- 1 file changed, 4 insertions(+), 8 deletions(-) diff --git a/JetStreamCompose/jetstream/src/main/java/com/google/jetstream/presentation/screens/profile/ProfileScreen.kt b/JetStreamCompose/jetstream/src/main/java/com/google/jetstream/presentation/screens/profile/ProfileScreen.kt index 10aa3834..dbf27ff2 100644 --- a/JetStreamCompose/jetstream/src/main/java/com/google/jetstream/presentation/screens/profile/ProfileScreen.kt +++ b/JetStreamCompose/jetstream/src/main/java/com/google/jetstream/presentation/screens/profile/ProfileScreen.kt @@ -34,6 +34,7 @@ import androidx.compose.runtime.Composable import androidx.compose.runtime.LaunchedEffect import androidx.compose.runtime.getValue import androidx.compose.runtime.key +import androidx.compose.runtime.mutableIntStateOf import androidx.compose.runtime.mutableStateOf import androidx.compose.runtime.remember import androidx.compose.runtime.saveable.rememberSaveable @@ -60,7 +61,6 @@ import androidx.navigation.compose.NavHost import androidx.navigation.compose.composable import androidx.navigation.compose.currentBackStackEntryAsState import androidx.navigation.compose.rememberNavController -import androidx.tv.material3.ExperimentalTvMaterial3Api import androidx.tv.material3.Icon import androidx.tv.material3.ListItem import androidx.tv.material3.ListItemDefaults @@ -70,10 +70,7 @@ import com.google.jetstream.R import com.google.jetstream.presentation.screens.dashboard.rememberChildPadding import com.google.jetstream.presentation.theme.JetStreamTheme -@OptIn( - ExperimentalComposeUiApi::class, - ExperimentalTvMaterial3Api::class -) +@OptIn(ExperimentalComposeUiApi::class) @Composable fun ProfileScreen( @FloatRange(from = 0.0, to = 1.0) @@ -108,7 +105,7 @@ fun ProfileScreen( .focusGroup(), verticalArrangement = Arrangement.spacedBy(12.dp) ) { - ProfileScreens.values().forEachIndexed { index, profileScreen -> + ProfileScreens.entries.forEachIndexed { index, profileScreen -> // TODO: make this dense list item key(index) { ListItem( @@ -165,7 +162,7 @@ fun ProfileScreen( } } - var selectedLanguageIndex by rememberSaveable { mutableStateOf(0) } + var selectedLanguageIndex by rememberSaveable { mutableIntStateOf(0) } var isSubtitlesChecked by rememberSaveable { mutableStateOf(true) } NavHost( modifier = Modifier @@ -213,7 +210,6 @@ fun ProfileScreen( } } -@OptIn(ExperimentalTvMaterial3Api::class) @Preview(device = Devices.TV_1080p) @Composable fun ProfileScreenPreview() { From feced9e47f07db0c1c10bf311bc0bff1d49b403d Mon Sep 17 00:00:00 2001 From: Chiko Shimizu Date: Wed, 15 May 2024 13:18:57 +0900 Subject: [PATCH 04/20] Update the loading and error state message to place the message on center of the screen --- .../jetstream/presentation/common/Loading.kt | 13 +++++- .../screens/categories/CategoriesScreen.kt | 2 +- .../categories/CategoryMovieListScreen.kt | 4 +- .../screens/favourites/FavouritesScreen.kt | 11 +---- .../presentation/screens/home/HomeScreen.kt | 41 +++++++------------ .../screens/movies/MoviesScreen.kt | 17 +++----- .../presentation/screens/shows/ShowsScreen.kt | 19 +++------ .../screens/videoPlayer/VideoPlayerScreen.kt | 11 ++++- 8 files changed, 50 insertions(+), 68 deletions(-) diff --git a/JetStreamCompose/jetstream/src/main/java/com/google/jetstream/presentation/common/Loading.kt b/JetStreamCompose/jetstream/src/main/java/com/google/jetstream/presentation/common/Loading.kt index 5051df95..82c014ed 100644 --- a/JetStreamCompose/jetstream/src/main/java/com/google/jetstream/presentation/common/Loading.kt +++ b/JetStreamCompose/jetstream/src/main/java/com/google/jetstream/presentation/common/Loading.kt @@ -16,11 +16,20 @@ package com.google.jetstream.presentation.common +import androidx.compose.foundation.layout.Box import androidx.compose.runtime.Composable +import androidx.compose.ui.Alignment import androidx.compose.ui.Modifier +import androidx.compose.ui.text.TextStyle +import androidx.tv.material3.MaterialTheme import androidx.tv.material3.Text @Composable -fun Loading(modifier: Modifier = Modifier) { - Text(text = "Loading...", modifier = modifier) +fun Loading( + modifier: Modifier = Modifier, + style: TextStyle = MaterialTheme.typography.displayMedium +) { + Box(modifier = modifier, contentAlignment = Alignment.Center) { + Text(text = "Loading...", style = style) + } } diff --git a/JetStreamCompose/jetstream/src/main/java/com/google/jetstream/presentation/screens/categories/CategoriesScreen.kt b/JetStreamCompose/jetstream/src/main/java/com/google/jetstream/presentation/screens/categories/CategoriesScreen.kt index 88491cd8..8ee50588 100644 --- a/JetStreamCompose/jetstream/src/main/java/com/google/jetstream/presentation/screens/categories/CategoriesScreen.kt +++ b/JetStreamCompose/jetstream/src/main/java/com/google/jetstream/presentation/screens/categories/CategoriesScreen.kt @@ -64,7 +64,7 @@ fun CategoriesScreen( when (val s = uiState) { CategoriesScreenUiState.Loading -> { - Loading() + Loading(modifier = Modifier.fillMaxSize()) } is CategoriesScreenUiState.Ready -> { diff --git a/JetStreamCompose/jetstream/src/main/java/com/google/jetstream/presentation/screens/categories/CategoryMovieListScreen.kt b/JetStreamCompose/jetstream/src/main/java/com/google/jetstream/presentation/screens/categories/CategoryMovieListScreen.kt index 8a3da6f5..9f34edb8 100644 --- a/JetStreamCompose/jetstream/src/main/java/com/google/jetstream/presentation/screens/categories/CategoryMovieListScreen.kt +++ b/JetStreamCompose/jetstream/src/main/java/com/google/jetstream/presentation/screens/categories/CategoryMovieListScreen.kt @@ -61,11 +61,11 @@ fun CategoryMovieListScreen( when (val s = uiState) { CategoryMovieListScreenUiState.Loading -> { - Loading() + Loading(modifier = Modifier.fillMaxSize()) } CategoryMovieListScreenUiState.Error -> { - Error() + Error(modifier = Modifier.fillMaxSize()) } is CategoryMovieListScreenUiState.Done -> { diff --git a/JetStreamCompose/jetstream/src/main/java/com/google/jetstream/presentation/screens/favourites/FavouritesScreen.kt b/JetStreamCompose/jetstream/src/main/java/com/google/jetstream/presentation/screens/favourites/FavouritesScreen.kt index b9e2b6ff..3e242729 100644 --- a/JetStreamCompose/jetstream/src/main/java/com/google/jetstream/presentation/screens/favourites/FavouritesScreen.kt +++ b/JetStreamCompose/jetstream/src/main/java/com/google/jetstream/presentation/screens/favourites/FavouritesScreen.kt @@ -31,9 +31,8 @@ import androidx.compose.ui.unit.dp import androidx.hilt.navigation.compose.hiltViewModel import androidx.lifecycle.compose.collectAsStateWithLifecycle import androidx.tv.foundation.lazy.grid.rememberTvLazyGridState -import androidx.tv.material3.ExperimentalTvMaterial3Api -import androidx.tv.material3.Text import com.google.jetstream.data.entities.MovieList +import com.google.jetstream.presentation.common.Loading import com.google.jetstream.presentation.screens.dashboard.rememberChildPadding @Composable @@ -46,7 +45,7 @@ fun FavouritesScreen( val uiState by favouriteScreenViewModel.uiState.collectAsStateWithLifecycle() when (val s = uiState) { is FavouriteScreenUiState.Loading -> { - Loading() + Loading(modifier = Modifier.fillMaxSize()) } is FavouriteScreenUiState.Ready -> { Catalog( @@ -63,12 +62,6 @@ fun FavouritesScreen( } } -@OptIn(ExperimentalTvMaterial3Api::class) -@Composable -private fun Loading(modifier: Modifier = Modifier) { - Text(text = "Loading...", modifier = modifier) -} - @Composable private fun Catalog( favouriteMovieList: MovieList, diff --git a/JetStreamCompose/jetstream/src/main/java/com/google/jetstream/presentation/screens/home/HomeScreen.kt b/JetStreamCompose/jetstream/src/main/java/com/google/jetstream/presentation/screens/home/HomeScreen.kt index 9641ced1..c1b727e7 100644 --- a/JetStreamCompose/jetstream/src/main/java/com/google/jetstream/presentation/screens/home/HomeScreen.kt +++ b/JetStreamCompose/jetstream/src/main/java/com/google/jetstream/presentation/screens/home/HomeScreen.kt @@ -5,7 +5,7 @@ * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * - * https://www.apache.org/licenses/LICENSE-2.0 + * https://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, @@ -36,11 +36,11 @@ import androidx.lifecycle.compose.collectAsStateWithLifecycle import androidx.tv.foundation.PivotOffsets import androidx.tv.foundation.lazy.list.TvLazyColumn import androidx.tv.foundation.lazy.list.rememberTvLazyListState -import androidx.tv.material3.ExperimentalTvMaterial3Api -import androidx.tv.material3.Text import com.google.jetstream.data.entities.Movie import com.google.jetstream.data.entities.MovieList import com.google.jetstream.data.util.StringConstants +import com.google.jetstream.presentation.common.Error +import com.google.jetstream.presentation.common.Loading import com.google.jetstream.presentation.common.MoviesRow import com.google.jetstream.presentation.screens.dashboard.rememberChildPadding @@ -69,10 +69,9 @@ fun HomeScreen( ) } - is HomeScreenUiState.Loading -> Loading() - is HomeScreenUiState.Error -> Error() + is HomeScreenUiState.Loading -> Loading(modifier = Modifier.fillMaxSize()) + is HomeScreenUiState.Error -> Error(modifier = Modifier.fillMaxSize()) } - } @Composable @@ -97,7 +96,7 @@ private fun Catalog( val shouldShowTopBar by remember { derivedStateOf { tvLazyListState.firstVisibleItemIndex == 0 && - tvLazyListState.firstVisibleItemScrollOffset < 300 + tvLazyListState.firstVisibleItemScrollOffset < 300 } } @@ -109,11 +108,11 @@ private fun Catalog( } TvLazyColumn( - modifier = modifier, pivotOffsets = if (immersiveListHasFocus) pivotOffsetForImmersiveList else pivotOffset, state = tvLazyListState, - contentPadding = PaddingValues(bottom = 108.dp) + contentPadding = PaddingValues(bottom = 108.dp), // Setting overscan margin to bottom to ensure the last row's visibility + modifier = modifier ) { item(contentType = "FeaturedMoviesCarousel") { FeaturedMoviesCarousel( @@ -132,39 +131,27 @@ private fun Catalog( item(contentType = "MoviesRow") { MoviesRow( modifier = Modifier.padding(top = 16.dp), - movies = trendingMovies, + movieList = trendingMovies, title = StringConstants.Composable.HomeScreenTrendingTitle, - onMovieClick = onMovieClick + onMovieSelected = onMovieClick ) } item(contentType = "Top10MoviesList") { Top10MoviesList( + movieList = top10Movies, + onMovieClick = onMovieClick, modifier = Modifier.onFocusChanged { immersiveListHasFocus = it.hasFocus }, - moviesState = top10Movies, - onMovieClick = onMovieClick ) } item(contentType = "MoviesRow") { MoviesRow( modifier = Modifier.padding(top = 16.dp), - movies = nowPlayingMovies, + movieList = nowPlayingMovies, title = StringConstants.Composable.HomeScreenNowPlayingMoviesTitle, - onMovieClick = onMovieClick + onMovieSelected = onMovieClick ) } } } - -@OptIn(ExperimentalTvMaterial3Api::class) -@Composable -private fun Loading(modifier: Modifier = Modifier) { - Text(text = "Loading...", modifier = modifier) -} - -@OptIn(ExperimentalTvMaterial3Api::class) -@Composable -private fun Error(modifier: Modifier = Modifier) { - Text(text = "Wops, something went wrong.", modifier = modifier) -} diff --git a/JetStreamCompose/jetstream/src/main/java/com/google/jetstream/presentation/screens/movies/MoviesScreen.kt b/JetStreamCompose/jetstream/src/main/java/com/google/jetstream/presentation/screens/movies/MoviesScreen.kt index 52fcdd14..5fedd6df 100644 --- a/JetStreamCompose/jetstream/src/main/java/com/google/jetstream/presentation/screens/movies/MoviesScreen.kt +++ b/JetStreamCompose/jetstream/src/main/java/com/google/jetstream/presentation/screens/movies/MoviesScreen.kt @@ -5,7 +5,7 @@ * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * - * https://www.apache.org/licenses/LICENSE-2.0 + * https://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, @@ -30,11 +30,10 @@ import androidx.hilt.navigation.compose.hiltViewModel import androidx.lifecycle.compose.collectAsStateWithLifecycle import androidx.tv.foundation.lazy.list.TvLazyColumn import androidx.tv.foundation.lazy.list.rememberTvLazyListState -import androidx.tv.material3.ExperimentalTvMaterial3Api -import androidx.tv.material3.Text import com.google.jetstream.data.entities.Movie import com.google.jetstream.data.entities.MovieList import com.google.jetstream.data.util.StringConstants +import com.google.jetstream.presentation.common.Loading import com.google.jetstream.presentation.common.MoviesRow import com.google.jetstream.presentation.screens.dashboard.rememberChildPadding @@ -75,7 +74,7 @@ private fun Catalog( val shouldShowTopBar by remember { derivedStateOf { tvLazyListState.firstVisibleItemIndex == 0 && - tvLazyListState.firstVisibleItemScrollOffset == 0 + tvLazyListState.firstVisibleItemScrollOffset == 0 } } @@ -101,15 +100,9 @@ private fun Catalog( MoviesRow( modifier = Modifier.padding(top = childPadding.top), title = StringConstants.Composable.PopularFilmsThisWeekTitle, - movies = popularFilmsThisWeek, - onMovieClick = onMovieClick + movieList = popularFilmsThisWeek, + onMovieSelected = onMovieClick ) } } } - -@OptIn(ExperimentalTvMaterial3Api::class) -@Composable -private fun Loading(modifier: Modifier = Modifier) { - Text(text = "Loading...", modifier = modifier) -} \ No newline at end of file diff --git a/JetStreamCompose/jetstream/src/main/java/com/google/jetstream/presentation/screens/shows/ShowsScreen.kt b/JetStreamCompose/jetstream/src/main/java/com/google/jetstream/presentation/screens/shows/ShowsScreen.kt index b3e10291..4c74c7f7 100644 --- a/JetStreamCompose/jetstream/src/main/java/com/google/jetstream/presentation/screens/shows/ShowsScreen.kt +++ b/JetStreamCompose/jetstream/src/main/java/com/google/jetstream/presentation/screens/shows/ShowsScreen.kt @@ -5,7 +5,7 @@ * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * - * https://www.apache.org/licenses/LICENSE-2.0 + * https://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, @@ -30,11 +30,10 @@ import androidx.hilt.navigation.compose.hiltViewModel import androidx.lifecycle.compose.collectAsStateWithLifecycle import androidx.tv.foundation.lazy.list.TvLazyColumn import androidx.tv.foundation.lazy.list.rememberTvLazyListState -import androidx.tv.material3.ExperimentalTvMaterial3Api -import androidx.tv.material3.Text import com.google.jetstream.data.entities.Movie import com.google.jetstream.data.entities.MovieList import com.google.jetstream.data.util.StringConstants +import com.google.jetstream.presentation.common.Loading import com.google.jetstream.presentation.common.MoviesRow import com.google.jetstream.presentation.screens.dashboard.rememberChildPadding import com.google.jetstream.presentation.screens.movies.MoviesScreenMovieList @@ -49,7 +48,7 @@ fun ShowsScreen( val uiState = showScreenViewModel.uiState.collectAsStateWithLifecycle() when (val currentState = uiState.value) { is ShowScreenUiState.Loading -> { - Loading() + Loading(modifier = Modifier.fillMaxSize()) } is ShowScreenUiState.Ready -> { @@ -79,7 +78,7 @@ private fun Catalog( val shouldShowTopBar by remember { derivedStateOf { tvLazyListState.firstVisibleItemIndex == 0 && - tvLazyListState.firstVisibleItemScrollOffset == 0 + tvLazyListState.firstVisibleItemScrollOffset == 0 } } @@ -105,15 +104,9 @@ private fun Catalog( MoviesRow( modifier = Modifier.padding(top = childPadding.top), title = StringConstants.Composable.BingeWatchDramasTitle, - movies = bingeWatchDramaList, - onMovieClick = onTVShowClick + movieList = bingeWatchDramaList, + onMovieSelected = onTVShowClick ) } } } - -@OptIn(ExperimentalTvMaterial3Api::class) -@Composable -private fun Loading(modifier: Modifier = Modifier) { - Text(text = "Loading...", modifier = modifier) -} \ No newline at end of file diff --git a/JetStreamCompose/jetstream/src/main/java/com/google/jetstream/presentation/screens/videoPlayer/VideoPlayerScreen.kt b/JetStreamCompose/jetstream/src/main/java/com/google/jetstream/presentation/screens/videoPlayer/VideoPlayerScreen.kt index bf903bd9..648c9eae 100644 --- a/JetStreamCompose/jetstream/src/main/java/com/google/jetstream/presentation/screens/videoPlayer/VideoPlayerScreen.kt +++ b/JetStreamCompose/jetstream/src/main/java/com/google/jetstream/presentation/screens/videoPlayer/VideoPlayerScreen.kt @@ -22,6 +22,7 @@ import androidx.activity.compose.BackHandler import androidx.compose.foundation.focusable import androidx.compose.foundation.layout.Box import androidx.compose.foundation.layout.Row +import androidx.compose.foundation.layout.fillMaxSize import androidx.compose.foundation.layout.padding import androidx.compose.material.icons.Icons import androidx.compose.material.icons.filled.AutoAwesomeMotion @@ -52,6 +53,8 @@ import androidx.media3.exoplayer.source.ProgressiveMediaSource import androidx.media3.ui.PlayerView import com.google.jetstream.data.entities.MovieDetails import com.google.jetstream.data.util.StringConstants +import com.google.jetstream.presentation.common.Error +import com.google.jetstream.presentation.common.Loading import com.google.jetstream.presentation.screens.videoPlayer.components.VideoPlayerControlsIcon import com.google.jetstream.presentation.screens.videoPlayer.components.VideoPlayerMainFrame import com.google.jetstream.presentation.screens.videoPlayer.components.VideoPlayerMediaTitle @@ -88,8 +91,12 @@ fun VideoPlayerScreen( // TODO: Handle Loading & Error states when (val s = uiState) { - is VideoPlayerScreenUiState.Loading -> {} - is VideoPlayerScreenUiState.Error -> {} + is VideoPlayerScreenUiState.Loading -> { + Loading(modifier = Modifier.fillMaxSize()) + } + is VideoPlayerScreenUiState.Error -> { + Error(modifier = Modifier.fillMaxSize()) + } is VideoPlayerScreenUiState.Done -> { VideoPlayerScreenContent( movieDetails = s.movieDetails, From cbae28a2aeef7f9723a3031ccb3b487457686e4b Mon Sep 17 00:00:00 2001 From: Chiko Shimizu Date: Wed, 15 May 2024 13:20:31 +0900 Subject: [PATCH 05/20] Update code due to the rename of the ToogleableSurfaceDefaults object --- .../screens/dashboard/UserAvatar.kt | 20 ++++++++----------- 1 file changed, 8 insertions(+), 12 deletions(-) diff --git a/JetStreamCompose/jetstream/src/main/java/com/google/jetstream/presentation/screens/dashboard/UserAvatar.kt b/JetStreamCompose/jetstream/src/main/java/com/google/jetstream/presentation/screens/dashboard/UserAvatar.kt index bd23c194..6941bdc8 100644 --- a/JetStreamCompose/jetstream/src/main/java/com/google/jetstream/presentation/screens/dashboard/UserAvatar.kt +++ b/JetStreamCompose/jetstream/src/main/java/com/google/jetstream/presentation/screens/dashboard/UserAvatar.kt @@ -5,7 +5,7 @@ * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * - * https://www.apache.org/licenses/LICENSE-2.0 + * https://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, @@ -18,22 +18,18 @@ package com.google.jetstream.presentation.screens.dashboard import androidx.compose.foundation.BorderStroke import androidx.compose.foundation.layout.fillMaxSize -import androidx.compose.foundation.layout.size import androidx.compose.foundation.shape.CircleShape import androidx.compose.material.icons.Icons import androidx.compose.material.icons.filled.AccountCircle import androidx.compose.runtime.Composable import androidx.compose.ui.Modifier -import androidx.compose.ui.unit.dp import androidx.tv.material3.Border -import androidx.tv.material3.ExperimentalTvMaterial3Api import androidx.tv.material3.Icon import androidx.tv.material3.MaterialTheme +import androidx.tv.material3.SelectableSurfaceDefaults import androidx.tv.material3.Surface -import androidx.tv.material3.ToggleableSurfaceDefaults import com.google.jetstream.presentation.theme.JetStreamBorderWidth -@OptIn(ExperimentalTvMaterial3Api::class) @Composable fun UserAvatar( selected: Boolean, @@ -41,8 +37,10 @@ fun UserAvatar( onClick: () -> Unit ) { Surface( - shape = ToggleableSurfaceDefaults.shape(shape = CircleShape), - border = ToggleableSurfaceDefaults.border( + selected = selected, + onClick = onClick, + shape = SelectableSurfaceDefaults.shape(shape = CircleShape), + border = SelectableSurfaceDefaults.border( focusedBorder = Border( border = BorderStroke( width = JetStreamBorderWidth, @@ -58,10 +56,8 @@ fun UserAvatar( shape = CircleShape ), ), - scale = ToggleableSurfaceDefaults.scale(focusedScale = 1f), - modifier = modifier.size(32.dp), - checked = selected, - onCheckedChange = { onClick() } + scale = SelectableSurfaceDefaults.scale(focusedScale = 1f), + modifier = modifier, ) { Icon( imageVector = Icons.Default.AccountCircle, From 23b18cc02de92a4f44151ece6e73ba09c064edd2 Mon Sep 17 00:00:00 2001 From: Chiko Shimizu Date: Wed, 15 May 2024 13:21:41 +0900 Subject: [PATCH 06/20] Update the code due to the rename of StandardCardLayout component --- .../jetstream/data/entities/MovieDetails.kt | 4 +- .../presentation/common/MovieCard.kt | 59 +++++++++++++++++++ .../presentation/common/PosterImage.kt | 42 +++++++++++++ .../screens/favourites/FilteredMoviesGrid.kt | 56 +++--------------- .../screens/movies/MovieDetailsScreen.kt | 29 +++------ .../screens/profile/HelpAndSupportSection.kt | 6 +- 6 files changed, 122 insertions(+), 74 deletions(-) create mode 100644 JetStreamCompose/jetstream/src/main/java/com/google/jetstream/presentation/common/MovieCard.kt create mode 100644 JetStreamCompose/jetstream/src/main/java/com/google/jetstream/presentation/common/PosterImage.kt diff --git a/JetStreamCompose/jetstream/src/main/java/com/google/jetstream/data/entities/MovieDetails.kt b/JetStreamCompose/jetstream/src/main/java/com/google/jetstream/data/entities/MovieDetails.kt index e6b72f32..ff8a29c0 100644 --- a/JetStreamCompose/jetstream/src/main/java/com/google/jetstream/data/entities/MovieDetails.kt +++ b/JetStreamCompose/jetstream/src/main/java/com/google/jetstream/data/entities/MovieDetails.kt @@ -5,7 +5,7 @@ * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * - * https://www.apache.org/licenses/LICENSE-2.0 + * https://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, @@ -35,6 +35,6 @@ data class MovieDetails( val originalLanguage: String, val budget: String, val revenue: String, - val similarMovies: List, + val similarMovies: MovieList, val reviewsAndRatings: List ) diff --git a/JetStreamCompose/jetstream/src/main/java/com/google/jetstream/presentation/common/MovieCard.kt b/JetStreamCompose/jetstream/src/main/java/com/google/jetstream/presentation/common/MovieCard.kt new file mode 100644 index 00000000..62c3f322 --- /dev/null +++ b/JetStreamCompose/jetstream/src/main/java/com/google/jetstream/presentation/common/MovieCard.kt @@ -0,0 +1,59 @@ +/* + * Copyright 2024 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.jetstream.presentation.common + +import androidx.compose.foundation.BorderStroke +import androidx.compose.foundation.layout.BoxScope +import androidx.compose.runtime.Composable +import androidx.compose.ui.Modifier +import androidx.tv.material3.Border +import androidx.tv.material3.ClickableSurfaceDefaults +import androidx.tv.material3.MaterialTheme +import androidx.tv.material3.StandardCardContainer +import androidx.tv.material3.Surface +import com.google.jetstream.presentation.theme.JetStreamBorderWidth +import com.google.jetstream.presentation.theme.JetStreamCardShape + +@Composable +fun MovieCard( + onClick: () -> Unit, + modifier: Modifier = Modifier, + title: @Composable () -> Unit = {}, + image: @Composable BoxScope.() -> Unit, +) { + StandardCardContainer( + modifier = modifier, + title = title, + imageCard = { + Surface( + onClick = onClick, + shape = ClickableSurfaceDefaults.shape(JetStreamCardShape), + border = ClickableSurfaceDefaults.border( + focusedBorder = Border( + border = BorderStroke( + width = JetStreamBorderWidth, + color = MaterialTheme.colorScheme.onSurface + ), + shape = JetStreamCardShape + ) + ), + scale = ClickableSurfaceDefaults.scale(focusedScale = 1f), + content = image + ) + }, + ) +} diff --git a/JetStreamCompose/jetstream/src/main/java/com/google/jetstream/presentation/common/PosterImage.kt b/JetStreamCompose/jetstream/src/main/java/com/google/jetstream/presentation/common/PosterImage.kt new file mode 100644 index 00000000..892e9dc0 --- /dev/null +++ b/JetStreamCompose/jetstream/src/main/java/com/google/jetstream/presentation/common/PosterImage.kt @@ -0,0 +1,42 @@ +/* + * Copyright 2024 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.jetstream.presentation.common + +import androidx.compose.runtime.Composable +import androidx.compose.ui.Modifier +import androidx.compose.ui.layout.ContentScale +import androidx.compose.ui.platform.LocalContext +import coil.compose.AsyncImage +import coil.request.ImageRequest +import com.google.jetstream.data.entities.Movie +import com.google.jetstream.data.util.StringConstants + +@Composable +fun PosterImage( + movie: Movie, + modifier: Modifier = Modifier, +) { + AsyncImage( + modifier = modifier, + model = ImageRequest.Builder(LocalContext.current) + .crossfade(true) + .data(movie.posterUri) + .build(), + contentDescription = StringConstants.Composable.ContentDescription.moviePoster(movie.name), + contentScale = ContentScale.Crop + ) +} diff --git a/JetStreamCompose/jetstream/src/main/java/com/google/jetstream/presentation/screens/favourites/FilteredMoviesGrid.kt b/JetStreamCompose/jetstream/src/main/java/com/google/jetstream/presentation/screens/favourites/FilteredMoviesGrid.kt index 9c43f8e8..32545e01 100644 --- a/JetStreamCompose/jetstream/src/main/java/com/google/jetstream/presentation/screens/favourites/FilteredMoviesGrid.kt +++ b/JetStreamCompose/jetstream/src/main/java/com/google/jetstream/presentation/screens/favourites/FilteredMoviesGrid.kt @@ -5,7 +5,7 @@ * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * - * https://www.apache.org/licenses/LICENSE-2.0 + * https://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, @@ -16,34 +16,22 @@ package com.google.jetstream.presentation.screens.favourites -import androidx.compose.foundation.BorderStroke import androidx.compose.foundation.layout.Arrangement import androidx.compose.foundation.layout.PaddingValues import androidx.compose.foundation.layout.aspectRatio import androidx.compose.foundation.layout.fillMaxSize import androidx.compose.runtime.Composable import androidx.compose.ui.Modifier -import androidx.compose.ui.layout.ContentScale -import androidx.compose.ui.platform.LocalContext import androidx.compose.ui.unit.dp import androidx.tv.foundation.lazy.grid.TvGridCells import androidx.tv.foundation.lazy.grid.TvLazyGridState import androidx.tv.foundation.lazy.grid.TvLazyVerticalGrid import androidx.tv.foundation.lazy.grid.items -import androidx.tv.material3.Border -import androidx.tv.material3.CardDefaults -import androidx.tv.material3.CardLayoutDefaults -import androidx.tv.material3.ExperimentalTvMaterial3Api -import androidx.tv.material3.MaterialTheme -import androidx.tv.material3.StandardCardLayout -import coil.compose.AsyncImage -import coil.request.ImageRequest import com.google.jetstream.data.entities.MovieList -import com.google.jetstream.data.util.StringConstants +import com.google.jetstream.presentation.common.MovieCard +import com.google.jetstream.presentation.common.PosterImage import com.google.jetstream.presentation.theme.JetStreamBottomListPadding -import com.google.jetstream.presentation.theme.JetStreamCardShape -@OptIn(ExperimentalTvMaterial3Api::class) @Composable fun FilteredMoviesGrid( state: TvLazyGridState, @@ -59,40 +47,12 @@ fun FilteredMoviesGrid( contentPadding = PaddingValues(bottom = JetStreamBottomListPadding), ) { items(movieList, key = { it.id }) { movie -> - StandardCardLayout( + MovieCard( + onClick = { onMovieClick(movie.id) }, modifier = Modifier.aspectRatio(1 / 1.5f), - imageCard = { - CardLayoutDefaults.ImageCard( - onClick = { onMovieClick(movie.id) }, - shape = CardDefaults.shape(shape = JetStreamCardShape), - scale = CardDefaults.scale(focusedScale = 1f), - border = CardDefaults.border( - focusedBorder = Border( - border = BorderStroke( - width = 2.dp, - color = MaterialTheme.colorScheme.onSurface - ), - shape = JetStreamCardShape - ) - ), - interactionSource = it - ) { - AsyncImage( - model = ImageRequest.Builder(LocalContext.current) - .data(movie.posterUri) - .crossfade(true) - .build(), - contentDescription = StringConstants - .Composable - .ContentDescription - .moviePoster(movie.name), - contentScale = ContentScale.Crop, - modifier = Modifier.fillMaxSize() - ) - } - }, - title = {} - ) + ) { + PosterImage(movie = movie, modifier = Modifier.fillMaxSize()) + } } } } diff --git a/JetStreamCompose/jetstream/src/main/java/com/google/jetstream/presentation/screens/movies/MovieDetailsScreen.kt b/JetStreamCompose/jetstream/src/main/java/com/google/jetstream/presentation/screens/movies/MovieDetailsScreen.kt index 30dbcaa4..0b672319 100644 --- a/JetStreamCompose/jetstream/src/main/java/com/google/jetstream/presentation/screens/movies/MovieDetailsScreen.kt +++ b/JetStreamCompose/jetstream/src/main/java/com/google/jetstream/presentation/screens/movies/MovieDetailsScreen.kt @@ -5,7 +5,7 @@ * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * - * https://www.apache.org/licenses/LICENSE-2.0 + * https://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, @@ -37,13 +37,13 @@ import androidx.compose.ui.unit.dp import androidx.hilt.navigation.compose.hiltViewModel import androidx.lifecycle.compose.collectAsStateWithLifecycle import androidx.tv.foundation.lazy.list.TvLazyColumn -import androidx.tv.material3.ExperimentalTvMaterial3Api import androidx.tv.material3.MaterialTheme -import androidx.tv.material3.Text import com.google.jetstream.R import com.google.jetstream.data.entities.Movie import com.google.jetstream.data.entities.MovieDetails import com.google.jetstream.data.util.StringConstants +import com.google.jetstream.presentation.common.Error +import com.google.jetstream.presentation.common.Loading import com.google.jetstream.presentation.common.MoviesRow import com.google.jetstream.presentation.screens.dashboard.rememberChildPadding @@ -62,11 +62,11 @@ fun MovieDetailsScreen( when (val s = uiState) { is MovieDetailsScreenUiState.Loading -> { - Loading() + Loading(modifier = Modifier.fillMaxSize()) } is MovieDetailsScreenUiState.Error -> { - Error() + Error(modifier = Modifier.fillMaxSize()) } is MovieDetailsScreenUiState.Done -> { @@ -83,7 +83,6 @@ fun MovieDetailsScreen( } } -@OptIn(ExperimentalTvMaterial3Api::class) @Composable private fun Details( movieDetails: MovieDetails, @@ -118,8 +117,8 @@ private fun Details( .Composable .movieDetailsScreenSimilarTo(movieDetails.name), titleStyle = MaterialTheme.typography.titleMedium, - movies = movieDetails.similarMovies, - onMovieClick = refreshScreenWithNewMovie + movieList = movieDetails.similarMovies, + onMovieSelected = refreshScreenWithNewMovie ) } @@ -176,16 +175,4 @@ private fun Details( } } -@OptIn(ExperimentalTvMaterial3Api::class) -@Composable -private fun Loading(modifier: Modifier = Modifier) { - Text(text = "Loading...", modifier = modifier) -} - -@OptIn(ExperimentalTvMaterial3Api::class) -@Composable -private fun Error(modifier: Modifier = Modifier) { - Text(text = "Something went wrong...", modifier = modifier) -} - -private val BottomDividerPadding = PaddingValues(vertical = 48.dp) \ No newline at end of file +private val BottomDividerPadding = PaddingValues(vertical = 48.dp) diff --git a/JetStreamCompose/jetstream/src/main/java/com/google/jetstream/presentation/screens/profile/HelpAndSupportSection.kt b/JetStreamCompose/jetstream/src/main/java/com/google/jetstream/presentation/screens/profile/HelpAndSupportSection.kt index e15090b2..f15b6a50 100644 --- a/JetStreamCompose/jetstream/src/main/java/com/google/jetstream/presentation/screens/profile/HelpAndSupportSection.kt +++ b/JetStreamCompose/jetstream/src/main/java/com/google/jetstream/presentation/screens/profile/HelpAndSupportSection.kt @@ -5,7 +5,7 @@ * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * - * https://www.apache.org/licenses/LICENSE-2.0 + * https://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, @@ -20,6 +20,7 @@ import androidx.compose.foundation.layout.Column import androidx.compose.foundation.layout.padding import androidx.compose.foundation.layout.size import androidx.compose.material.icons.Icons +import androidx.compose.material.icons.automirrored.filled.ArrowForwardIos import androidx.compose.material.icons.filled.ArrowForwardIos import androidx.compose.runtime.Composable import androidx.compose.ui.Modifier @@ -53,7 +54,6 @@ fun HelpAndSupportSection() { } } - @OptIn(ExperimentalTvMaterial3Api::class) @Composable private fun HelpAndSupportSectionItem( @@ -72,7 +72,7 @@ private fun HelpAndSupportSectionItem( ) } ?: run { Icon( - Icons.Default.ArrowForwardIos, + Icons.AutoMirrored.Filled.ArrowForwardIos, modifier = Modifier.size(ListItemDefaults.IconSizeDense), contentDescription = StringConstants .Composable From 7a83e69c58a4559bca755b2958bbf92cc177037a Mon Sep 17 00:00:00 2001 From: Chiko Shimizu Date: Wed, 15 May 2024 13:40:51 +0900 Subject: [PATCH 07/20] Specified UserAvator's size and minor code cleanup --- .../screens/dashboard/DashboardTopBar.kt | 53 +++++++++++-------- 1 file changed, 31 insertions(+), 22 deletions(-) diff --git a/JetStreamCompose/jetstream/src/main/java/com/google/jetstream/presentation/screens/dashboard/DashboardTopBar.kt b/JetStreamCompose/jetstream/src/main/java/com/google/jetstream/presentation/screens/dashboard/DashboardTopBar.kt index 463f6a44..0bd6f88a 100644 --- a/JetStreamCompose/jetstream/src/main/java/com/google/jetstream/presentation/screens/dashboard/DashboardTopBar.kt +++ b/JetStreamCompose/jetstream/src/main/java/com/google/jetstream/presentation/screens/dashboard/DashboardTopBar.kt @@ -5,7 +5,7 @@ * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * - * https://www.apache.org/licenses/LICENSE-2.0 + * https://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, @@ -48,7 +48,6 @@ import androidx.compose.ui.semantics.contentDescription import androidx.compose.ui.semantics.semantics import androidx.compose.ui.text.font.FontWeight import androidx.compose.ui.unit.dp -import androidx.tv.material3.ExperimentalTvMaterial3Api import androidx.tv.material3.Icon import androidx.tv.material3.LocalContentColor import androidx.tv.material3.MaterialTheme @@ -63,14 +62,14 @@ import com.google.jetstream.presentation.theme.JetStreamCardShape import com.google.jetstream.presentation.theme.LexendExa import com.google.jetstream.presentation.utils.occupyScreenSize -val TopBarTabs = Screens.values().toList().filter { it.isTabItem } +val TopBarTabs = Screens.entries.toList().filter { it.isTabItem } // +1 for ProfileTab val TopBarFocusRequesters = List(size = TopBarTabs.size + 1) { FocusRequester() } private const val PROFILE_SCREEN_INDEX = -1 -@OptIn(ExperimentalComposeUiApi::class, ExperimentalTvMaterial3Api::class) +@OptIn(ExperimentalComposeUiApi::class) @Composable fun DashboardTopBar( modifier: Modifier = Modifier, @@ -91,6 +90,7 @@ fun DashboardTopBar( ) { UserAvatar( modifier = Modifier + .size(32.dp) .focusRequester(focusRequesters[0]) .semantics { contentDescription = @@ -159,27 +159,36 @@ fun DashboardTopBar( } } Spacer(modifier = Modifier.weight(1f)) - Row( + JetStreamLogo( modifier = Modifier .alpha(0.75f) .padding(end = 8.dp), - verticalAlignment = Alignment.CenterVertically - ) { - Icon( - Icons.Default.PlayCircle, - contentDescription = StringConstants.Composable - .ContentDescription.BrandLogoImage, - modifier = Modifier - .padding(end = 4.dp) - .size(IconSize) - ) - Text( - text = stringResource(R.string.brand_logo_text), - style = MaterialTheme.typography.titleSmall, - fontWeight = FontWeight.Medium, - fontFamily = LexendExa - ) - } + ) } } } + +@Composable +private fun JetStreamLogo( + modifier: Modifier = Modifier +) { + Row( + modifier = modifier, + verticalAlignment = Alignment.CenterVertically + ) { + Icon( + Icons.Default.PlayCircle, + contentDescription = StringConstants.Composable + .ContentDescription.BrandLogoImage, + modifier = Modifier + .padding(end = 4.dp) + .size(IconSize) + ) + Text( + text = stringResource(R.string.brand_logo_text), + style = MaterialTheme.typography.titleSmall, + fontWeight = FontWeight.Medium, + fontFamily = LexendExa + ) + } +} From 3d77121d2bd244b6bed1ac076665ba872ee707a3 Mon Sep 17 00:00:00 2001 From: Chiko Shimizu Date: Wed, 15 May 2024 14:57:59 +0900 Subject: [PATCH 08/20] Replace ImmersiveList with custom implementation as ImmersiveList is deprecated --- .../screens/home/Top10MoviesList.kt | 177 ++++++++++-------- .../BringIntoViewIfChildrenAreFocused.kt | 45 +++-- 2 files changed, 123 insertions(+), 99 deletions(-) diff --git a/JetStreamCompose/jetstream/src/main/java/com/google/jetstream/presentation/screens/home/Top10MoviesList.kt b/JetStreamCompose/jetstream/src/main/java/com/google/jetstream/presentation/screens/home/Top10MoviesList.kt index 5dd1dd8f..0e77f8d5 100644 --- a/JetStreamCompose/jetstream/src/main/java/com/google/jetstream/presentation/screens/home/Top10MoviesList.kt +++ b/JetStreamCompose/jetstream/src/main/java/com/google/jetstream/presentation/screens/home/Top10MoviesList.kt @@ -5,7 +5,7 @@ * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * - * https://www.apache.org/licenses/LICENSE-2.0 + * https://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, @@ -16,13 +16,17 @@ package com.google.jetstream.presentation.screens.home +import androidx.compose.animation.AnimatedVisibility import androidx.compose.animation.Crossfade import androidx.compose.animation.expandVertically import androidx.compose.animation.fadeIn import androidx.compose.animation.fadeOut import androidx.compose.animation.shrinkVertically +import androidx.compose.foundation.layout.Arrangement +import androidx.compose.foundation.layout.Box import androidx.compose.foundation.layout.Column -import androidx.compose.foundation.layout.Spacer +import androidx.compose.foundation.layout.PaddingValues +import androidx.compose.foundation.layout.fillMaxSize import androidx.compose.foundation.layout.fillMaxWidth import androidx.compose.foundation.layout.height import androidx.compose.foundation.layout.padding @@ -31,116 +35,125 @@ import androidx.compose.runtime.getValue import androidx.compose.runtime.mutableStateOf import androidx.compose.runtime.remember import androidx.compose.runtime.setValue +import androidx.compose.ui.Alignment import androidx.compose.ui.Modifier import androidx.compose.ui.draw.drawWithCache +import androidx.compose.ui.focus.onFocusChanged import androidx.compose.ui.geometry.Offset import androidx.compose.ui.graphics.Brush import androidx.compose.ui.graphics.Color -import androidx.compose.ui.layout.ContentScale -import androidx.compose.ui.layout.onGloballyPositioned -import androidx.compose.ui.layout.positionInWindow -import androidx.compose.ui.platform.LocalContext import androidx.compose.ui.res.stringResource import androidx.compose.ui.text.font.FontWeight import androidx.compose.ui.unit.dp -import androidx.tv.material3.ExperimentalTvMaterial3Api -import androidx.tv.material3.ImmersiveList import androidx.tv.material3.MaterialTheme import androidx.tv.material3.Text -import coil.compose.AsyncImage -import coil.request.ImageRequest import com.google.jetstream.R import com.google.jetstream.data.entities.Movie +import com.google.jetstream.data.entities.MovieList import com.google.jetstream.presentation.common.ImmersiveListMoviesRow import com.google.jetstream.presentation.common.ItemDirection +import com.google.jetstream.presentation.common.PosterImage import com.google.jetstream.presentation.screens.dashboard.rememberChildPadding +import com.google.jetstream.presentation.utils.bringIntoViewIfChildrenAreFocused -@OptIn(ExperimentalTvMaterial3Api::class) @Composable fun Top10MoviesList( + movieList: MovieList, modifier: Modifier = Modifier, - moviesState: List, + gradientColor: Color = MaterialTheme.colorScheme.surface.copy(alpha = 0.7f), onMovieClick: (movie: Movie) -> Unit ) { - var currentItemIndex by remember { mutableStateOf(0) } var isListFocused by remember { mutableStateOf(false) } - var currentYCoord: Float? by remember { mutableStateOf(null) } + var selectedMovie by remember(movieList) { mutableStateOf(movieList.first()) } - ImmersiveList( - modifier = modifier.onGloballyPositioned { currentYCoord = it.positionInWindow().y }, - background = { _, listHasFocus -> - isListFocused = listHasFocus - val gradientColor = MaterialTheme.colorScheme.surface - AnimatedVisibility( - visible = isListFocused, - enter = fadeIn() + expandVertically(), - exit = fadeOut() + shrinkVertically(), - modifier = Modifier - .height(432.dp) - .gradientOverlay(gradientColor) - ) { - val movie = remember(moviesState, currentItemIndex) { - moviesState[currentItemIndex] - } + val sectionTitle = if (isListFocused) { + null + } else { + stringResource(R.string.top_10_movies_title) + } - Crossfade( - targetState = movie.posterUri, - label = "posterUriCrossfade" - ) { posterUri -> - AsyncImage( - modifier = Modifier - .fillMaxWidth() - .height(432.dp), - model = ImageRequest.Builder(LocalContext.current) - .data(posterUri) - .build(), - contentDescription = null, - contentScale = ContentScale.Crop + Box( + contentAlignment = Alignment.BottomStart, + modifier = modifier + .bringIntoViewIfChildrenAreFocused(paddingValues = PaddingValues(bottom = 96.dp)) + ) { + Background( + movie = selectedMovie, + visible = isListFocused, + modifier = modifier + .height(432.dp) + .gradientOverlay(gradientColor) + ) + Column { + if (isListFocused) { + MovieDescription( + movie = selectedMovie, + modifier = Modifier.padding( + start = rememberChildPadding().start, + bottom = 32.dp ) - } - - } - }, - list = { - Column { - // TODO this causes the whole vertical list to jump - if (isListFocused) { - val movie = remember(moviesState, currentItemIndex) { - moviesState[currentItemIndex] - } - Column( - modifier = Modifier.padding( - start = rememberChildPadding().start, - bottom = 32.dp - ) - ) { - Text(text = movie.name, style = MaterialTheme.typography.displaySmall) - Spacer(modifier = Modifier.padding(top = 8.dp)) - Text( - modifier = Modifier.fillMaxWidth(0.5f), - text = movie.description, - style = MaterialTheme.typography.bodyLarge, - color = MaterialTheme.colorScheme.onSurface.copy(alpha = 0.75f), - fontWeight = FontWeight.Light - ) - } - } - ImmersiveListMoviesRow( - itemDirection = ItemDirection.Horizontal, - movies = moviesState, - title = if (isListFocused) null - else stringResource(R.string.top_10_movies_title), - showItemTitle = !isListFocused, - onMovieClick = onMovieClick, - showIndexOverImage = true, - focusedItemIndex = { focusedIndex -> currentItemIndex = focusedIndex } ) } + + ImmersiveListMoviesRow( + movieList = movieList, + itemDirection = ItemDirection.Horizontal, + title = sectionTitle, + showItemTitle = !isListFocused, + showIndexOverImage = true, + onMovieSelected = onMovieClick, + onMovieFocused = { selectedMovie = it }, + modifier = Modifier.onFocusChanged { + isListFocused = it.hasFocus + } + ) } - ) + } +} + +@Composable +private fun Background( + movie: Movie, + visible: Boolean, + modifier: Modifier = Modifier, +) { + AnimatedVisibility( + visible = visible, + enter = fadeIn() + expandVertically(), + exit = fadeOut() + shrinkVertically(), + modifier = modifier + ) { + Crossfade( + targetState = movie, + label = "posterUriCrossfade", + + ) { + PosterImage(movie = it, modifier = Modifier.fillMaxSize()) + } + } +} + +@Composable +private fun MovieDescription( + movie: Movie, + modifier: Modifier = Modifier, +) { + Column( + modifier = modifier, + verticalArrangement = Arrangement.spacedBy(8.dp) + ) { + Text(text = movie.name, style = MaterialTheme.typography.displaySmall) + Text( + modifier = Modifier.fillMaxWidth(0.5f), + text = movie.description, + style = MaterialTheme.typography.bodyLarge, + color = MaterialTheme.colorScheme.onSurface.copy(alpha = 0.75f), + fontWeight = FontWeight.Light + ) + } } -fun Modifier.gradientOverlay(gradientColor: Color) = this then drawWithCache { +private fun Modifier.gradientOverlay(gradientColor: Color) = this then drawWithCache { val horizontalGradient = Brush.horizontalGradient( colors = listOf( gradientColor, diff --git a/JetStreamCompose/jetstream/src/main/java/com/google/jetstream/presentation/utils/BringIntoViewIfChildrenAreFocused.kt b/JetStreamCompose/jetstream/src/main/java/com/google/jetstream/presentation/utils/BringIntoViewIfChildrenAreFocused.kt index f71b6e85..95f786fc 100644 --- a/JetStreamCompose/jetstream/src/main/java/com/google/jetstream/presentation/utils/BringIntoViewIfChildrenAreFocused.kt +++ b/JetStreamCompose/jetstream/src/main/java/com/google/jetstream/presentation/utils/BringIntoViewIfChildrenAreFocused.kt @@ -17,39 +17,50 @@ package com.google.jetstream.presentation.utils import androidx.compose.foundation.ExperimentalFoundationApi +import androidx.compose.foundation.layout.PaddingValues import androidx.compose.foundation.relocation.BringIntoViewResponder import androidx.compose.foundation.relocation.bringIntoViewResponder -import androidx.compose.runtime.remember import androidx.compose.ui.Modifier import androidx.compose.ui.composed import androidx.compose.ui.geometry.Offset import androidx.compose.ui.geometry.Rect import androidx.compose.ui.layout.onSizeChanged +import androidx.compose.ui.platform.LocalDensity import androidx.compose.ui.platform.debugInspectorInfo +import androidx.compose.ui.unit.toSize @Suppress("IllegalExperimentalApiUsage") // TODO (b/233188423): Address before moving to beta @OptIn(ExperimentalFoundationApi::class) -internal fun Modifier.bringIntoViewIfChildrenAreFocused(): Modifier = composed( +internal fun Modifier.bringIntoViewIfChildrenAreFocused( + paddingValues: PaddingValues = PaddingValues() +): Modifier = composed( inspectorInfo = debugInspectorInfo { name = "bringIntoViewIfChildrenAreFocused" }, factory = { + val pxOffset = with(LocalDensity.current) { + val y = (paddingValues.calculateBottomPadding() - paddingValues.calculateTopPadding()) + .toPx() + Offset.Zero.copy(y = y) + } var myRect: Rect = Rect.Zero + val responder = object : BringIntoViewResponder { + // return the current rectangle and ignoring the child rectangle received. + @ExperimentalFoundationApi + override fun calculateRectForParent(localRect: Rect): Rect { + return myRect + } + + // The container is not expected to be scrollable. Hence the child is + // already in view with respect to the container. + @ExperimentalFoundationApi + override suspend fun bringChildIntoView(localRect: () -> Rect?) { + } + } + this .onSizeChanged { - myRect = Rect(Offset.Zero, Offset(it.width.toFloat(), it.height.toFloat())) + val size = it.toSize() + myRect = Rect(pxOffset, size) } - .bringIntoViewResponder( - remember { - object : BringIntoViewResponder { - // return the current rectangle and ignoring the child rectangle received. - @ExperimentalFoundationApi - override fun calculateRectForParent(localRect: Rect): Rect = myRect - - // The container is not expected to be scrollable. Hence the child is - // already in view with respect to the container. - @ExperimentalFoundationApi - override suspend fun bringChildIntoView(localRect: () -> Rect?) {} - } - } - ) + .bringIntoViewResponder(responder) } ) From ceaa51aee6791160c6d0b4956f61a8ca56ce400d Mon Sep 17 00:00:00 2001 From: Chiko Shimizu Date: Thu, 16 May 2024 10:21:47 +0900 Subject: [PATCH 09/20] spotlessApply --- .../jetstream/presentation/screens/home/Top10MoviesList.kt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/JetStreamCompose/jetstream/src/main/java/com/google/jetstream/presentation/screens/home/Top10MoviesList.kt b/JetStreamCompose/jetstream/src/main/java/com/google/jetstream/presentation/screens/home/Top10MoviesList.kt index 0e77f8d5..1192f7b7 100644 --- a/JetStreamCompose/jetstream/src/main/java/com/google/jetstream/presentation/screens/home/Top10MoviesList.kt +++ b/JetStreamCompose/jetstream/src/main/java/com/google/jetstream/presentation/screens/home/Top10MoviesList.kt @@ -127,7 +127,7 @@ private fun Background( targetState = movie, label = "posterUriCrossfade", - ) { + ) { PosterImage(movie = it, modifier = Modifier.fillMaxSize()) } } From 715475937ff40399613d9772839bafad1ace933a Mon Sep 17 00:00:00 2001 From: Chiko Shimizu Date: Thu, 16 May 2024 11:41:20 +0900 Subject: [PATCH 10/20] code cleanup --- .../screens/home/Top10MoviesList.kt | 112 +++++++++++------- 1 file changed, 71 insertions(+), 41 deletions(-) diff --git a/JetStreamCompose/jetstream/src/main/java/com/google/jetstream/presentation/screens/home/Top10MoviesList.kt b/JetStreamCompose/jetstream/src/main/java/com/google/jetstream/presentation/screens/home/Top10MoviesList.kt index 1192f7b7..dce34c8a 100644 --- a/JetStreamCompose/jetstream/src/main/java/com/google/jetstream/presentation/screens/home/Top10MoviesList.kt +++ b/JetStreamCompose/jetstream/src/main/java/com/google/jetstream/presentation/screens/home/Top10MoviesList.kt @@ -38,6 +38,7 @@ import androidx.compose.runtime.setValue import androidx.compose.ui.Alignment import androidx.compose.ui.Modifier import androidx.compose.ui.draw.drawWithCache +import androidx.compose.ui.focus.FocusState import androidx.compose.ui.focus.onFocusChanged import androidx.compose.ui.geometry.Offset import androidx.compose.ui.graphics.Brush @@ -72,10 +73,40 @@ fun Top10MoviesList( stringResource(R.string.top_10_movies_title) } + ImmersiveList( + selectedMovie = selectedMovie, + isListFocused = isListFocused, + gradientColor = gradientColor, + movieList = movieList, + sectionTitle = sectionTitle, + onMovieClick = onMovieClick, + onMovieFocused = { + selectedMovie = it + }, + onFocusChanged = { + isListFocused = it.hasFocus + }, + modifier = modifier.bringIntoViewIfChildrenAreFocused( + PaddingValues(bottom = 116.dp) + ) + ) +} + +@Composable +private fun ImmersiveList( + selectedMovie: Movie, + isListFocused: Boolean, + gradientColor: Color, + movieList: MovieList, + sectionTitle: String?, + onFocusChanged: (FocusState) -> Unit, + onMovieFocused: (Movie) -> Unit, + onMovieClick: (Movie) -> Unit, + modifier: Modifier = Modifier, +) { Box( contentAlignment = Alignment.BottomStart, modifier = modifier - .bringIntoViewIfChildrenAreFocused(paddingValues = PaddingValues(bottom = 96.dp)) ) { Background( movie = selectedMovie, @@ -90,7 +121,7 @@ fun Top10MoviesList( movie = selectedMovie, modifier = Modifier.padding( start = rememberChildPadding().start, - bottom = 32.dp + bottom = 40.dp ) ) } @@ -102,10 +133,8 @@ fun Top10MoviesList( showItemTitle = !isListFocused, showIndexOverImage = true, onMovieSelected = onMovieClick, - onMovieFocused = { selectedMovie = it }, - modifier = Modifier.onFocusChanged { - isListFocused = it.hasFocus - } + onMovieFocused = onMovieFocused, + modifier = Modifier.onFocusChanged(onFocusChanged) ) } } @@ -153,41 +182,42 @@ private fun MovieDescription( } } -private fun Modifier.gradientOverlay(gradientColor: Color) = this then drawWithCache { - val horizontalGradient = Brush.horizontalGradient( - colors = listOf( - gradientColor, - Color.Transparent - ), - startX = size.width.times(0.2f), - endX = size.width.times(0.7f) - ) - val verticalGradient = Brush.verticalGradient( - colors = listOf( - Color.Transparent, - gradientColor - ), - endY = size.width.times(0.3f) - ) - val linearGradient = Brush.linearGradient( - colors = listOf( - gradientColor, - Color.Transparent - ), - start = Offset( - size.width.times(0.2f), - size.height.times(0.5f) - ), - end = Offset( - size.width.times(0.9f), - 0f +private fun Modifier.gradientOverlay(gradientColor: Color): Modifier = + drawWithCache { + val horizontalGradient = Brush.horizontalGradient( + colors = listOf( + gradientColor, + Color.Transparent + ), + startX = size.width.times(0.2f), + endX = size.width.times(0.7f) + ) + val verticalGradient = Brush.verticalGradient( + colors = listOf( + Color.Transparent, + gradientColor + ), + endY = size.width.times(0.3f) + ) + val linearGradient = Brush.linearGradient( + colors = listOf( + gradientColor, + Color.Transparent + ), + start = Offset( + size.width.times(0.2f), + size.height.times(0.5f) + ), + end = Offset( + size.width.times(0.9f), + 0f + ) ) - ) - onDrawWithContent { - drawContent() - drawRect(horizontalGradient) - drawRect(verticalGradient) - drawRect(linearGradient) + onDrawWithContent { + drawContent() + drawRect(horizontalGradient) + drawRect(verticalGradient) + drawRect(linearGradient) + } } -} From 19b826c7d8b8acec8ce35e184799a50fa6d52cae Mon Sep 17 00:00:00 2001 From: Chiko Shimizu Date: Thu, 16 May 2024 12:08:39 +0900 Subject: [PATCH 11/20] Add OptIn annotation to the functions using experimental features --- .../screens/videoPlayer/components/VideoPlayerPulse.kt | 2 ++ .../screens/videoPlayer/components/VideoPlayerState.kt | 2 ++ 2 files changed, 4 insertions(+) diff --git a/JetStreamCompose/jetstream/src/main/java/com/google/jetstream/presentation/screens/videoPlayer/components/VideoPlayerPulse.kt b/JetStreamCompose/jetstream/src/main/java/com/google/jetstream/presentation/screens/videoPlayer/components/VideoPlayerPulse.kt index 73fa6b95..31368279 100644 --- a/JetStreamCompose/jetstream/src/main/java/com/google/jetstream/presentation/screens/videoPlayer/components/VideoPlayerPulse.kt +++ b/JetStreamCompose/jetstream/src/main/java/com/google/jetstream/presentation/screens/videoPlayer/components/VideoPlayerPulse.kt @@ -36,6 +36,7 @@ import androidx.tv.material3.ExperimentalTvMaterial3Api import androidx.tv.material3.Icon import com.google.jetstream.presentation.screens.videoPlayer.components.VideoPlayerPulse.Type.NONE import kotlin.time.Duration.Companion.seconds +import kotlinx.coroutines.FlowPreview import kotlinx.coroutines.channels.Channel import kotlinx.coroutines.flow.consumeAsFlow import kotlinx.coroutines.flow.debounce @@ -73,6 +74,7 @@ class VideoPlayerPulseState { private val channel = Channel(Channel.CONFLATED) + @OptIn(FlowPreview::class) suspend fun observe() { channel.consumeAsFlow() .debounce(2.seconds) diff --git a/JetStreamCompose/jetstream/src/main/java/com/google/jetstream/presentation/screens/videoPlayer/components/VideoPlayerState.kt b/JetStreamCompose/jetstream/src/main/java/com/google/jetstream/presentation/screens/videoPlayer/components/VideoPlayerState.kt index a71676b6..6c08543d 100644 --- a/JetStreamCompose/jetstream/src/main/java/com/google/jetstream/presentation/screens/videoPlayer/components/VideoPlayerState.kt +++ b/JetStreamCompose/jetstream/src/main/java/com/google/jetstream/presentation/screens/videoPlayer/components/VideoPlayerState.kt @@ -23,6 +23,7 @@ import androidx.compose.runtime.getValue import androidx.compose.runtime.mutableStateOf import androidx.compose.runtime.remember import androidx.compose.runtime.setValue +import kotlinx.coroutines.FlowPreview import kotlinx.coroutines.channels.Channel import kotlinx.coroutines.channels.Channel.Factory.CONFLATED import kotlinx.coroutines.flow.consumeAsFlow @@ -42,6 +43,7 @@ class VideoPlayerState internal constructor( private val channel = Channel(CONFLATED) + @OptIn(FlowPreview::class) suspend fun observe() { channel.consumeAsFlow() .debounce { it.toLong() * 1000 } From dca953ee160ec048eab3dba959797785966c2642 Mon Sep 17 00:00:00 2001 From: Chiko Shimizu Date: Thu, 16 May 2024 12:10:46 +0900 Subject: [PATCH 12/20] Upgrade core compose version to 1.7.0-beta01 and remove tv-foundation from the dependencies as a result of the update --- JetStreamCompose/gradle/libs.versions.toml | 17 +++++++------- JetStreamCompose/jetstream/build.gradle.kts | 8 ++++--- .../presentation/common/MoviesRow.kt | 15 +++++------- .../screens/categories/CategoriesScreen.kt | 20 ++++++++-------- .../categories/CategoryMovieListScreen.kt | 10 ++++---- .../screens/favourites/FavouritesScreen.kt | 4 ++-- .../screens/favourites/FilteredMoviesGrid.kt | 14 +++++------ .../presentation/screens/home/HomeScreen.kt | 23 ++++++++----------- .../screens/movies/CastAndCrewList.kt | 11 ++++----- .../screens/movies/MovieDetailsScreen.kt | 4 ++-- .../screens/movies/MoviesScreen.kt | 16 ++++++------- .../screens/movies/MoviesScreenMovieList.kt | 9 ++++---- .../screens/profile/AccountsSection.kt | 8 +++---- .../screens/profile/LanguageSection.kt | 6 ++--- .../screens/profile/SearchHistorySection.kt | 6 ++--- .../screens/search/SearchScreen.kt | 20 ++++++++-------- .../presentation/screens/shows/ShowsScreen.kt | 16 ++++++------- .../com/google/jetstream/tvmaterial/Dialog.kt | 6 ++--- 18 files changed, 101 insertions(+), 112 deletions(-) diff --git a/JetStreamCompose/gradle/libs.versions.toml b/JetStreamCompose/gradle/libs.versions.toml index 023813ca..a7094508 100644 --- a/JetStreamCompose/gradle/libs.versions.toml +++ b/JetStreamCompose/gradle/libs.versions.toml @@ -5,17 +5,18 @@ android-test-plugin = "8.4.0" benchmark-macro-junit4 = "1.2.4" coil-compose = "2.6.0" compose-bom = "2024.05.00" -tv-foundation = "1.0.0-alpha10" +compose-foundation = "1.7.0-beta01" +compose-ui = "1.7.0-beta01" tv-material = "1.0.0-beta01" core-ktx = "1.13.1" core-splashscreen = "1.0.1" hilt-navigation-compose = "1.2.0" hilt-android = "2.51.1" junit = "1.1.5" -kotlin-android = "1.9.23" +kotlin-android = "1.9.24" kotlinx-serialization = "1.6.0" -ksp = "1.9.23-1.0.20" -lifecycle-runtime-ktx = "2.7.0" +ksp = "1.9.24-1.0.20" +lifecycle-runtime-ktx = "2.8.0" media3-ui = "1.3.1" media3-exoplayer = "1.3.1" navigation-compose = "2.7.7" @@ -26,9 +27,10 @@ uiautomator = "2.3.0" androidx-activity-compose = { module = "androidx.activity:activity-compose", version.ref = "activity-compose" } androidx-benchmark-macro-junit4 = { module = "androidx.benchmark:benchmark-macro-junit4", version.ref = "benchmark-macro-junit4" } androidx-compose-bom = { module = "androidx.compose:compose-bom", version.ref = "compose-bom" } -androidx-compose-ui-base = { module = "androidx.compose.ui:ui" } -androidx-compose-ui-tooling = { module = "androidx.compose.ui:ui-tooling" } -androidx-compose-ui-tooling-preview = { module = "androidx.compose.ui:ui-tooling-preview" } +androidx-compose-foundation-base = { module = "androidx.compose.foundation:foundation", version.ref = "compose-foundation"} +androidx-compose-ui-base = { module = "androidx.compose.ui:ui", version.ref = "compose-ui" } +androidx-compose-ui-tooling = { module = "androidx.compose.ui:ui-tooling", version.ref = "compose-ui" } +androidx-compose-ui-tooling-preview = { module = "androidx.compose.ui:ui-tooling-preview", version.ref = "compose-ui" } androidx-core-ktx = { module = "androidx.core:core-ktx", version.ref = "core-ktx" } androidx-core-splashscreen = { module = "androidx.core:core-splashscreen", version.ref = "core-splashscreen" } androidx-hilt-navigation-compose = { module = "androidx.hilt:hilt-navigation-compose", version.ref = "hilt-navigation-compose" } @@ -41,7 +43,6 @@ androidx-media3-ui = { module = "androidx.media3:media3-ui", version.ref = "medi androidx-media3-exoplayer = { module = "androidx.media3:media3-exoplayer", version.ref = "media3-exoplayer" } androidx-navigation-compose = { module = "androidx.navigation:navigation-compose", version.ref = "navigation-compose" } androidx-profileinstaller = { module = "androidx.profileinstaller:profileinstaller", version.ref = "profileinstaller" } -androidx-tv-foundation = { module = "androidx.tv:tv-foundation", version.ref = "tv-foundation" } androidx-tv-material = { module = "androidx.tv:tv-material", version.ref = "tv-material" } androidx-uiautomator = { module = "androidx.test.uiautomator:uiautomator", version.ref = "uiautomator" } coil-compose = { module = "io.coil-kt:coil-compose", version.ref = "coil-compose" } diff --git a/JetStreamCompose/jetstream/build.gradle.kts b/JetStreamCompose/jetstream/build.gradle.kts index 6757a360..fe4c8538 100644 --- a/JetStreamCompose/jetstream/build.gradle.kts +++ b/JetStreamCompose/jetstream/build.gradle.kts @@ -70,7 +70,7 @@ android { buildConfig = true } composeOptions { - kotlinCompilerExtensionVersion = "1.5.13" + kotlinCompilerExtensionVersion = "1.5.14" } packaging { resources { @@ -90,11 +90,13 @@ dependencies { implementation(libs.androidx.compose.ui.base) implementation(libs.androidx.compose.ui.tooling.preview) + // Compose foundation library to replace tv-foundation + implementation(libs.androidx.compose.foundation.base) + // extra material icons implementation(libs.androidx.material.icons.extended) - // TV Compose - implementation(libs.androidx.tv.foundation) + // Material components optimized for TV apps implementation(libs.androidx.tv.material) // ViewModel in Compose diff --git a/JetStreamCompose/jetstream/src/main/java/com/google/jetstream/presentation/common/MoviesRow.kt b/JetStreamCompose/jetstream/src/main/java/com/google/jetstream/presentation/common/MoviesRow.kt index 66393013..92d78670 100644 --- a/JetStreamCompose/jetstream/src/main/java/com/google/jetstream/presentation/common/MoviesRow.kt +++ b/JetStreamCompose/jetstream/src/main/java/com/google/jetstream/presentation/common/MoviesRow.kt @@ -26,6 +26,8 @@ import androidx.compose.foundation.layout.PaddingValues import androidx.compose.foundation.layout.aspectRatio import androidx.compose.foundation.layout.fillMaxWidth import androidx.compose.foundation.layout.padding +import androidx.compose.foundation.lazy.LazyRow +import androidx.compose.foundation.lazy.itemsIndexed import androidx.compose.runtime.Composable import androidx.compose.runtime.getValue import androidx.compose.runtime.mutableStateOf @@ -38,6 +40,7 @@ import androidx.compose.ui.draw.alpha import androidx.compose.ui.draw.drawWithContent import androidx.compose.ui.focus.FocusRequester import androidx.compose.ui.focus.focusProperties +import androidx.compose.ui.focus.focusRestorer import androidx.compose.ui.focus.onFocusChanged import androidx.compose.ui.geometry.Offset import androidx.compose.ui.graphics.Color @@ -49,9 +52,6 @@ import androidx.compose.ui.text.style.TextOverflow import androidx.compose.ui.unit.Dp import androidx.compose.ui.unit.dp import androidx.compose.ui.unit.sp -import androidx.tv.foundation.PivotOffsets -import androidx.tv.foundation.lazy.list.TvLazyRow -import androidx.tv.foundation.lazy.list.itemsIndexed import androidx.tv.material3.MaterialTheme import androidx.tv.material3.Text import com.google.jetstream.data.entities.Movie @@ -99,10 +99,9 @@ fun MoviesRow( ) { movieState -> val focusRestorerModifiers = createInitialFocusRestorerModifiers() - TvLazyRow( + LazyRow( modifier = Modifier .then(focusRestorerModifiers.parentModifier), - pivotOffsets = PivotOffsets(parentFraction = 0.07f), contentPadding = PaddingValues( start = startPadding, end = endPadding, @@ -165,9 +164,8 @@ fun ImmersiveListMoviesRow( targetState = movieList, label = "", ) { movieState -> - TvLazyRow( - // modifier = Modifier.focusRestorer(), - pivotOffsets = PivotOffsets(parentFraction = 0.07f), + LazyRow( + modifier = Modifier.focusRestorer(), contentPadding = PaddingValues(start = startPadding, end = endPadding), horizontalArrangement = Arrangement.spacedBy(20.dp) ) { @@ -194,7 +192,6 @@ fun ImmersiveListMoviesRow( } @Composable -@OptIn(ExperimentalComposeUiApi::class) private fun MoviesRowItem( index: Int, movie: Movie, diff --git a/JetStreamCompose/jetstream/src/main/java/com/google/jetstream/presentation/screens/categories/CategoriesScreen.kt b/JetStreamCompose/jetstream/src/main/java/com/google/jetstream/presentation/screens/categories/CategoriesScreen.kt index 8ee50588..0d2f3cad 100644 --- a/JetStreamCompose/jetstream/src/main/java/com/google/jetstream/presentation/screens/categories/CategoriesScreen.kt +++ b/JetStreamCompose/jetstream/src/main/java/com/google/jetstream/presentation/screens/categories/CategoriesScreen.kt @@ -22,6 +22,10 @@ import androidx.compose.foundation.layout.Box import androidx.compose.foundation.layout.aspectRatio import androidx.compose.foundation.layout.fillMaxSize import androidx.compose.foundation.layout.padding +import androidx.compose.foundation.lazy.grid.GridCells +import androidx.compose.foundation.lazy.grid.LazyVerticalGrid +import androidx.compose.foundation.lazy.grid.itemsIndexed +import androidx.compose.foundation.lazy.grid.rememberLazyGridState import androidx.compose.runtime.Composable import androidx.compose.runtime.LaunchedEffect import androidx.compose.runtime.derivedStateOf @@ -40,10 +44,6 @@ import androidx.compose.ui.graphics.Color import androidx.compose.ui.unit.dp import androidx.hilt.navigation.compose.hiltViewModel import androidx.lifecycle.compose.collectAsStateWithLifecycle -import androidx.tv.foundation.lazy.grid.TvGridCells -import androidx.tv.foundation.lazy.grid.TvLazyVerticalGrid -import androidx.tv.foundation.lazy.grid.itemsIndexed -import androidx.tv.foundation.lazy.grid.rememberTvLazyGridState import androidx.tv.material3.MaterialTheme import androidx.tv.material3.Text import com.google.jetstream.data.entities.MovieCategoryList @@ -89,11 +89,11 @@ private fun Catalog( onScroll: (isTopBarVisible: Boolean) -> Unit, ) { val childPadding = rememberChildPadding() - val tvLazyGridState = rememberTvLazyGridState() + val lazyGridState = rememberLazyGridState() val shouldShowTopBar by remember { derivedStateOf { - tvLazyGridState.firstVisibleItemIndex == 0 && - tvLazyGridState.firstVisibleItemScrollOffset < 100 + lazyGridState.firstVisibleItemIndex == 0 && + lazyGridState.firstVisibleItemScrollOffset < 100 } } LaunchedEffect(shouldShowTopBar) { @@ -107,10 +107,10 @@ private fun Catalog( .padding(top = childPadding.top), label = "", ) { it -> - TvLazyVerticalGrid( - state = tvLazyGridState, + LazyVerticalGrid( + state = lazyGridState, modifier = modifier, - columns = TvGridCells.Fixed(gridColumns), + columns = GridCells.Fixed(gridColumns), ) { itemsIndexed(it) { index, movieCategory -> var isFocused by remember { mutableStateOf(false) } diff --git a/JetStreamCompose/jetstream/src/main/java/com/google/jetstream/presentation/screens/categories/CategoryMovieListScreen.kt b/JetStreamCompose/jetstream/src/main/java/com/google/jetstream/presentation/screens/categories/CategoryMovieListScreen.kt index 9f34edb8..1647d609 100644 --- a/JetStreamCompose/jetstream/src/main/java/com/google/jetstream/presentation/screens/categories/CategoryMovieListScreen.kt +++ b/JetStreamCompose/jetstream/src/main/java/com/google/jetstream/presentation/screens/categories/CategoryMovieListScreen.kt @@ -22,6 +22,9 @@ import androidx.compose.foundation.layout.PaddingValues import androidx.compose.foundation.layout.aspectRatio import androidx.compose.foundation.layout.fillMaxSize import androidx.compose.foundation.layout.padding +import androidx.compose.foundation.lazy.grid.GridCells +import androidx.compose.foundation.lazy.grid.LazyVerticalGrid +import androidx.compose.foundation.lazy.grid.itemsIndexed import androidx.compose.runtime.Composable import androidx.compose.runtime.getValue import androidx.compose.runtime.mutableStateOf @@ -32,9 +35,6 @@ import androidx.compose.ui.text.font.FontWeight import androidx.compose.ui.unit.dp import androidx.hilt.navigation.compose.hiltViewModel import androidx.lifecycle.compose.collectAsStateWithLifecycle -import androidx.tv.foundation.lazy.grid.TvGridCells -import androidx.tv.foundation.lazy.grid.TvLazyVerticalGrid -import androidx.tv.foundation.lazy.grid.itemsIndexed import androidx.tv.material3.MaterialTheme import androidx.tv.material3.Text import com.google.jetstream.data.entities.Movie @@ -104,8 +104,8 @@ private fun CategoryDetails( vertical = childPadding.top.times(3.5f) ) ) - TvLazyVerticalGrid( - columns = TvGridCells.Fixed(6), + LazyVerticalGrid( + columns = GridCells.Fixed(6), contentPadding = PaddingValues(bottom = JetStreamBottomListPadding) ) { itemsIndexed( diff --git a/JetStreamCompose/jetstream/src/main/java/com/google/jetstream/presentation/screens/favourites/FavouritesScreen.kt b/JetStreamCompose/jetstream/src/main/java/com/google/jetstream/presentation/screens/favourites/FavouritesScreen.kt index 3e242729..6c9530cf 100644 --- a/JetStreamCompose/jetstream/src/main/java/com/google/jetstream/presentation/screens/favourites/FavouritesScreen.kt +++ b/JetStreamCompose/jetstream/src/main/java/com/google/jetstream/presentation/screens/favourites/FavouritesScreen.kt @@ -20,6 +20,7 @@ import androidx.compose.animation.core.animateDpAsState import androidx.compose.foundation.layout.Column import androidx.compose.foundation.layout.fillMaxSize import androidx.compose.foundation.layout.padding +import androidx.compose.foundation.lazy.grid.rememberLazyGridState import androidx.compose.runtime.Composable import androidx.compose.runtime.LaunchedEffect import androidx.compose.runtime.derivedStateOf @@ -30,7 +31,6 @@ import androidx.compose.ui.Modifier import androidx.compose.ui.unit.dp import androidx.hilt.navigation.compose.hiltViewModel import androidx.lifecycle.compose.collectAsStateWithLifecycle -import androidx.tv.foundation.lazy.grid.rememberTvLazyGridState import com.google.jetstream.data.entities.MovieList import com.google.jetstream.presentation.common.Loading import com.google.jetstream.presentation.screens.dashboard.rememberChildPadding @@ -74,7 +74,7 @@ private fun Catalog( modifier: Modifier = Modifier, ) { val childPadding = rememberChildPadding() - val filteredMoviesGridState = rememberTvLazyGridState() + val filteredMoviesGridState = rememberLazyGridState() val shouldShowTopBar by remember { derivedStateOf { filteredMoviesGridState.firstVisibleItemIndex == 0 && diff --git a/JetStreamCompose/jetstream/src/main/java/com/google/jetstream/presentation/screens/favourites/FilteredMoviesGrid.kt b/JetStreamCompose/jetstream/src/main/java/com/google/jetstream/presentation/screens/favourites/FilteredMoviesGrid.kt index 32545e01..192f0989 100644 --- a/JetStreamCompose/jetstream/src/main/java/com/google/jetstream/presentation/screens/favourites/FilteredMoviesGrid.kt +++ b/JetStreamCompose/jetstream/src/main/java/com/google/jetstream/presentation/screens/favourites/FilteredMoviesGrid.kt @@ -20,13 +20,13 @@ import androidx.compose.foundation.layout.Arrangement import androidx.compose.foundation.layout.PaddingValues import androidx.compose.foundation.layout.aspectRatio import androidx.compose.foundation.layout.fillMaxSize +import androidx.compose.foundation.lazy.grid.GridCells +import androidx.compose.foundation.lazy.grid.LazyGridState +import androidx.compose.foundation.lazy.grid.LazyVerticalGrid +import androidx.compose.foundation.lazy.grid.items import androidx.compose.runtime.Composable import androidx.compose.ui.Modifier import androidx.compose.ui.unit.dp -import androidx.tv.foundation.lazy.grid.TvGridCells -import androidx.tv.foundation.lazy.grid.TvLazyGridState -import androidx.tv.foundation.lazy.grid.TvLazyVerticalGrid -import androidx.tv.foundation.lazy.grid.items import com.google.jetstream.data.entities.MovieList import com.google.jetstream.presentation.common.MovieCard import com.google.jetstream.presentation.common.PosterImage @@ -34,14 +34,14 @@ import com.google.jetstream.presentation.theme.JetStreamBottomListPadding @Composable fun FilteredMoviesGrid( - state: TvLazyGridState, + state: LazyGridState, movieList: MovieList, onMovieClick: (movieId: String) -> Unit, ) { - TvLazyVerticalGrid( + LazyVerticalGrid( state = state, modifier = Modifier.fillMaxSize(), - columns = TvGridCells.Fixed(6), + columns = GridCells.Fixed(6), verticalArrangement = Arrangement.spacedBy(16.dp), horizontalArrangement = Arrangement.spacedBy(16.dp), contentPadding = PaddingValues(bottom = JetStreamBottomListPadding), diff --git a/JetStreamCompose/jetstream/src/main/java/com/google/jetstream/presentation/screens/home/HomeScreen.kt b/JetStreamCompose/jetstream/src/main/java/com/google/jetstream/presentation/screens/home/HomeScreen.kt index c1b727e7..40411cb0 100644 --- a/JetStreamCompose/jetstream/src/main/java/com/google/jetstream/presentation/screens/home/HomeScreen.kt +++ b/JetStreamCompose/jetstream/src/main/java/com/google/jetstream/presentation/screens/home/HomeScreen.kt @@ -21,6 +21,8 @@ import androidx.compose.foundation.layout.fillMaxSize import androidx.compose.foundation.layout.fillMaxWidth import androidx.compose.foundation.layout.height import androidx.compose.foundation.layout.padding +import androidx.compose.foundation.lazy.LazyColumn +import androidx.compose.foundation.lazy.rememberLazyListState import androidx.compose.runtime.Composable import androidx.compose.runtime.LaunchedEffect import androidx.compose.runtime.derivedStateOf @@ -33,9 +35,6 @@ import androidx.compose.ui.focus.onFocusChanged import androidx.compose.ui.unit.dp import androidx.hilt.navigation.compose.hiltViewModel import androidx.lifecycle.compose.collectAsStateWithLifecycle -import androidx.tv.foundation.PivotOffsets -import androidx.tv.foundation.lazy.list.TvLazyColumn -import androidx.tv.foundation.lazy.list.rememberTvLazyListState import com.google.jetstream.data.entities.Movie import com.google.jetstream.data.entities.MovieList import com.google.jetstream.data.util.StringConstants @@ -87,16 +86,14 @@ private fun Catalog( isTopBarVisible: Boolean = true, ) { - val tvLazyListState = rememberTvLazyListState() + val lazyListState = rememberLazyListState() val childPadding = rememberChildPadding() - val pivotOffset = remember { PivotOffsets() } - val pivotOffsetForImmersiveList = remember { PivotOffsets(0f, 0f) } var immersiveListHasFocus by remember { mutableStateOf(false) } val shouldShowTopBar by remember { derivedStateOf { - tvLazyListState.firstVisibleItemIndex == 0 && - tvLazyListState.firstVisibleItemScrollOffset < 300 + lazyListState.firstVisibleItemIndex == 0 && + lazyListState.firstVisibleItemScrollOffset < 300 } } @@ -104,16 +101,16 @@ private fun Catalog( onScroll(shouldShowTopBar) } LaunchedEffect(isTopBarVisible) { - if (isTopBarVisible) tvLazyListState.animateScrollToItem(0) + if (isTopBarVisible) lazyListState.animateScrollToItem(0) } - TvLazyColumn( - pivotOffsets = if (immersiveListHasFocus) pivotOffsetForImmersiveList else pivotOffset, - state = tvLazyListState, + LazyColumn( + state = lazyListState, contentPadding = PaddingValues(bottom = 108.dp), // Setting overscan margin to bottom to ensure the last row's visibility - modifier = modifier + modifier = modifier, ) { + item(contentType = "FeaturedMoviesCarousel") { FeaturedMoviesCarousel( movies = featuredMovies, diff --git a/JetStreamCompose/jetstream/src/main/java/com/google/jetstream/presentation/screens/movies/CastAndCrewList.kt b/JetStreamCompose/jetstream/src/main/java/com/google/jetstream/presentation/screens/movies/CastAndCrewList.kt index f90ddd5e..f881f86d 100644 --- a/JetStreamCompose/jetstream/src/main/java/com/google/jetstream/presentation/screens/movies/CastAndCrewList.kt +++ b/JetStreamCompose/jetstream/src/main/java/com/google/jetstream/presentation/screens/movies/CastAndCrewList.kt @@ -26,6 +26,8 @@ import androidx.compose.foundation.layout.fillMaxHeight import androidx.compose.foundation.layout.fillMaxWidth import androidx.compose.foundation.layout.padding import androidx.compose.foundation.layout.width +import androidx.compose.foundation.lazy.LazyRow +import androidx.compose.foundation.lazy.items import androidx.compose.runtime.Composable import androidx.compose.ui.ExperimentalComposeUiApi import androidx.compose.ui.Modifier @@ -35,9 +37,6 @@ import androidx.compose.ui.res.stringResource import androidx.compose.ui.text.style.TextOverflow import androidx.compose.ui.unit.dp import androidx.compose.ui.unit.sp -import androidx.tv.foundation.PivotOffsets -import androidx.tv.foundation.lazy.list.TvLazyRow -import androidx.tv.foundation.lazy.list.items import androidx.tv.material3.Border import androidx.tv.material3.CardDefaults import androidx.tv.material3.ClassicCard @@ -66,13 +65,11 @@ fun CastAndCrewList(castAndCrew: List) { ), modifier = Modifier.padding(start = childPadding.start) ) - TvLazyRow( + // ToDo: specify the pivot offset + LazyRow( modifier = Modifier .padding(top = 16.dp) .focusRestorer(), - pivotOffsets = PivotOffsets( - parentFraction = 0.07f - ), contentPadding = PaddingValues(start = childPadding.start) ) { items(castAndCrew, key = { it.id }) { diff --git a/JetStreamCompose/jetstream/src/main/java/com/google/jetstream/presentation/screens/movies/MovieDetailsScreen.kt b/JetStreamCompose/jetstream/src/main/java/com/google/jetstream/presentation/screens/movies/MovieDetailsScreen.kt index 0b672319..86228689 100644 --- a/JetStreamCompose/jetstream/src/main/java/com/google/jetstream/presentation/screens/movies/MovieDetailsScreen.kt +++ b/JetStreamCompose/jetstream/src/main/java/com/google/jetstream/presentation/screens/movies/MovieDetailsScreen.kt @@ -28,6 +28,7 @@ import androidx.compose.foundation.layout.fillMaxWidth import androidx.compose.foundation.layout.height import androidx.compose.foundation.layout.padding import androidx.compose.foundation.layout.width +import androidx.compose.foundation.lazy.LazyColumn import androidx.compose.runtime.Composable import androidx.compose.runtime.getValue import androidx.compose.ui.Modifier @@ -36,7 +37,6 @@ import androidx.compose.ui.res.stringResource import androidx.compose.ui.unit.dp import androidx.hilt.navigation.compose.hiltViewModel import androidx.lifecycle.compose.collectAsStateWithLifecycle -import androidx.tv.foundation.lazy.list.TvLazyColumn import androidx.tv.material3.MaterialTheme import com.google.jetstream.R import com.google.jetstream.data.entities.Movie @@ -94,7 +94,7 @@ private fun Details( val childPadding = rememberChildPadding() BackHandler(onBack = onBackPressed) - TvLazyColumn( + LazyColumn( contentPadding = PaddingValues(bottom = 135.dp), modifier = modifier, ) { diff --git a/JetStreamCompose/jetstream/src/main/java/com/google/jetstream/presentation/screens/movies/MoviesScreen.kt b/JetStreamCompose/jetstream/src/main/java/com/google/jetstream/presentation/screens/movies/MoviesScreen.kt index 5fedd6df..b41b9c4a 100644 --- a/JetStreamCompose/jetstream/src/main/java/com/google/jetstream/presentation/screens/movies/MoviesScreen.kt +++ b/JetStreamCompose/jetstream/src/main/java/com/google/jetstream/presentation/screens/movies/MoviesScreen.kt @@ -19,6 +19,8 @@ package com.google.jetstream.presentation.screens.movies import androidx.compose.foundation.layout.PaddingValues import androidx.compose.foundation.layout.fillMaxSize import androidx.compose.foundation.layout.padding +import androidx.compose.foundation.lazy.LazyColumn +import androidx.compose.foundation.lazy.rememberLazyListState import androidx.compose.runtime.Composable import androidx.compose.runtime.LaunchedEffect import androidx.compose.runtime.derivedStateOf @@ -28,8 +30,6 @@ import androidx.compose.ui.Modifier import androidx.compose.ui.unit.dp import androidx.hilt.navigation.compose.hiltViewModel import androidx.lifecycle.compose.collectAsStateWithLifecycle -import androidx.tv.foundation.lazy.list.TvLazyColumn -import androidx.tv.foundation.lazy.list.rememberTvLazyListState import com.google.jetstream.data.entities.Movie import com.google.jetstream.data.entities.MovieList import com.google.jetstream.data.util.StringConstants @@ -70,11 +70,11 @@ private fun Catalog( modifier: Modifier = Modifier, ) { val childPadding = rememberChildPadding() - val tvLazyListState = rememberTvLazyListState() + val lazyListState = rememberLazyListState() val shouldShowTopBar by remember { derivedStateOf { - tvLazyListState.firstVisibleItemIndex == 0 && - tvLazyListState.firstVisibleItemScrollOffset == 0 + lazyListState.firstVisibleItemIndex == 0 && + lazyListState.firstVisibleItemScrollOffset == 0 } } @@ -82,12 +82,12 @@ private fun Catalog( onScroll(shouldShowTopBar) } LaunchedEffect(isTopBarVisible) { - if (isTopBarVisible) tvLazyListState.animateScrollToItem(0) + if (isTopBarVisible) lazyListState.animateScrollToItem(0) } - TvLazyColumn( + LazyColumn( modifier = modifier, - state = tvLazyListState, + state = lazyListState, contentPadding = PaddingValues(top = childPadding.top, bottom = 104.dp) ) { item { diff --git a/JetStreamCompose/jetstream/src/main/java/com/google/jetstream/presentation/screens/movies/MoviesScreenMovieList.kt b/JetStreamCompose/jetstream/src/main/java/com/google/jetstream/presentation/screens/movies/MoviesScreenMovieList.kt index 7549ce52..5e3c9bd8 100644 --- a/JetStreamCompose/jetstream/src/main/java/com/google/jetstream/presentation/screens/movies/MoviesScreenMovieList.kt +++ b/JetStreamCompose/jetstream/src/main/java/com/google/jetstream/presentation/screens/movies/MoviesScreenMovieList.kt @@ -27,6 +27,8 @@ import androidx.compose.foundation.layout.fillMaxSize import androidx.compose.foundation.layout.height import androidx.compose.foundation.layout.padding import androidx.compose.foundation.layout.width +import androidx.compose.foundation.lazy.LazyRow +import androidx.compose.foundation.lazy.items import androidx.compose.runtime.Composable import androidx.compose.runtime.getValue import androidx.compose.runtime.mutableStateOf @@ -42,9 +44,6 @@ import androidx.compose.ui.layout.ContentScale import androidx.compose.ui.text.font.FontWeight import androidx.compose.ui.unit.Dp import androidx.compose.ui.unit.dp -import androidx.tv.foundation.PivotOffsets -import androidx.tv.foundation.lazy.list.TvLazyRow -import androidx.tv.foundation.lazy.list.items import androidx.tv.material3.Border import androidx.tv.material3.CardDefaults import androidx.tv.material3.CompactCard @@ -71,9 +70,9 @@ fun MoviesScreenMovieList( targetState = movieList, label = "", ) { movieListTarget -> - TvLazyRow( + // ToDo: specify the pivot offset to 0.07f + LazyRow( modifier = Modifier.focusRestorer(), - pivotOffsets = PivotOffsets(parentFraction = 0.07f), contentPadding = PaddingValues(start = startPadding, end = endPadding) ) { items(movieListTarget) { diff --git a/JetStreamCompose/jetstream/src/main/java/com/google/jetstream/presentation/screens/profile/AccountsSection.kt b/JetStreamCompose/jetstream/src/main/java/com/google/jetstream/presentation/screens/profile/AccountsSection.kt index c073041a..8c54afa2 100644 --- a/JetStreamCompose/jetstream/src/main/java/com/google/jetstream/presentation/screens/profile/AccountsSection.kt +++ b/JetStreamCompose/jetstream/src/main/java/com/google/jetstream/presentation/screens/profile/AccountsSection.kt @@ -19,6 +19,8 @@ package com.google.jetstream.presentation.screens.profile import androidx.compose.foundation.layout.fillMaxSize import androidx.compose.foundation.layout.padding import androidx.compose.foundation.layout.width +import androidx.compose.foundation.lazy.grid.GridCells +import androidx.compose.foundation.lazy.grid.LazyVerticalGrid import androidx.compose.runtime.Composable import androidx.compose.runtime.Immutable import androidx.compose.runtime.getValue @@ -29,8 +31,6 @@ import androidx.compose.ui.Modifier import androidx.compose.ui.focus.FocusRequester import androidx.compose.ui.focus.focusRequester import androidx.compose.ui.unit.dp -import androidx.tv.foundation.lazy.grid.TvGridCells -import androidx.tv.foundation.lazy.grid.TvLazyVerticalGrid import com.google.jetstream.data.util.StringConstants import com.google.jetstream.presentation.screens.dashboard.rememberChildPadding @@ -76,11 +76,11 @@ fun AccountsSection() { ) } - TvLazyVerticalGrid( + LazyVerticalGrid( modifier = Modifier .fillMaxSize() .padding(horizontal = childPadding.start), - columns = TvGridCells.Fixed(2), + columns = GridCells.Fixed(2), content = { items(accountsSectionListItems.size) { index -> AccountsSelectionItem( diff --git a/JetStreamCompose/jetstream/src/main/java/com/google/jetstream/presentation/screens/profile/LanguageSection.kt b/JetStreamCompose/jetstream/src/main/java/com/google/jetstream/presentation/screens/profile/LanguageSection.kt index 9df80590..7685baee 100644 --- a/JetStreamCompose/jetstream/src/main/java/com/google/jetstream/presentation/screens/profile/LanguageSection.kt +++ b/JetStreamCompose/jetstream/src/main/java/com/google/jetstream/presentation/screens/profile/LanguageSection.kt @@ -17,14 +17,13 @@ package com.google.jetstream.presentation.screens.profile import androidx.compose.foundation.layout.padding +import androidx.compose.foundation.lazy.LazyColumn import androidx.compose.material.icons.Icons import androidx.compose.material.icons.filled.Check import androidx.compose.runtime.Composable import androidx.compose.ui.Modifier import androidx.compose.ui.res.stringResource import androidx.compose.ui.unit.dp -import androidx.tv.foundation.lazy.list.TvLazyColumn -import androidx.tv.material3.ExperimentalTvMaterial3Api import androidx.tv.material3.Icon import androidx.tv.material3.ListItem import androidx.tv.material3.ListItemDefaults @@ -35,14 +34,13 @@ import com.google.jetstream.R import com.google.jetstream.data.util.StringConstants import com.google.jetstream.presentation.theme.JetStreamCardShape -@OptIn(ExperimentalTvMaterial3Api::class) @Composable fun LanguageSection( selectedIndex: Int, onSelectedIndexChange: (currentIndex: Int) -> Unit ) { with(StringConstants.Composable.Placeholders) { - TvLazyColumn(modifier = Modifier.padding(horizontal = 72.dp)) { + LazyColumn(modifier = Modifier.padding(horizontal = 72.dp)) { item { Text( text = LanguageSectionTitle, diff --git a/JetStreamCompose/jetstream/src/main/java/com/google/jetstream/presentation/screens/profile/SearchHistorySection.kt b/JetStreamCompose/jetstream/src/main/java/com/google/jetstream/presentation/screens/profile/SearchHistorySection.kt index 763a09cb..af090a8b 100644 --- a/JetStreamCompose/jetstream/src/main/java/com/google/jetstream/presentation/screens/profile/SearchHistorySection.kt +++ b/JetStreamCompose/jetstream/src/main/java/com/google/jetstream/presentation/screens/profile/SearchHistorySection.kt @@ -20,12 +20,11 @@ import androidx.compose.foundation.layout.Arrangement import androidx.compose.foundation.layout.Row import androidx.compose.foundation.layout.fillMaxWidth import androidx.compose.foundation.layout.padding +import androidx.compose.foundation.lazy.LazyColumn import androidx.compose.runtime.Composable import androidx.compose.ui.Modifier import androidx.compose.ui.unit.dp -import androidx.tv.foundation.lazy.list.TvLazyColumn import androidx.tv.material3.Button -import androidx.tv.material3.ExperimentalTvMaterial3Api import androidx.tv.material3.ListItem import androidx.tv.material3.ListItemDefaults import androidx.tv.material3.MaterialTheme @@ -33,11 +32,10 @@ import androidx.tv.material3.Text import com.google.jetstream.data.util.StringConstants import com.google.jetstream.presentation.theme.JetStreamCardShape -@OptIn(ExperimentalTvMaterial3Api::class) @Composable fun SearchHistorySection() { with(StringConstants.Composable.Placeholders) { - TvLazyColumn(modifier = Modifier.padding(horizontal = 72.dp)) { + LazyColumn(modifier = Modifier.padding(horizontal = 72.dp)) { item { Row( modifier = Modifier.fillMaxWidth(), diff --git a/JetStreamCompose/jetstream/src/main/java/com/google/jetstream/presentation/screens/search/SearchScreen.kt b/JetStreamCompose/jetstream/src/main/java/com/google/jetstream/presentation/screens/search/SearchScreen.kt index 2d19a996..18855fea 100644 --- a/JetStreamCompose/jetstream/src/main/java/com/google/jetstream/presentation/screens/search/SearchScreen.kt +++ b/JetStreamCompose/jetstream/src/main/java/com/google/jetstream/presentation/screens/search/SearchScreen.kt @@ -25,6 +25,9 @@ import androidx.compose.foundation.layout.Box import androidx.compose.foundation.layout.fillMaxSize import androidx.compose.foundation.layout.fillMaxWidth import androidx.compose.foundation.layout.padding +import androidx.compose.foundation.lazy.LazyColumn +import androidx.compose.foundation.lazy.LazyListState +import androidx.compose.foundation.lazy.rememberLazyListState import androidx.compose.foundation.text.BasicTextField import androidx.compose.foundation.text.KeyboardActions import androidx.compose.foundation.text.KeyboardOptions @@ -49,9 +52,6 @@ import androidx.compose.ui.text.input.ImeAction import androidx.compose.ui.unit.dp import androidx.hilt.navigation.compose.hiltViewModel import androidx.lifecycle.compose.collectAsStateWithLifecycle -import androidx.tv.foundation.lazy.list.TvLazyColumn -import androidx.tv.foundation.lazy.list.TvLazyListState -import androidx.tv.foundation.lazy.list.rememberTvLazyListState import androidx.tv.material3.Border import androidx.tv.material3.ClickableSurfaceDefaults import androidx.tv.material3.ExperimentalTvMaterial3Api @@ -73,11 +73,11 @@ fun SearchScreen( onScroll: (isTopBarVisible: Boolean) -> Unit, searchScreenViewModel: SearchScreenViewModel = hiltViewModel(), ) { - val tvLazyColumnState = rememberTvLazyListState() + val lazyColumnState = rememberLazyListState() val shouldShowTopBar by remember { derivedStateOf { - tvLazyColumnState.firstVisibleItemIndex == 0 && - tvLazyColumnState.firstVisibleItemScrollOffset < 100 + lazyColumnState.firstVisibleItemIndex == 0 && + lazyColumnState.firstVisibleItemScrollOffset < 100 } } @@ -110,7 +110,7 @@ fun SearchResult( searchMovies: (queryString: String) -> Unit, onMovieClick: (movie: Movie) -> Unit, modifier: Modifier = Modifier, - tvLazyColumnState: TvLazyListState = rememberTvLazyListState(), + lazyColumnState: LazyListState = rememberLazyListState(), ) { val childPadding = rememberChildPadding() var searchQuery by remember { mutableStateOf("") } @@ -119,9 +119,9 @@ fun SearchResult( val tfInteractionSource = remember { MutableInteractionSource() } val isTfFocused by tfInteractionSource.collectIsFocusedAsState() - TvLazyColumn( + LazyColumn( modifier = modifier, - state = tvLazyColumnState + state = lazyColumnState ) { item { Surface( @@ -204,7 +204,7 @@ fun SearchResult( ) ), keyboardOptions = KeyboardOptions( - autoCorrect = false, + autoCorrectEnabled = false, imeAction = ImeAction.Search ), keyboardActions = KeyboardActions( diff --git a/JetStreamCompose/jetstream/src/main/java/com/google/jetstream/presentation/screens/shows/ShowsScreen.kt b/JetStreamCompose/jetstream/src/main/java/com/google/jetstream/presentation/screens/shows/ShowsScreen.kt index 4c74c7f7..7ec8a304 100644 --- a/JetStreamCompose/jetstream/src/main/java/com/google/jetstream/presentation/screens/shows/ShowsScreen.kt +++ b/JetStreamCompose/jetstream/src/main/java/com/google/jetstream/presentation/screens/shows/ShowsScreen.kt @@ -19,6 +19,8 @@ package com.google.jetstream.presentation.screens.shows import androidx.compose.foundation.layout.PaddingValues import androidx.compose.foundation.layout.fillMaxSize import androidx.compose.foundation.layout.padding +import androidx.compose.foundation.lazy.LazyColumn +import androidx.compose.foundation.lazy.rememberLazyListState import androidx.compose.runtime.Composable import androidx.compose.runtime.LaunchedEffect import androidx.compose.runtime.derivedStateOf @@ -28,8 +30,6 @@ import androidx.compose.ui.Modifier import androidx.compose.ui.unit.dp import androidx.hilt.navigation.compose.hiltViewModel import androidx.lifecycle.compose.collectAsStateWithLifecycle -import androidx.tv.foundation.lazy.list.TvLazyColumn -import androidx.tv.foundation.lazy.list.rememberTvLazyListState import com.google.jetstream.data.entities.Movie import com.google.jetstream.data.entities.MovieList import com.google.jetstream.data.util.StringConstants @@ -74,11 +74,11 @@ private fun Catalog( modifier: Modifier = Modifier ) { val childPadding = rememberChildPadding() - val tvLazyListState = rememberTvLazyListState() + val lazyListState = rememberLazyListState() val shouldShowTopBar by remember { derivedStateOf { - tvLazyListState.firstVisibleItemIndex == 0 && - tvLazyListState.firstVisibleItemScrollOffset == 0 + lazyListState.firstVisibleItemIndex == 0 && + lazyListState.firstVisibleItemScrollOffset == 0 } } @@ -86,12 +86,12 @@ private fun Catalog( onScroll(shouldShowTopBar) } LaunchedEffect(isTopBarVisible) { - if (isTopBarVisible) tvLazyListState.animateScrollToItem(0) + if (isTopBarVisible) lazyListState.animateScrollToItem(0) } - TvLazyColumn( + LazyColumn( modifier = modifier, - state = tvLazyListState, + state = lazyListState, contentPadding = PaddingValues(top = childPadding.top, bottom = 104.dp) ) { item { diff --git a/JetStreamCompose/jetstream/src/main/java/com/google/jetstream/tvmaterial/Dialog.kt b/JetStreamCompose/jetstream/src/main/java/com/google/jetstream/tvmaterial/Dialog.kt index ab4072ad..ac683306 100644 --- a/JetStreamCompose/jetstream/src/main/java/com/google/jetstream/tvmaterial/Dialog.kt +++ b/JetStreamCompose/jetstream/src/main/java/com/google/jetstream/tvmaterial/Dialog.kt @@ -20,8 +20,8 @@ import androidx.compose.animation.core.CubicBezierEasing import androidx.compose.animation.core.MutableTransitionState import androidx.compose.animation.core.Transition import androidx.compose.animation.core.animateFloat +import androidx.compose.animation.core.rememberTransition import androidx.compose.animation.core.tween -import androidx.compose.animation.core.updateTransition import androidx.compose.foundation.ExperimentalFoundationApi import androidx.compose.foundation.focusGroup import androidx.compose.foundation.layout.Arrangement @@ -385,13 +385,13 @@ fun Dialog( var alphaTransitionState by remember { mutableStateOf(MutableTransitionState(AnimationStage.Intro)) } - val alphaTransition = updateTransition(alphaTransitionState, label = "alphaTransition") + val alphaTransition = rememberTransition(alphaTransitionState, label = "alphaTransition") // Transitions for dialog content scaling. var scaleTransitionState by remember { mutableStateOf(MutableTransitionState(AnimationStage.Intro)) } - val scaleTransition = updateTransition(scaleTransitionState, label = "scaleTransition") + val scaleTransition = rememberTransition(scaleTransitionState, label = "scaleTransition") if (showDialog || alphaTransitionState.targetState != AnimationStage.Intro || scaleTransitionState.targetState != AnimationStage.Intro From 32a5086db0e090e93f9141087f9f4fa45efd2baa Mon Sep 17 00:00:00 2001 From: Chiko Shimizu Date: Fri, 17 May 2024 15:52:15 +0900 Subject: [PATCH 13/20] spotless Apply --- .../screens/videoPlayer/VideoPlayerScreen.kt | 45 +++++++++---------- 1 file changed, 22 insertions(+), 23 deletions(-) diff --git a/JetStreamCompose/jetstream/src/main/java/com/google/jetstream/presentation/screens/videoPlayer/VideoPlayerScreen.kt b/JetStreamCompose/jetstream/src/main/java/com/google/jetstream/presentation/screens/videoPlayer/VideoPlayerScreen.kt index 648c9eae..4cdc6314 100644 --- a/JetStreamCompose/jetstream/src/main/java/com/google/jetstream/presentation/screens/videoPlayer/VideoPlayerScreen.kt +++ b/JetStreamCompose/jetstream/src/main/java/com/google/jetstream/presentation/screens/videoPlayer/VideoPlayerScreen.kt @@ -5,7 +5,7 @@ * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * - * https://www.apache.org/licenses/LICENSE-2.0 + * https://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, @@ -69,8 +69,8 @@ import com.google.jetstream.presentation.screens.videoPlayer.components.VideoPla import com.google.jetstream.presentation.screens.videoPlayer.components.rememberVideoPlayerPulseState import com.google.jetstream.presentation.screens.videoPlayer.components.rememberVideoPlayerState import com.google.jetstream.presentation.utils.handleDPadKeyEvents -import kotlinx.coroutines.delay import kotlin.time.Duration.Companion.milliseconds +import kotlinx.coroutines.delay object VideoPlayerScreen { const val MovieIdBundleKey = "movieId" @@ -123,7 +123,8 @@ fun VideoPlayerScreenContent(movieDetails: MovieDetails, onBackPressed: () -> Un emptyList() } else { listOf( - MediaItem.SubtitleConfiguration.Builder(Uri.parse(movieDetails.subtitleUri)) + MediaItem.SubtitleConfiguration + .Builder(Uri.parse(movieDetails.subtitleUri)) .setMimeType("application/vtt") .setLanguage("en") .setSelectionFlags(C.SELECTION_FLAG_DEFAULT) @@ -206,7 +207,6 @@ fun VideoPlayerControls( } } - VideoPlayerMainFrame( mediaTitle = { VideoPlayerMediaTitle( @@ -264,7 +264,6 @@ fun VideoPlayerControls( ) } - @androidx.annotation.OptIn(UnstableApi::class) @Composable private fun rememberExoPlayer(context: Context) = remember { @@ -287,22 +286,22 @@ private fun Modifier.dPadEvents( videoPlayerState: VideoPlayerState, pulseState: VideoPlayerPulseState ): Modifier = this.handleDPadKeyEvents( - onLeft = { - if (!videoPlayerState.controlsVisible) { - exoPlayer.seekBack() - pulseState.setType(BACK) - } - }, - onRight = { - if (!videoPlayerState.controlsVisible) { - exoPlayer.seekForward() - pulseState.setType(FORWARD) - } - }, - onUp = { videoPlayerState.showControls() }, - onDown = { videoPlayerState.showControls() }, - onEnter = { - exoPlayer.pause() - videoPlayerState.showControls() + onLeft = { + if (!videoPlayerState.controlsVisible) { + exoPlayer.seekBack() + pulseState.setType(BACK) } -) \ No newline at end of file + }, + onRight = { + if (!videoPlayerState.controlsVisible) { + exoPlayer.seekForward() + pulseState.setType(FORWARD) + } + }, + onUp = { videoPlayerState.showControls() }, + onDown = { videoPlayerState.showControls() }, + onEnter = { + exoPlayer.pause() + videoPlayerState.showControls() + } +) From 119d63a941f9b9ae034aa56d1efa684578cb0a23 Mon Sep 17 00:00:00 2001 From: Chiko Shimizu Date: Mon, 20 May 2024 14:44:36 +0900 Subject: [PATCH 14/20] Update Kotlin version to 2.0.0-RC3 and the settings accordingly. --- JetStreamCompose/benchmark/build.gradle.kts | 2 +- JetStreamCompose/build.gradle.kts | 11 ++++++----- JetStreamCompose/gradle/libs.versions.toml | 5 +++-- JetStreamCompose/jetstream/build.gradle.kts | 9 ++++++--- 4 files changed, 16 insertions(+), 11 deletions(-) diff --git a/JetStreamCompose/benchmark/build.gradle.kts b/JetStreamCompose/benchmark/build.gradle.kts index 2bc216e7..cdec970e 100644 --- a/JetStreamCompose/benchmark/build.gradle.kts +++ b/JetStreamCompose/benchmark/build.gradle.kts @@ -18,6 +18,7 @@ plugins { alias(libs.plugins.android.test) alias(libs.plugins.kotlin.android) + alias(libs.plugins.compose.compiler) } android { @@ -51,7 +52,6 @@ android { } targetProjectPath = ":jetstream" - experimentalProperties["android.experimental.self-instrumenting"] = true } dependencies { diff --git a/JetStreamCompose/build.gradle.kts b/JetStreamCompose/build.gradle.kts index 50e44ac3..e2c1f86f 100644 --- a/JetStreamCompose/build.gradle.kts +++ b/JetStreamCompose/build.gradle.kts @@ -23,10 +23,11 @@ https://youtrack.jetbrains.com/issue/KTIJ-19369/ */ plugins { - alias(libs.plugins.android.application) apply(false) - alias(libs.plugins.kotlin.android) apply(false) - alias(libs.plugins.kotlin.serialization) apply(false) - alias(libs.plugins.android.test) apply(false) - alias(libs.plugins.hilt) apply(false) + alias(libs.plugins.android.application) apply false + alias(libs.plugins.kotlin.android) apply false + alias(libs.plugins.kotlin.serialization) apply false + alias(libs.plugins.compose.compiler) apply false + alias(libs.plugins.android.test) apply false + alias(libs.plugins.hilt) apply false alias(libs.plugins.ksp) apply false } diff --git a/JetStreamCompose/gradle/libs.versions.toml b/JetStreamCompose/gradle/libs.versions.toml index a7094508..2d135c0c 100644 --- a/JetStreamCompose/gradle/libs.versions.toml +++ b/JetStreamCompose/gradle/libs.versions.toml @@ -13,9 +13,9 @@ core-splashscreen = "1.0.1" hilt-navigation-compose = "1.2.0" hilt-android = "2.51.1" junit = "1.1.5" -kotlin-android = "1.9.24" +kotlin-android = "2.0.0-RC3" kotlinx-serialization = "1.6.0" -ksp = "1.9.24-1.0.20" +ksp = "2.0.0-RC3-1.0.20" lifecycle-runtime-ktx = "2.8.0" media3-ui = "1.3.1" media3-exoplayer = "1.3.1" @@ -55,5 +55,6 @@ android-application = { id = "com.android.application", version.ref = "android-g android-test = { id = "com.android.test", version.ref = "android-test-plugin" } kotlin-android = { id = "org.jetbrains.kotlin.android", version.ref = "kotlin-android" } kotlin-serialization = { id = "org.jetbrains.kotlin.plugin.serialization", version.ref = "kotlin-android" } +compose-compiler = { id = "org.jetbrains.kotlin.plugin.compose", version.ref = "kotlin-android" } hilt = { id = "com.google.dagger.hilt.android", version.ref = "hilt-android" } ksp = { id = "com.google.devtools.ksp", version.ref = "ksp" } \ No newline at end of file diff --git a/JetStreamCompose/jetstream/build.gradle.kts b/JetStreamCompose/jetstream/build.gradle.kts index fe4c8538..624f98e5 100644 --- a/JetStreamCompose/jetstream/build.gradle.kts +++ b/JetStreamCompose/jetstream/build.gradle.kts @@ -19,6 +19,7 @@ plugins { alias(libs.plugins.android.application) alias(libs.plugins.kotlin.android) alias(libs.plugins.kotlin.serialization) + alias(libs.plugins.compose.compiler) alias(libs.plugins.hilt) alias(libs.plugins.ksp) } @@ -27,6 +28,10 @@ kotlin { jvmToolchain(17) } +composeCompiler { + enableStrongSkippingMode = true +} + android { namespace = "com.google.jetstream" // Needed for latest androidx snapshot build @@ -69,9 +74,7 @@ android { compose = true buildConfig = true } - composeOptions { - kotlinCompilerExtensionVersion = "1.5.14" - } + packaging { resources { excludes += "/META-INF/{AL2.0,LGPL2.1}" From 42d684f8a7c74445dba5fd4296a9f82981ac44c1 Mon Sep 17 00:00:00 2001 From: Chiko Shimizu Date: Mon, 20 May 2024 14:45:56 +0900 Subject: [PATCH 15/20] Remove the indentation of the line for the URL of the license --- .../com/google/jetstream/benchmark/BaselineProfileGenerator.kt | 2 +- .../java/com/google/jetstream/benchmark/StartupBenchmark.kt | 2 +- .../src/main/java/com/google/jetstream/JetStreamApplication.kt | 2 +- .../src/main/java/com/google/jetstream/MainActivity.kt | 2 +- .../src/main/java/com/google/jetstream/data/entities/Movie.kt | 2 +- .../main/java/com/google/jetstream/data/entities/MovieCast.kt | 2 +- .../java/com/google/jetstream/data/entities/MovieCategory.kt | 2 +- .../com/google/jetstream/data/entities/MovieCategoryDetails.kt | 2 +- .../com/google/jetstream/data/entities/MovieCategoryList.kt | 2 +- .../java/com/google/jetstream/data/entities/MovieDetails.kt | 2 +- .../main/java/com/google/jetstream/data/entities/MovieList.kt | 2 +- .../google/jetstream/data/entities/MovieReviewsAndRatings.kt | 2 +- .../java/com/google/jetstream/data/models/MovieCastResponse.kt | 2 +- .../com/google/jetstream/data/models/MovieCategoriesResponse.kt | 2 +- .../java/com/google/jetstream/data/models/MoviesResponse.kt | 2 +- .../com/google/jetstream/data/repositories/CachedDataReader.kt | 2 +- .../google/jetstream/data/repositories/MovieCastDataSource.kt | 2 +- .../jetstream/data/repositories/MovieCategoryDataSource.kt | 2 +- .../com/google/jetstream/data/repositories/MovieDataSource.kt | 2 +- .../com/google/jetstream/data/repositories/MovieRepository.kt | 2 +- .../google/jetstream/data/repositories/MovieRepositoryImpl.kt | 2 +- .../java/com/google/jetstream/data/repositories/TvDataSource.kt | 2 +- .../src/main/java/com/google/jetstream/data/util/AssetReader.kt | 2 +- .../main/java/com/google/jetstream/data/util/StringConstants.kt | 2 +- .../src/main/java/com/google/jetstream/presentation/App.kt | 2 +- .../main/java/com/google/jetstream/presentation/common/Error.kt | 2 +- .../java/com/google/jetstream/presentation/common/Loading.kt | 2 +- .../java/com/google/jetstream/presentation/common/MovieCard.kt | 2 +- .../java/com/google/jetstream/presentation/common/MoviesRow.kt | 2 +- .../com/google/jetstream/presentation/common/PosterImage.kt | 2 +- .../java/com/google/jetstream/presentation/screens/Screens.kt | 2 +- .../presentation/screens/categories/CategoriesScreen.kt | 2 +- .../screens/categories/CategoriesScreenViewModel.kt | 2 +- .../presentation/screens/categories/CategoryMovieListScreen.kt | 2 +- .../screens/categories/CategoryMovieListScreenViewModel.kt | 2 +- .../jetstream/presentation/screens/dashboard/DashboardScreen.kt | 2 +- .../jetstream/presentation/screens/dashboard/DashboardTopBar.kt | 2 +- .../screens/dashboard/DashboardTopBarItemIndicator.kt | 2 +- .../jetstream/presentation/screens/dashboard/UserAvatar.kt | 2 +- .../presentation/screens/favourites/FavouriteScreenViewModel.kt | 2 +- .../presentation/screens/favourites/FavouritesScreen.kt | 2 +- .../presentation/screens/favourites/FilteredMoviesGrid.kt | 2 +- .../presentation/screens/favourites/MovieFilterChip.kt | 2 +- .../presentation/screens/favourites/MovieFilterChipRow.kt | 2 +- .../presentation/screens/home/FeaturedMoviesCarousel.kt | 2 +- .../google/jetstream/presentation/screens/home/HomeScreen.kt | 2 +- .../jetstream/presentation/screens/home/HomeScreenViewModel.kt | 2 +- .../jetstream/presentation/screens/home/Top10MoviesList.kt | 2 +- .../jetstream/presentation/screens/movies/CastAndCrewList.kt | 2 +- .../jetstream/presentation/screens/movies/DotSeparatedRow.kt | 2 +- .../jetstream/presentation/screens/movies/MovieDetails.kt | 2 +- .../jetstream/presentation/screens/movies/MovieDetailsScreen.kt | 2 +- .../presentation/screens/movies/MovieDetailsScreenViewModel.kt | 2 +- .../jetstream/presentation/screens/movies/MovieReviews.kt | 2 +- .../jetstream/presentation/screens/movies/MoviesScreen.kt | 2 +- .../presentation/screens/movies/MoviesScreenMovieList.kt | 2 +- .../presentation/screens/movies/MoviesScreenViewModel.kt | 2 +- .../jetstream/presentation/screens/movies/TitleValueText.kt | 2 +- .../jetstream/presentation/screens/profile/AboutSection.kt | 2 +- .../jetstream/presentation/screens/profile/AccountsSection.kt | 2 +- .../presentation/screens/profile/AccountsSectionDeleteDialog.kt | 2 +- .../presentation/screens/profile/AccountsSectionDialogButton.kt | 2 +- .../presentation/screens/profile/AccountsSelectionItem.kt | 2 +- .../presentation/screens/profile/HelpAndSupportSection.kt | 2 +- .../jetstream/presentation/screens/profile/LanguageSection.kt | 2 +- .../jetstream/presentation/screens/profile/ProfileScreen.kt | 2 +- .../jetstream/presentation/screens/profile/ProfileScreens.kt | 2 +- .../presentation/screens/profile/SearchHistorySection.kt | 2 +- .../jetstream/presentation/screens/profile/SubtitlesSection.kt | 2 +- .../jetstream/presentation/screens/search/SearchScreen.kt | 2 +- .../presentation/screens/search/SearchScreenViewModel.kt | 2 +- .../jetstream/presentation/screens/shows/ShowScreenViewModel.kt | 2 +- .../google/jetstream/presentation/screens/shows/ShowsScreen.kt | 2 +- .../presentation/screens/videoPlayer/VideoPlayerScreen.kt | 2 +- .../screens/videoPlayer/VideoPlayerScreenViewModel.kt | 2 +- .../screens/videoPlayer/components/VideoPlayerControllerText.kt | 2 +- .../screens/videoPlayer/components/VideoPlayerControlsIcon.kt | 2 +- .../screens/videoPlayer/components/VideoPlayerIndicator.kt | 2 +- .../screens/videoPlayer/components/VideoPlayerMainFrame.kt | 2 +- .../screens/videoPlayer/components/VideoPlayerMediaTitle.kt | 2 +- .../screens/videoPlayer/components/VideoPlayerOverlay.kt | 2 +- .../screens/videoPlayer/components/VideoPlayerPulse.kt | 2 +- .../screens/videoPlayer/components/VideoPlayerSeeker.kt | 2 +- .../screens/videoPlayer/components/VideoPlayerState.kt | 2 +- .../google/jetstream/presentation/theme/JetStreamFocusTheme.kt | 2 +- .../main/java/com/google/jetstream/presentation/theme/Theme.kt | 2 +- .../main/java/com/google/jetstream/presentation/theme/Type.kt | 2 +- .../presentation/utils/BringIntoViewIfChildrenAreFocused.kt | 2 +- .../main/java/com/google/jetstream/presentation/utils/Colors.kt | 2 +- .../java/com/google/jetstream/presentation/utils/GradientBg.kt | 2 +- .../com/google/jetstream/presentation/utils/ModifierUtils.kt | 2 +- .../java/com/google/jetstream/presentation/utils/Padding.kt | 2 +- .../src/main/java/com/google/jetstream/tvmaterial/Dialog.kt | 2 +- .../src/main/java/com/google/jetstream/tvmaterial/Shapes.kt | 2 +- JetStreamCompose/spotless/copyright.kt | 2 +- 95 files changed, 95 insertions(+), 95 deletions(-) diff --git a/JetStreamCompose/benchmark/src/main/java/com/google/jetstream/benchmark/BaselineProfileGenerator.kt b/JetStreamCompose/benchmark/src/main/java/com/google/jetstream/benchmark/BaselineProfileGenerator.kt index 9697535f..71b1b61a 100644 --- a/JetStreamCompose/benchmark/src/main/java/com/google/jetstream/benchmark/BaselineProfileGenerator.kt +++ b/JetStreamCompose/benchmark/src/main/java/com/google/jetstream/benchmark/BaselineProfileGenerator.kt @@ -5,7 +5,7 @@ * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * - * https://www.apache.org/licenses/LICENSE-2.0 + * https://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, diff --git a/JetStreamCompose/benchmark/src/main/java/com/google/jetstream/benchmark/StartupBenchmark.kt b/JetStreamCompose/benchmark/src/main/java/com/google/jetstream/benchmark/StartupBenchmark.kt index 44206835..16d576c9 100644 --- a/JetStreamCompose/benchmark/src/main/java/com/google/jetstream/benchmark/StartupBenchmark.kt +++ b/JetStreamCompose/benchmark/src/main/java/com/google/jetstream/benchmark/StartupBenchmark.kt @@ -5,7 +5,7 @@ * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * - * https://www.apache.org/licenses/LICENSE-2.0 + * https://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, diff --git a/JetStreamCompose/jetstream/src/main/java/com/google/jetstream/JetStreamApplication.kt b/JetStreamCompose/jetstream/src/main/java/com/google/jetstream/JetStreamApplication.kt index 1600a312..07e3b157 100644 --- a/JetStreamCompose/jetstream/src/main/java/com/google/jetstream/JetStreamApplication.kt +++ b/JetStreamCompose/jetstream/src/main/java/com/google/jetstream/JetStreamApplication.kt @@ -5,7 +5,7 @@ * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * - * https://www.apache.org/licenses/LICENSE-2.0 + * https://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, diff --git a/JetStreamCompose/jetstream/src/main/java/com/google/jetstream/MainActivity.kt b/JetStreamCompose/jetstream/src/main/java/com/google/jetstream/MainActivity.kt index 7c5392bf..41f18b58 100644 --- a/JetStreamCompose/jetstream/src/main/java/com/google/jetstream/MainActivity.kt +++ b/JetStreamCompose/jetstream/src/main/java/com/google/jetstream/MainActivity.kt @@ -5,7 +5,7 @@ * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * - * https://www.apache.org/licenses/LICENSE-2.0 + * https://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, diff --git a/JetStreamCompose/jetstream/src/main/java/com/google/jetstream/data/entities/Movie.kt b/JetStreamCompose/jetstream/src/main/java/com/google/jetstream/data/entities/Movie.kt index 59541b80..633937fc 100644 --- a/JetStreamCompose/jetstream/src/main/java/com/google/jetstream/data/entities/Movie.kt +++ b/JetStreamCompose/jetstream/src/main/java/com/google/jetstream/data/entities/Movie.kt @@ -5,7 +5,7 @@ * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * - * https://www.apache.org/licenses/LICENSE-2.0 + * https://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, diff --git a/JetStreamCompose/jetstream/src/main/java/com/google/jetstream/data/entities/MovieCast.kt b/JetStreamCompose/jetstream/src/main/java/com/google/jetstream/data/entities/MovieCast.kt index a79a159b..694b1aed 100644 --- a/JetStreamCompose/jetstream/src/main/java/com/google/jetstream/data/entities/MovieCast.kt +++ b/JetStreamCompose/jetstream/src/main/java/com/google/jetstream/data/entities/MovieCast.kt @@ -5,7 +5,7 @@ * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * - * https://www.apache.org/licenses/LICENSE-2.0 + * https://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, diff --git a/JetStreamCompose/jetstream/src/main/java/com/google/jetstream/data/entities/MovieCategory.kt b/JetStreamCompose/jetstream/src/main/java/com/google/jetstream/data/entities/MovieCategory.kt index feb469b0..8f25c942 100644 --- a/JetStreamCompose/jetstream/src/main/java/com/google/jetstream/data/entities/MovieCategory.kt +++ b/JetStreamCompose/jetstream/src/main/java/com/google/jetstream/data/entities/MovieCategory.kt @@ -5,7 +5,7 @@ * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * - * https://www.apache.org/licenses/LICENSE-2.0 + * https://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, diff --git a/JetStreamCompose/jetstream/src/main/java/com/google/jetstream/data/entities/MovieCategoryDetails.kt b/JetStreamCompose/jetstream/src/main/java/com/google/jetstream/data/entities/MovieCategoryDetails.kt index 23995682..6355896d 100644 --- a/JetStreamCompose/jetstream/src/main/java/com/google/jetstream/data/entities/MovieCategoryDetails.kt +++ b/JetStreamCompose/jetstream/src/main/java/com/google/jetstream/data/entities/MovieCategoryDetails.kt @@ -5,7 +5,7 @@ * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * - * https://www.apache.org/licenses/LICENSE-2.0 + * https://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, diff --git a/JetStreamCompose/jetstream/src/main/java/com/google/jetstream/data/entities/MovieCategoryList.kt b/JetStreamCompose/jetstream/src/main/java/com/google/jetstream/data/entities/MovieCategoryList.kt index 6bb78bf5..99b3fcec 100644 --- a/JetStreamCompose/jetstream/src/main/java/com/google/jetstream/data/entities/MovieCategoryList.kt +++ b/JetStreamCompose/jetstream/src/main/java/com/google/jetstream/data/entities/MovieCategoryList.kt @@ -5,7 +5,7 @@ * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * - * https://www.apache.org/licenses/LICENSE-2.0 + * https://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, diff --git a/JetStreamCompose/jetstream/src/main/java/com/google/jetstream/data/entities/MovieDetails.kt b/JetStreamCompose/jetstream/src/main/java/com/google/jetstream/data/entities/MovieDetails.kt index ff8a29c0..84a9d80a 100644 --- a/JetStreamCompose/jetstream/src/main/java/com/google/jetstream/data/entities/MovieDetails.kt +++ b/JetStreamCompose/jetstream/src/main/java/com/google/jetstream/data/entities/MovieDetails.kt @@ -5,7 +5,7 @@ * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * - * https://www.apache.org/licenses/LICENSE-2.0 + * https://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, diff --git a/JetStreamCompose/jetstream/src/main/java/com/google/jetstream/data/entities/MovieList.kt b/JetStreamCompose/jetstream/src/main/java/com/google/jetstream/data/entities/MovieList.kt index 65f49411..eb6a37ae 100644 --- a/JetStreamCompose/jetstream/src/main/java/com/google/jetstream/data/entities/MovieList.kt +++ b/JetStreamCompose/jetstream/src/main/java/com/google/jetstream/data/entities/MovieList.kt @@ -5,7 +5,7 @@ * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * - * https://www.apache.org/licenses/LICENSE-2.0 + * https://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, diff --git a/JetStreamCompose/jetstream/src/main/java/com/google/jetstream/data/entities/MovieReviewsAndRatings.kt b/JetStreamCompose/jetstream/src/main/java/com/google/jetstream/data/entities/MovieReviewsAndRatings.kt index 70b3ea24..6004d417 100644 --- a/JetStreamCompose/jetstream/src/main/java/com/google/jetstream/data/entities/MovieReviewsAndRatings.kt +++ b/JetStreamCompose/jetstream/src/main/java/com/google/jetstream/data/entities/MovieReviewsAndRatings.kt @@ -5,7 +5,7 @@ * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * - * https://www.apache.org/licenses/LICENSE-2.0 + * https://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, diff --git a/JetStreamCompose/jetstream/src/main/java/com/google/jetstream/data/models/MovieCastResponse.kt b/JetStreamCompose/jetstream/src/main/java/com/google/jetstream/data/models/MovieCastResponse.kt index 6356bc47..5ec4e7ec 100644 --- a/JetStreamCompose/jetstream/src/main/java/com/google/jetstream/data/models/MovieCastResponse.kt +++ b/JetStreamCompose/jetstream/src/main/java/com/google/jetstream/data/models/MovieCastResponse.kt @@ -5,7 +5,7 @@ * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * - * https://www.apache.org/licenses/LICENSE-2.0 + * https://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, diff --git a/JetStreamCompose/jetstream/src/main/java/com/google/jetstream/data/models/MovieCategoriesResponse.kt b/JetStreamCompose/jetstream/src/main/java/com/google/jetstream/data/models/MovieCategoriesResponse.kt index bcdbc76b..a25561f2 100644 --- a/JetStreamCompose/jetstream/src/main/java/com/google/jetstream/data/models/MovieCategoriesResponse.kt +++ b/JetStreamCompose/jetstream/src/main/java/com/google/jetstream/data/models/MovieCategoriesResponse.kt @@ -5,7 +5,7 @@ * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * - * https://www.apache.org/licenses/LICENSE-2.0 + * https://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, diff --git a/JetStreamCompose/jetstream/src/main/java/com/google/jetstream/data/models/MoviesResponse.kt b/JetStreamCompose/jetstream/src/main/java/com/google/jetstream/data/models/MoviesResponse.kt index 18c2adaa..36a6cbb4 100644 --- a/JetStreamCompose/jetstream/src/main/java/com/google/jetstream/data/models/MoviesResponse.kt +++ b/JetStreamCompose/jetstream/src/main/java/com/google/jetstream/data/models/MoviesResponse.kt @@ -5,7 +5,7 @@ * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * - * https://www.apache.org/licenses/LICENSE-2.0 + * https://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, diff --git a/JetStreamCompose/jetstream/src/main/java/com/google/jetstream/data/repositories/CachedDataReader.kt b/JetStreamCompose/jetstream/src/main/java/com/google/jetstream/data/repositories/CachedDataReader.kt index 753e8a99..6a42b1bd 100644 --- a/JetStreamCompose/jetstream/src/main/java/com/google/jetstream/data/repositories/CachedDataReader.kt +++ b/JetStreamCompose/jetstream/src/main/java/com/google/jetstream/data/repositories/CachedDataReader.kt @@ -5,7 +5,7 @@ * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * - * https://www.apache.org/licenses/LICENSE-2.0 + * https://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, diff --git a/JetStreamCompose/jetstream/src/main/java/com/google/jetstream/data/repositories/MovieCastDataSource.kt b/JetStreamCompose/jetstream/src/main/java/com/google/jetstream/data/repositories/MovieCastDataSource.kt index cc7aca6f..79701ab4 100644 --- a/JetStreamCompose/jetstream/src/main/java/com/google/jetstream/data/repositories/MovieCastDataSource.kt +++ b/JetStreamCompose/jetstream/src/main/java/com/google/jetstream/data/repositories/MovieCastDataSource.kt @@ -5,7 +5,7 @@ * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * - * https://www.apache.org/licenses/LICENSE-2.0 + * https://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, diff --git a/JetStreamCompose/jetstream/src/main/java/com/google/jetstream/data/repositories/MovieCategoryDataSource.kt b/JetStreamCompose/jetstream/src/main/java/com/google/jetstream/data/repositories/MovieCategoryDataSource.kt index c8bb0fb8..64e806f1 100644 --- a/JetStreamCompose/jetstream/src/main/java/com/google/jetstream/data/repositories/MovieCategoryDataSource.kt +++ b/JetStreamCompose/jetstream/src/main/java/com/google/jetstream/data/repositories/MovieCategoryDataSource.kt @@ -5,7 +5,7 @@ * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * - * https://www.apache.org/licenses/LICENSE-2.0 + * https://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, diff --git a/JetStreamCompose/jetstream/src/main/java/com/google/jetstream/data/repositories/MovieDataSource.kt b/JetStreamCompose/jetstream/src/main/java/com/google/jetstream/data/repositories/MovieDataSource.kt index cb88c9de..2931084d 100644 --- a/JetStreamCompose/jetstream/src/main/java/com/google/jetstream/data/repositories/MovieDataSource.kt +++ b/JetStreamCompose/jetstream/src/main/java/com/google/jetstream/data/repositories/MovieDataSource.kt @@ -5,7 +5,7 @@ * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * - * https://www.apache.org/licenses/LICENSE-2.0 + * https://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, diff --git a/JetStreamCompose/jetstream/src/main/java/com/google/jetstream/data/repositories/MovieRepository.kt b/JetStreamCompose/jetstream/src/main/java/com/google/jetstream/data/repositories/MovieRepository.kt index 757f6311..589a6681 100644 --- a/JetStreamCompose/jetstream/src/main/java/com/google/jetstream/data/repositories/MovieRepository.kt +++ b/JetStreamCompose/jetstream/src/main/java/com/google/jetstream/data/repositories/MovieRepository.kt @@ -5,7 +5,7 @@ * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * - * https://www.apache.org/licenses/LICENSE-2.0 + * https://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, diff --git a/JetStreamCompose/jetstream/src/main/java/com/google/jetstream/data/repositories/MovieRepositoryImpl.kt b/JetStreamCompose/jetstream/src/main/java/com/google/jetstream/data/repositories/MovieRepositoryImpl.kt index 0d87f8ae..96090129 100644 --- a/JetStreamCompose/jetstream/src/main/java/com/google/jetstream/data/repositories/MovieRepositoryImpl.kt +++ b/JetStreamCompose/jetstream/src/main/java/com/google/jetstream/data/repositories/MovieRepositoryImpl.kt @@ -5,7 +5,7 @@ * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * - * https://www.apache.org/licenses/LICENSE-2.0 + * https://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, diff --git a/JetStreamCompose/jetstream/src/main/java/com/google/jetstream/data/repositories/TvDataSource.kt b/JetStreamCompose/jetstream/src/main/java/com/google/jetstream/data/repositories/TvDataSource.kt index 3679a2e8..1945d91b 100644 --- a/JetStreamCompose/jetstream/src/main/java/com/google/jetstream/data/repositories/TvDataSource.kt +++ b/JetStreamCompose/jetstream/src/main/java/com/google/jetstream/data/repositories/TvDataSource.kt @@ -5,7 +5,7 @@ * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * - * https://www.apache.org/licenses/LICENSE-2.0 + * https://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, diff --git a/JetStreamCompose/jetstream/src/main/java/com/google/jetstream/data/util/AssetReader.kt b/JetStreamCompose/jetstream/src/main/java/com/google/jetstream/data/util/AssetReader.kt index 484963be..efede54c 100644 --- a/JetStreamCompose/jetstream/src/main/java/com/google/jetstream/data/util/AssetReader.kt +++ b/JetStreamCompose/jetstream/src/main/java/com/google/jetstream/data/util/AssetReader.kt @@ -5,7 +5,7 @@ * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * - * https://www.apache.org/licenses/LICENSE-2.0 + * https://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, diff --git a/JetStreamCompose/jetstream/src/main/java/com/google/jetstream/data/util/StringConstants.kt b/JetStreamCompose/jetstream/src/main/java/com/google/jetstream/data/util/StringConstants.kt index a93571b4..70df94c0 100644 --- a/JetStreamCompose/jetstream/src/main/java/com/google/jetstream/data/util/StringConstants.kt +++ b/JetStreamCompose/jetstream/src/main/java/com/google/jetstream/data/util/StringConstants.kt @@ -5,7 +5,7 @@ * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * - * https://www.apache.org/licenses/LICENSE-2.0 + * https://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, diff --git a/JetStreamCompose/jetstream/src/main/java/com/google/jetstream/presentation/App.kt b/JetStreamCompose/jetstream/src/main/java/com/google/jetstream/presentation/App.kt index 285bec45..af6abcec 100644 --- a/JetStreamCompose/jetstream/src/main/java/com/google/jetstream/presentation/App.kt +++ b/JetStreamCompose/jetstream/src/main/java/com/google/jetstream/presentation/App.kt @@ -5,7 +5,7 @@ * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * - * https://www.apache.org/licenses/LICENSE-2.0 + * https://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, diff --git a/JetStreamCompose/jetstream/src/main/java/com/google/jetstream/presentation/common/Error.kt b/JetStreamCompose/jetstream/src/main/java/com/google/jetstream/presentation/common/Error.kt index b5367672..a5ab1c9b 100644 --- a/JetStreamCompose/jetstream/src/main/java/com/google/jetstream/presentation/common/Error.kt +++ b/JetStreamCompose/jetstream/src/main/java/com/google/jetstream/presentation/common/Error.kt @@ -5,7 +5,7 @@ * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * - * https://www.apache.org/licenses/LICENSE-2.0 + * https://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, diff --git a/JetStreamCompose/jetstream/src/main/java/com/google/jetstream/presentation/common/Loading.kt b/JetStreamCompose/jetstream/src/main/java/com/google/jetstream/presentation/common/Loading.kt index 82c014ed..81f3c7a7 100644 --- a/JetStreamCompose/jetstream/src/main/java/com/google/jetstream/presentation/common/Loading.kt +++ b/JetStreamCompose/jetstream/src/main/java/com/google/jetstream/presentation/common/Loading.kt @@ -5,7 +5,7 @@ * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * - * https://www.apache.org/licenses/LICENSE-2.0 + * https://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, diff --git a/JetStreamCompose/jetstream/src/main/java/com/google/jetstream/presentation/common/MovieCard.kt b/JetStreamCompose/jetstream/src/main/java/com/google/jetstream/presentation/common/MovieCard.kt index 62c3f322..054e99c1 100644 --- a/JetStreamCompose/jetstream/src/main/java/com/google/jetstream/presentation/common/MovieCard.kt +++ b/JetStreamCompose/jetstream/src/main/java/com/google/jetstream/presentation/common/MovieCard.kt @@ -5,7 +5,7 @@ * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * - * https://www.apache.org/licenses/LICENSE-2.0 + * https://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, diff --git a/JetStreamCompose/jetstream/src/main/java/com/google/jetstream/presentation/common/MoviesRow.kt b/JetStreamCompose/jetstream/src/main/java/com/google/jetstream/presentation/common/MoviesRow.kt index 92d78670..ea1dd48c 100644 --- a/JetStreamCompose/jetstream/src/main/java/com/google/jetstream/presentation/common/MoviesRow.kt +++ b/JetStreamCompose/jetstream/src/main/java/com/google/jetstream/presentation/common/MoviesRow.kt @@ -5,7 +5,7 @@ * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * - * https://www.apache.org/licenses/LICENSE-2.0 + * https://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, diff --git a/JetStreamCompose/jetstream/src/main/java/com/google/jetstream/presentation/common/PosterImage.kt b/JetStreamCompose/jetstream/src/main/java/com/google/jetstream/presentation/common/PosterImage.kt index 892e9dc0..1ed85980 100644 --- a/JetStreamCompose/jetstream/src/main/java/com/google/jetstream/presentation/common/PosterImage.kt +++ b/JetStreamCompose/jetstream/src/main/java/com/google/jetstream/presentation/common/PosterImage.kt @@ -5,7 +5,7 @@ * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * - * https://www.apache.org/licenses/LICENSE-2.0 + * https://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, diff --git a/JetStreamCompose/jetstream/src/main/java/com/google/jetstream/presentation/screens/Screens.kt b/JetStreamCompose/jetstream/src/main/java/com/google/jetstream/presentation/screens/Screens.kt index b9cd2cd6..8a48495c 100644 --- a/JetStreamCompose/jetstream/src/main/java/com/google/jetstream/presentation/screens/Screens.kt +++ b/JetStreamCompose/jetstream/src/main/java/com/google/jetstream/presentation/screens/Screens.kt @@ -5,7 +5,7 @@ * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * - * https://www.apache.org/licenses/LICENSE-2.0 + * https://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, diff --git a/JetStreamCompose/jetstream/src/main/java/com/google/jetstream/presentation/screens/categories/CategoriesScreen.kt b/JetStreamCompose/jetstream/src/main/java/com/google/jetstream/presentation/screens/categories/CategoriesScreen.kt index 0d2f3cad..31708dc2 100644 --- a/JetStreamCompose/jetstream/src/main/java/com/google/jetstream/presentation/screens/categories/CategoriesScreen.kt +++ b/JetStreamCompose/jetstream/src/main/java/com/google/jetstream/presentation/screens/categories/CategoriesScreen.kt @@ -5,7 +5,7 @@ * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * - * https://www.apache.org/licenses/LICENSE-2.0 + * https://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, diff --git a/JetStreamCompose/jetstream/src/main/java/com/google/jetstream/presentation/screens/categories/CategoriesScreenViewModel.kt b/JetStreamCompose/jetstream/src/main/java/com/google/jetstream/presentation/screens/categories/CategoriesScreenViewModel.kt index 6a2127d3..3cafc957 100644 --- a/JetStreamCompose/jetstream/src/main/java/com/google/jetstream/presentation/screens/categories/CategoriesScreenViewModel.kt +++ b/JetStreamCompose/jetstream/src/main/java/com/google/jetstream/presentation/screens/categories/CategoriesScreenViewModel.kt @@ -5,7 +5,7 @@ * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * - * https://www.apache.org/licenses/LICENSE-2.0 + * https://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, diff --git a/JetStreamCompose/jetstream/src/main/java/com/google/jetstream/presentation/screens/categories/CategoryMovieListScreen.kt b/JetStreamCompose/jetstream/src/main/java/com/google/jetstream/presentation/screens/categories/CategoryMovieListScreen.kt index 1647d609..4d5f5f67 100644 --- a/JetStreamCompose/jetstream/src/main/java/com/google/jetstream/presentation/screens/categories/CategoryMovieListScreen.kt +++ b/JetStreamCompose/jetstream/src/main/java/com/google/jetstream/presentation/screens/categories/CategoryMovieListScreen.kt @@ -5,7 +5,7 @@ * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * - * https://www.apache.org/licenses/LICENSE-2.0 + * https://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, diff --git a/JetStreamCompose/jetstream/src/main/java/com/google/jetstream/presentation/screens/categories/CategoryMovieListScreenViewModel.kt b/JetStreamCompose/jetstream/src/main/java/com/google/jetstream/presentation/screens/categories/CategoryMovieListScreenViewModel.kt index 623a6ebf..81725403 100644 --- a/JetStreamCompose/jetstream/src/main/java/com/google/jetstream/presentation/screens/categories/CategoryMovieListScreenViewModel.kt +++ b/JetStreamCompose/jetstream/src/main/java/com/google/jetstream/presentation/screens/categories/CategoryMovieListScreenViewModel.kt @@ -5,7 +5,7 @@ * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * - * https://www.apache.org/licenses/LICENSE-2.0 + * https://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, diff --git a/JetStreamCompose/jetstream/src/main/java/com/google/jetstream/presentation/screens/dashboard/DashboardScreen.kt b/JetStreamCompose/jetstream/src/main/java/com/google/jetstream/presentation/screens/dashboard/DashboardScreen.kt index a84ccf74..8b47a10b 100644 --- a/JetStreamCompose/jetstream/src/main/java/com/google/jetstream/presentation/screens/dashboard/DashboardScreen.kt +++ b/JetStreamCompose/jetstream/src/main/java/com/google/jetstream/presentation/screens/dashboard/DashboardScreen.kt @@ -5,7 +5,7 @@ * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * - * https://www.apache.org/licenses/LICENSE-2.0 + * https://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, diff --git a/JetStreamCompose/jetstream/src/main/java/com/google/jetstream/presentation/screens/dashboard/DashboardTopBar.kt b/JetStreamCompose/jetstream/src/main/java/com/google/jetstream/presentation/screens/dashboard/DashboardTopBar.kt index 0bd6f88a..0169e346 100644 --- a/JetStreamCompose/jetstream/src/main/java/com/google/jetstream/presentation/screens/dashboard/DashboardTopBar.kt +++ b/JetStreamCompose/jetstream/src/main/java/com/google/jetstream/presentation/screens/dashboard/DashboardTopBar.kt @@ -5,7 +5,7 @@ * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * - * https://www.apache.org/licenses/LICENSE-2.0 + * https://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, diff --git a/JetStreamCompose/jetstream/src/main/java/com/google/jetstream/presentation/screens/dashboard/DashboardTopBarItemIndicator.kt b/JetStreamCompose/jetstream/src/main/java/com/google/jetstream/presentation/screens/dashboard/DashboardTopBarItemIndicator.kt index 5d724366..145a8786 100644 --- a/JetStreamCompose/jetstream/src/main/java/com/google/jetstream/presentation/screens/dashboard/DashboardTopBarItemIndicator.kt +++ b/JetStreamCompose/jetstream/src/main/java/com/google/jetstream/presentation/screens/dashboard/DashboardTopBarItemIndicator.kt @@ -5,7 +5,7 @@ * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * - * https://www.apache.org/licenses/LICENSE-2.0 + * https://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, diff --git a/JetStreamCompose/jetstream/src/main/java/com/google/jetstream/presentation/screens/dashboard/UserAvatar.kt b/JetStreamCompose/jetstream/src/main/java/com/google/jetstream/presentation/screens/dashboard/UserAvatar.kt index 6941bdc8..fa454c42 100644 --- a/JetStreamCompose/jetstream/src/main/java/com/google/jetstream/presentation/screens/dashboard/UserAvatar.kt +++ b/JetStreamCompose/jetstream/src/main/java/com/google/jetstream/presentation/screens/dashboard/UserAvatar.kt @@ -5,7 +5,7 @@ * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * - * https://www.apache.org/licenses/LICENSE-2.0 + * https://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, diff --git a/JetStreamCompose/jetstream/src/main/java/com/google/jetstream/presentation/screens/favourites/FavouriteScreenViewModel.kt b/JetStreamCompose/jetstream/src/main/java/com/google/jetstream/presentation/screens/favourites/FavouriteScreenViewModel.kt index b77b785f..2b4c5572 100644 --- a/JetStreamCompose/jetstream/src/main/java/com/google/jetstream/presentation/screens/favourites/FavouriteScreenViewModel.kt +++ b/JetStreamCompose/jetstream/src/main/java/com/google/jetstream/presentation/screens/favourites/FavouriteScreenViewModel.kt @@ -5,7 +5,7 @@ * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * - * https://www.apache.org/licenses/LICENSE-2.0 + * https://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, diff --git a/JetStreamCompose/jetstream/src/main/java/com/google/jetstream/presentation/screens/favourites/FavouritesScreen.kt b/JetStreamCompose/jetstream/src/main/java/com/google/jetstream/presentation/screens/favourites/FavouritesScreen.kt index 6c9530cf..8eb21f53 100644 --- a/JetStreamCompose/jetstream/src/main/java/com/google/jetstream/presentation/screens/favourites/FavouritesScreen.kt +++ b/JetStreamCompose/jetstream/src/main/java/com/google/jetstream/presentation/screens/favourites/FavouritesScreen.kt @@ -5,7 +5,7 @@ * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * - * https://www.apache.org/licenses/LICENSE-2.0 + * https://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, diff --git a/JetStreamCompose/jetstream/src/main/java/com/google/jetstream/presentation/screens/favourites/FilteredMoviesGrid.kt b/JetStreamCompose/jetstream/src/main/java/com/google/jetstream/presentation/screens/favourites/FilteredMoviesGrid.kt index 192f0989..62fc9b4a 100644 --- a/JetStreamCompose/jetstream/src/main/java/com/google/jetstream/presentation/screens/favourites/FilteredMoviesGrid.kt +++ b/JetStreamCompose/jetstream/src/main/java/com/google/jetstream/presentation/screens/favourites/FilteredMoviesGrid.kt @@ -5,7 +5,7 @@ * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * - * https://www.apache.org/licenses/LICENSE-2.0 + * https://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, diff --git a/JetStreamCompose/jetstream/src/main/java/com/google/jetstream/presentation/screens/favourites/MovieFilterChip.kt b/JetStreamCompose/jetstream/src/main/java/com/google/jetstream/presentation/screens/favourites/MovieFilterChip.kt index 14b6e0fa..c28ba40d 100644 --- a/JetStreamCompose/jetstream/src/main/java/com/google/jetstream/presentation/screens/favourites/MovieFilterChip.kt +++ b/JetStreamCompose/jetstream/src/main/java/com/google/jetstream/presentation/screens/favourites/MovieFilterChip.kt @@ -5,7 +5,7 @@ * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * - * https://www.apache.org/licenses/LICENSE-2.0 + * https://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, diff --git a/JetStreamCompose/jetstream/src/main/java/com/google/jetstream/presentation/screens/favourites/MovieFilterChipRow.kt b/JetStreamCompose/jetstream/src/main/java/com/google/jetstream/presentation/screens/favourites/MovieFilterChipRow.kt index 81f08d99..38f502a2 100644 --- a/JetStreamCompose/jetstream/src/main/java/com/google/jetstream/presentation/screens/favourites/MovieFilterChipRow.kt +++ b/JetStreamCompose/jetstream/src/main/java/com/google/jetstream/presentation/screens/favourites/MovieFilterChipRow.kt @@ -5,7 +5,7 @@ * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * - * https://www.apache.org/licenses/LICENSE-2.0 + * https://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, diff --git a/JetStreamCompose/jetstream/src/main/java/com/google/jetstream/presentation/screens/home/FeaturedMoviesCarousel.kt b/JetStreamCompose/jetstream/src/main/java/com/google/jetstream/presentation/screens/home/FeaturedMoviesCarousel.kt index 0abab438..d85467b0 100644 --- a/JetStreamCompose/jetstream/src/main/java/com/google/jetstream/presentation/screens/home/FeaturedMoviesCarousel.kt +++ b/JetStreamCompose/jetstream/src/main/java/com/google/jetstream/presentation/screens/home/FeaturedMoviesCarousel.kt @@ -5,7 +5,7 @@ * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * - * https://www.apache.org/licenses/LICENSE-2.0 + * https://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, diff --git a/JetStreamCompose/jetstream/src/main/java/com/google/jetstream/presentation/screens/home/HomeScreen.kt b/JetStreamCompose/jetstream/src/main/java/com/google/jetstream/presentation/screens/home/HomeScreen.kt index 40411cb0..79a909c5 100644 --- a/JetStreamCompose/jetstream/src/main/java/com/google/jetstream/presentation/screens/home/HomeScreen.kt +++ b/JetStreamCompose/jetstream/src/main/java/com/google/jetstream/presentation/screens/home/HomeScreen.kt @@ -5,7 +5,7 @@ * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * - * https://www.apache.org/licenses/LICENSE-2.0 + * https://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, diff --git a/JetStreamCompose/jetstream/src/main/java/com/google/jetstream/presentation/screens/home/HomeScreenViewModel.kt b/JetStreamCompose/jetstream/src/main/java/com/google/jetstream/presentation/screens/home/HomeScreenViewModel.kt index 7a52e210..fe29a7ac 100644 --- a/JetStreamCompose/jetstream/src/main/java/com/google/jetstream/presentation/screens/home/HomeScreenViewModel.kt +++ b/JetStreamCompose/jetstream/src/main/java/com/google/jetstream/presentation/screens/home/HomeScreenViewModel.kt @@ -5,7 +5,7 @@ * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * - * https://www.apache.org/licenses/LICENSE-2.0 + * https://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, diff --git a/JetStreamCompose/jetstream/src/main/java/com/google/jetstream/presentation/screens/home/Top10MoviesList.kt b/JetStreamCompose/jetstream/src/main/java/com/google/jetstream/presentation/screens/home/Top10MoviesList.kt index dce34c8a..b26bf442 100644 --- a/JetStreamCompose/jetstream/src/main/java/com/google/jetstream/presentation/screens/home/Top10MoviesList.kt +++ b/JetStreamCompose/jetstream/src/main/java/com/google/jetstream/presentation/screens/home/Top10MoviesList.kt @@ -5,7 +5,7 @@ * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * - * https://www.apache.org/licenses/LICENSE-2.0 + * https://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, diff --git a/JetStreamCompose/jetstream/src/main/java/com/google/jetstream/presentation/screens/movies/CastAndCrewList.kt b/JetStreamCompose/jetstream/src/main/java/com/google/jetstream/presentation/screens/movies/CastAndCrewList.kt index f881f86d..600422bd 100644 --- a/JetStreamCompose/jetstream/src/main/java/com/google/jetstream/presentation/screens/movies/CastAndCrewList.kt +++ b/JetStreamCompose/jetstream/src/main/java/com/google/jetstream/presentation/screens/movies/CastAndCrewList.kt @@ -5,7 +5,7 @@ * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * - * https://www.apache.org/licenses/LICENSE-2.0 + * https://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, diff --git a/JetStreamCompose/jetstream/src/main/java/com/google/jetstream/presentation/screens/movies/DotSeparatedRow.kt b/JetStreamCompose/jetstream/src/main/java/com/google/jetstream/presentation/screens/movies/DotSeparatedRow.kt index 324e0d64..068f99b1 100644 --- a/JetStreamCompose/jetstream/src/main/java/com/google/jetstream/presentation/screens/movies/DotSeparatedRow.kt +++ b/JetStreamCompose/jetstream/src/main/java/com/google/jetstream/presentation/screens/movies/DotSeparatedRow.kt @@ -5,7 +5,7 @@ * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * - * https://www.apache.org/licenses/LICENSE-2.0 + * https://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, diff --git a/JetStreamCompose/jetstream/src/main/java/com/google/jetstream/presentation/screens/movies/MovieDetails.kt b/JetStreamCompose/jetstream/src/main/java/com/google/jetstream/presentation/screens/movies/MovieDetails.kt index b7ded2f1..4b928474 100644 --- a/JetStreamCompose/jetstream/src/main/java/com/google/jetstream/presentation/screens/movies/MovieDetails.kt +++ b/JetStreamCompose/jetstream/src/main/java/com/google/jetstream/presentation/screens/movies/MovieDetails.kt @@ -5,7 +5,7 @@ * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * - * https://www.apache.org/licenses/LICENSE-2.0 + * https://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, diff --git a/JetStreamCompose/jetstream/src/main/java/com/google/jetstream/presentation/screens/movies/MovieDetailsScreen.kt b/JetStreamCompose/jetstream/src/main/java/com/google/jetstream/presentation/screens/movies/MovieDetailsScreen.kt index 86228689..9b28c616 100644 --- a/JetStreamCompose/jetstream/src/main/java/com/google/jetstream/presentation/screens/movies/MovieDetailsScreen.kt +++ b/JetStreamCompose/jetstream/src/main/java/com/google/jetstream/presentation/screens/movies/MovieDetailsScreen.kt @@ -5,7 +5,7 @@ * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * - * https://www.apache.org/licenses/LICENSE-2.0 + * https://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, diff --git a/JetStreamCompose/jetstream/src/main/java/com/google/jetstream/presentation/screens/movies/MovieDetailsScreenViewModel.kt b/JetStreamCompose/jetstream/src/main/java/com/google/jetstream/presentation/screens/movies/MovieDetailsScreenViewModel.kt index 2a405df1..aca4a1c3 100644 --- a/JetStreamCompose/jetstream/src/main/java/com/google/jetstream/presentation/screens/movies/MovieDetailsScreenViewModel.kt +++ b/JetStreamCompose/jetstream/src/main/java/com/google/jetstream/presentation/screens/movies/MovieDetailsScreenViewModel.kt @@ -5,7 +5,7 @@ * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * - * https://www.apache.org/licenses/LICENSE-2.0 + * https://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, diff --git a/JetStreamCompose/jetstream/src/main/java/com/google/jetstream/presentation/screens/movies/MovieReviews.kt b/JetStreamCompose/jetstream/src/main/java/com/google/jetstream/presentation/screens/movies/MovieReviews.kt index c2355b67..72af38ee 100644 --- a/JetStreamCompose/jetstream/src/main/java/com/google/jetstream/presentation/screens/movies/MovieReviews.kt +++ b/JetStreamCompose/jetstream/src/main/java/com/google/jetstream/presentation/screens/movies/MovieReviews.kt @@ -5,7 +5,7 @@ * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * - * https://www.apache.org/licenses/LICENSE-2.0 + * https://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, diff --git a/JetStreamCompose/jetstream/src/main/java/com/google/jetstream/presentation/screens/movies/MoviesScreen.kt b/JetStreamCompose/jetstream/src/main/java/com/google/jetstream/presentation/screens/movies/MoviesScreen.kt index b41b9c4a..eb4aae45 100644 --- a/JetStreamCompose/jetstream/src/main/java/com/google/jetstream/presentation/screens/movies/MoviesScreen.kt +++ b/JetStreamCompose/jetstream/src/main/java/com/google/jetstream/presentation/screens/movies/MoviesScreen.kt @@ -5,7 +5,7 @@ * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * - * https://www.apache.org/licenses/LICENSE-2.0 + * https://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, diff --git a/JetStreamCompose/jetstream/src/main/java/com/google/jetstream/presentation/screens/movies/MoviesScreenMovieList.kt b/JetStreamCompose/jetstream/src/main/java/com/google/jetstream/presentation/screens/movies/MoviesScreenMovieList.kt index 5e3c9bd8..fadadafe 100644 --- a/JetStreamCompose/jetstream/src/main/java/com/google/jetstream/presentation/screens/movies/MoviesScreenMovieList.kt +++ b/JetStreamCompose/jetstream/src/main/java/com/google/jetstream/presentation/screens/movies/MoviesScreenMovieList.kt @@ -5,7 +5,7 @@ * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * - * https://www.apache.org/licenses/LICENSE-2.0 + * https://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, diff --git a/JetStreamCompose/jetstream/src/main/java/com/google/jetstream/presentation/screens/movies/MoviesScreenViewModel.kt b/JetStreamCompose/jetstream/src/main/java/com/google/jetstream/presentation/screens/movies/MoviesScreenViewModel.kt index f8a16dba..13f4bc21 100644 --- a/JetStreamCompose/jetstream/src/main/java/com/google/jetstream/presentation/screens/movies/MoviesScreenViewModel.kt +++ b/JetStreamCompose/jetstream/src/main/java/com/google/jetstream/presentation/screens/movies/MoviesScreenViewModel.kt @@ -5,7 +5,7 @@ * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * - * https://www.apache.org/licenses/LICENSE-2.0 + * https://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, diff --git a/JetStreamCompose/jetstream/src/main/java/com/google/jetstream/presentation/screens/movies/TitleValueText.kt b/JetStreamCompose/jetstream/src/main/java/com/google/jetstream/presentation/screens/movies/TitleValueText.kt index 208070dd..8a744429 100644 --- a/JetStreamCompose/jetstream/src/main/java/com/google/jetstream/presentation/screens/movies/TitleValueText.kt +++ b/JetStreamCompose/jetstream/src/main/java/com/google/jetstream/presentation/screens/movies/TitleValueText.kt @@ -5,7 +5,7 @@ * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * - * https://www.apache.org/licenses/LICENSE-2.0 + * https://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, diff --git a/JetStreamCompose/jetstream/src/main/java/com/google/jetstream/presentation/screens/profile/AboutSection.kt b/JetStreamCompose/jetstream/src/main/java/com/google/jetstream/presentation/screens/profile/AboutSection.kt index b81c1fd0..4dd2c4bc 100644 --- a/JetStreamCompose/jetstream/src/main/java/com/google/jetstream/presentation/screens/profile/AboutSection.kt +++ b/JetStreamCompose/jetstream/src/main/java/com/google/jetstream/presentation/screens/profile/AboutSection.kt @@ -5,7 +5,7 @@ * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * - * https://www.apache.org/licenses/LICENSE-2.0 + * https://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, diff --git a/JetStreamCompose/jetstream/src/main/java/com/google/jetstream/presentation/screens/profile/AccountsSection.kt b/JetStreamCompose/jetstream/src/main/java/com/google/jetstream/presentation/screens/profile/AccountsSection.kt index 8c54afa2..c2616eef 100644 --- a/JetStreamCompose/jetstream/src/main/java/com/google/jetstream/presentation/screens/profile/AccountsSection.kt +++ b/JetStreamCompose/jetstream/src/main/java/com/google/jetstream/presentation/screens/profile/AccountsSection.kt @@ -5,7 +5,7 @@ * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * - * https://www.apache.org/licenses/LICENSE-2.0 + * https://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, diff --git a/JetStreamCompose/jetstream/src/main/java/com/google/jetstream/presentation/screens/profile/AccountsSectionDeleteDialog.kt b/JetStreamCompose/jetstream/src/main/java/com/google/jetstream/presentation/screens/profile/AccountsSectionDeleteDialog.kt index c433386d..faae746e 100644 --- a/JetStreamCompose/jetstream/src/main/java/com/google/jetstream/presentation/screens/profile/AccountsSectionDeleteDialog.kt +++ b/JetStreamCompose/jetstream/src/main/java/com/google/jetstream/presentation/screens/profile/AccountsSectionDeleteDialog.kt @@ -5,7 +5,7 @@ * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * - * https://www.apache.org/licenses/LICENSE-2.0 + * https://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, diff --git a/JetStreamCompose/jetstream/src/main/java/com/google/jetstream/presentation/screens/profile/AccountsSectionDialogButton.kt b/JetStreamCompose/jetstream/src/main/java/com/google/jetstream/presentation/screens/profile/AccountsSectionDialogButton.kt index a449081e..223c5416 100644 --- a/JetStreamCompose/jetstream/src/main/java/com/google/jetstream/presentation/screens/profile/AccountsSectionDialogButton.kt +++ b/JetStreamCompose/jetstream/src/main/java/com/google/jetstream/presentation/screens/profile/AccountsSectionDialogButton.kt @@ -5,7 +5,7 @@ * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * - * https://www.apache.org/licenses/LICENSE-2.0 + * https://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, diff --git a/JetStreamCompose/jetstream/src/main/java/com/google/jetstream/presentation/screens/profile/AccountsSelectionItem.kt b/JetStreamCompose/jetstream/src/main/java/com/google/jetstream/presentation/screens/profile/AccountsSelectionItem.kt index 52fb6f7c..b50f2a64 100644 --- a/JetStreamCompose/jetstream/src/main/java/com/google/jetstream/presentation/screens/profile/AccountsSelectionItem.kt +++ b/JetStreamCompose/jetstream/src/main/java/com/google/jetstream/presentation/screens/profile/AccountsSelectionItem.kt @@ -5,7 +5,7 @@ * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * - * https://www.apache.org/licenses/LICENSE-2.0 + * https://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, diff --git a/JetStreamCompose/jetstream/src/main/java/com/google/jetstream/presentation/screens/profile/HelpAndSupportSection.kt b/JetStreamCompose/jetstream/src/main/java/com/google/jetstream/presentation/screens/profile/HelpAndSupportSection.kt index f15b6a50..5adf41db 100644 --- a/JetStreamCompose/jetstream/src/main/java/com/google/jetstream/presentation/screens/profile/HelpAndSupportSection.kt +++ b/JetStreamCompose/jetstream/src/main/java/com/google/jetstream/presentation/screens/profile/HelpAndSupportSection.kt @@ -5,7 +5,7 @@ * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * - * https://www.apache.org/licenses/LICENSE-2.0 + * https://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, diff --git a/JetStreamCompose/jetstream/src/main/java/com/google/jetstream/presentation/screens/profile/LanguageSection.kt b/JetStreamCompose/jetstream/src/main/java/com/google/jetstream/presentation/screens/profile/LanguageSection.kt index 7685baee..8c771093 100644 --- a/JetStreamCompose/jetstream/src/main/java/com/google/jetstream/presentation/screens/profile/LanguageSection.kt +++ b/JetStreamCompose/jetstream/src/main/java/com/google/jetstream/presentation/screens/profile/LanguageSection.kt @@ -5,7 +5,7 @@ * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * - * https://www.apache.org/licenses/LICENSE-2.0 + * https://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, diff --git a/JetStreamCompose/jetstream/src/main/java/com/google/jetstream/presentation/screens/profile/ProfileScreen.kt b/JetStreamCompose/jetstream/src/main/java/com/google/jetstream/presentation/screens/profile/ProfileScreen.kt index dbf27ff2..d7047cca 100644 --- a/JetStreamCompose/jetstream/src/main/java/com/google/jetstream/presentation/screens/profile/ProfileScreen.kt +++ b/JetStreamCompose/jetstream/src/main/java/com/google/jetstream/presentation/screens/profile/ProfileScreen.kt @@ -5,7 +5,7 @@ * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * - * https://www.apache.org/licenses/LICENSE-2.0 + * https://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, diff --git a/JetStreamCompose/jetstream/src/main/java/com/google/jetstream/presentation/screens/profile/ProfileScreens.kt b/JetStreamCompose/jetstream/src/main/java/com/google/jetstream/presentation/screens/profile/ProfileScreens.kt index cae5284c..91ef4360 100644 --- a/JetStreamCompose/jetstream/src/main/java/com/google/jetstream/presentation/screens/profile/ProfileScreens.kt +++ b/JetStreamCompose/jetstream/src/main/java/com/google/jetstream/presentation/screens/profile/ProfileScreens.kt @@ -5,7 +5,7 @@ * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * - * https://www.apache.org/licenses/LICENSE-2.0 + * https://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, diff --git a/JetStreamCompose/jetstream/src/main/java/com/google/jetstream/presentation/screens/profile/SearchHistorySection.kt b/JetStreamCompose/jetstream/src/main/java/com/google/jetstream/presentation/screens/profile/SearchHistorySection.kt index af090a8b..b9cae976 100644 --- a/JetStreamCompose/jetstream/src/main/java/com/google/jetstream/presentation/screens/profile/SearchHistorySection.kt +++ b/JetStreamCompose/jetstream/src/main/java/com/google/jetstream/presentation/screens/profile/SearchHistorySection.kt @@ -5,7 +5,7 @@ * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * - * https://www.apache.org/licenses/LICENSE-2.0 + * https://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, diff --git a/JetStreamCompose/jetstream/src/main/java/com/google/jetstream/presentation/screens/profile/SubtitlesSection.kt b/JetStreamCompose/jetstream/src/main/java/com/google/jetstream/presentation/screens/profile/SubtitlesSection.kt index 1feb30b9..00df5847 100644 --- a/JetStreamCompose/jetstream/src/main/java/com/google/jetstream/presentation/screens/profile/SubtitlesSection.kt +++ b/JetStreamCompose/jetstream/src/main/java/com/google/jetstream/presentation/screens/profile/SubtitlesSection.kt @@ -5,7 +5,7 @@ * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * - * https://www.apache.org/licenses/LICENSE-2.0 + * https://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, diff --git a/JetStreamCompose/jetstream/src/main/java/com/google/jetstream/presentation/screens/search/SearchScreen.kt b/JetStreamCompose/jetstream/src/main/java/com/google/jetstream/presentation/screens/search/SearchScreen.kt index 18855fea..102b8743 100644 --- a/JetStreamCompose/jetstream/src/main/java/com/google/jetstream/presentation/screens/search/SearchScreen.kt +++ b/JetStreamCompose/jetstream/src/main/java/com/google/jetstream/presentation/screens/search/SearchScreen.kt @@ -5,7 +5,7 @@ * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * - * https://www.apache.org/licenses/LICENSE-2.0 + * https://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, diff --git a/JetStreamCompose/jetstream/src/main/java/com/google/jetstream/presentation/screens/search/SearchScreenViewModel.kt b/JetStreamCompose/jetstream/src/main/java/com/google/jetstream/presentation/screens/search/SearchScreenViewModel.kt index ed9c09dd..1be09068 100644 --- a/JetStreamCompose/jetstream/src/main/java/com/google/jetstream/presentation/screens/search/SearchScreenViewModel.kt +++ b/JetStreamCompose/jetstream/src/main/java/com/google/jetstream/presentation/screens/search/SearchScreenViewModel.kt @@ -5,7 +5,7 @@ * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * - * https://www.apache.org/licenses/LICENSE-2.0 + * https://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, diff --git a/JetStreamCompose/jetstream/src/main/java/com/google/jetstream/presentation/screens/shows/ShowScreenViewModel.kt b/JetStreamCompose/jetstream/src/main/java/com/google/jetstream/presentation/screens/shows/ShowScreenViewModel.kt index 7b572509..5b48da70 100644 --- a/JetStreamCompose/jetstream/src/main/java/com/google/jetstream/presentation/screens/shows/ShowScreenViewModel.kt +++ b/JetStreamCompose/jetstream/src/main/java/com/google/jetstream/presentation/screens/shows/ShowScreenViewModel.kt @@ -5,7 +5,7 @@ * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * - * https://www.apache.org/licenses/LICENSE-2.0 + * https://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, diff --git a/JetStreamCompose/jetstream/src/main/java/com/google/jetstream/presentation/screens/shows/ShowsScreen.kt b/JetStreamCompose/jetstream/src/main/java/com/google/jetstream/presentation/screens/shows/ShowsScreen.kt index 7ec8a304..ba7be38f 100644 --- a/JetStreamCompose/jetstream/src/main/java/com/google/jetstream/presentation/screens/shows/ShowsScreen.kt +++ b/JetStreamCompose/jetstream/src/main/java/com/google/jetstream/presentation/screens/shows/ShowsScreen.kt @@ -5,7 +5,7 @@ * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * - * https://www.apache.org/licenses/LICENSE-2.0 + * https://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, diff --git a/JetStreamCompose/jetstream/src/main/java/com/google/jetstream/presentation/screens/videoPlayer/VideoPlayerScreen.kt b/JetStreamCompose/jetstream/src/main/java/com/google/jetstream/presentation/screens/videoPlayer/VideoPlayerScreen.kt index 4cdc6314..ebb07290 100644 --- a/JetStreamCompose/jetstream/src/main/java/com/google/jetstream/presentation/screens/videoPlayer/VideoPlayerScreen.kt +++ b/JetStreamCompose/jetstream/src/main/java/com/google/jetstream/presentation/screens/videoPlayer/VideoPlayerScreen.kt @@ -5,7 +5,7 @@ * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * - * https://www.apache.org/licenses/LICENSE-2.0 + * https://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, diff --git a/JetStreamCompose/jetstream/src/main/java/com/google/jetstream/presentation/screens/videoPlayer/VideoPlayerScreenViewModel.kt b/JetStreamCompose/jetstream/src/main/java/com/google/jetstream/presentation/screens/videoPlayer/VideoPlayerScreenViewModel.kt index 4f056728..5a79da15 100644 --- a/JetStreamCompose/jetstream/src/main/java/com/google/jetstream/presentation/screens/videoPlayer/VideoPlayerScreenViewModel.kt +++ b/JetStreamCompose/jetstream/src/main/java/com/google/jetstream/presentation/screens/videoPlayer/VideoPlayerScreenViewModel.kt @@ -5,7 +5,7 @@ * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * - * https://www.apache.org/licenses/LICENSE-2.0 + * https://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, diff --git a/JetStreamCompose/jetstream/src/main/java/com/google/jetstream/presentation/screens/videoPlayer/components/VideoPlayerControllerText.kt b/JetStreamCompose/jetstream/src/main/java/com/google/jetstream/presentation/screens/videoPlayer/components/VideoPlayerControllerText.kt index f7f8f849..23eea620 100644 --- a/JetStreamCompose/jetstream/src/main/java/com/google/jetstream/presentation/screens/videoPlayer/components/VideoPlayerControllerText.kt +++ b/JetStreamCompose/jetstream/src/main/java/com/google/jetstream/presentation/screens/videoPlayer/components/VideoPlayerControllerText.kt @@ -5,7 +5,7 @@ * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * - * https://www.apache.org/licenses/LICENSE-2.0 + * https://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, diff --git a/JetStreamCompose/jetstream/src/main/java/com/google/jetstream/presentation/screens/videoPlayer/components/VideoPlayerControlsIcon.kt b/JetStreamCompose/jetstream/src/main/java/com/google/jetstream/presentation/screens/videoPlayer/components/VideoPlayerControlsIcon.kt index bded77c2..6f3d6931 100644 --- a/JetStreamCompose/jetstream/src/main/java/com/google/jetstream/presentation/screens/videoPlayer/components/VideoPlayerControlsIcon.kt +++ b/JetStreamCompose/jetstream/src/main/java/com/google/jetstream/presentation/screens/videoPlayer/components/VideoPlayerControlsIcon.kt @@ -5,7 +5,7 @@ * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * - * https://www.apache.org/licenses/LICENSE-2.0 + * https://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, diff --git a/JetStreamCompose/jetstream/src/main/java/com/google/jetstream/presentation/screens/videoPlayer/components/VideoPlayerIndicator.kt b/JetStreamCompose/jetstream/src/main/java/com/google/jetstream/presentation/screens/videoPlayer/components/VideoPlayerIndicator.kt index e385d642..8fc8393b 100644 --- a/JetStreamCompose/jetstream/src/main/java/com/google/jetstream/presentation/screens/videoPlayer/components/VideoPlayerIndicator.kt +++ b/JetStreamCompose/jetstream/src/main/java/com/google/jetstream/presentation/screens/videoPlayer/components/VideoPlayerIndicator.kt @@ -5,7 +5,7 @@ * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * - * https://www.apache.org/licenses/LICENSE-2.0 + * https://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, diff --git a/JetStreamCompose/jetstream/src/main/java/com/google/jetstream/presentation/screens/videoPlayer/components/VideoPlayerMainFrame.kt b/JetStreamCompose/jetstream/src/main/java/com/google/jetstream/presentation/screens/videoPlayer/components/VideoPlayerMainFrame.kt index 0e3c7012..48e4d07a 100644 --- a/JetStreamCompose/jetstream/src/main/java/com/google/jetstream/presentation/screens/videoPlayer/components/VideoPlayerMainFrame.kt +++ b/JetStreamCompose/jetstream/src/main/java/com/google/jetstream/presentation/screens/videoPlayer/components/VideoPlayerMainFrame.kt @@ -5,7 +5,7 @@ * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * - * https://www.apache.org/licenses/LICENSE-2.0 + * https://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, diff --git a/JetStreamCompose/jetstream/src/main/java/com/google/jetstream/presentation/screens/videoPlayer/components/VideoPlayerMediaTitle.kt b/JetStreamCompose/jetstream/src/main/java/com/google/jetstream/presentation/screens/videoPlayer/components/VideoPlayerMediaTitle.kt index 273985bd..3c1b0875 100644 --- a/JetStreamCompose/jetstream/src/main/java/com/google/jetstream/presentation/screens/videoPlayer/components/VideoPlayerMediaTitle.kt +++ b/JetStreamCompose/jetstream/src/main/java/com/google/jetstream/presentation/screens/videoPlayer/components/VideoPlayerMediaTitle.kt @@ -5,7 +5,7 @@ * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * - * https://www.apache.org/licenses/LICENSE-2.0 + * https://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, diff --git a/JetStreamCompose/jetstream/src/main/java/com/google/jetstream/presentation/screens/videoPlayer/components/VideoPlayerOverlay.kt b/JetStreamCompose/jetstream/src/main/java/com/google/jetstream/presentation/screens/videoPlayer/components/VideoPlayerOverlay.kt index acf052ca..e4b164bd 100644 --- a/JetStreamCompose/jetstream/src/main/java/com/google/jetstream/presentation/screens/videoPlayer/components/VideoPlayerOverlay.kt +++ b/JetStreamCompose/jetstream/src/main/java/com/google/jetstream/presentation/screens/videoPlayer/components/VideoPlayerOverlay.kt @@ -5,7 +5,7 @@ * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * - * https://www.apache.org/licenses/LICENSE-2.0 + * https://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, diff --git a/JetStreamCompose/jetstream/src/main/java/com/google/jetstream/presentation/screens/videoPlayer/components/VideoPlayerPulse.kt b/JetStreamCompose/jetstream/src/main/java/com/google/jetstream/presentation/screens/videoPlayer/components/VideoPlayerPulse.kt index 31368279..0141ea7b 100644 --- a/JetStreamCompose/jetstream/src/main/java/com/google/jetstream/presentation/screens/videoPlayer/components/VideoPlayerPulse.kt +++ b/JetStreamCompose/jetstream/src/main/java/com/google/jetstream/presentation/screens/videoPlayer/components/VideoPlayerPulse.kt @@ -5,7 +5,7 @@ * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * - * https://www.apache.org/licenses/LICENSE-2.0 + * https://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, diff --git a/JetStreamCompose/jetstream/src/main/java/com/google/jetstream/presentation/screens/videoPlayer/components/VideoPlayerSeeker.kt b/JetStreamCompose/jetstream/src/main/java/com/google/jetstream/presentation/screens/videoPlayer/components/VideoPlayerSeeker.kt index a3cdee81..976b05fb 100644 --- a/JetStreamCompose/jetstream/src/main/java/com/google/jetstream/presentation/screens/videoPlayer/components/VideoPlayerSeeker.kt +++ b/JetStreamCompose/jetstream/src/main/java/com/google/jetstream/presentation/screens/videoPlayer/components/VideoPlayerSeeker.kt @@ -5,7 +5,7 @@ * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * - * https://www.apache.org/licenses/LICENSE-2.0 + * https://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, diff --git a/JetStreamCompose/jetstream/src/main/java/com/google/jetstream/presentation/screens/videoPlayer/components/VideoPlayerState.kt b/JetStreamCompose/jetstream/src/main/java/com/google/jetstream/presentation/screens/videoPlayer/components/VideoPlayerState.kt index 6c08543d..1dcd80f6 100644 --- a/JetStreamCompose/jetstream/src/main/java/com/google/jetstream/presentation/screens/videoPlayer/components/VideoPlayerState.kt +++ b/JetStreamCompose/jetstream/src/main/java/com/google/jetstream/presentation/screens/videoPlayer/components/VideoPlayerState.kt @@ -5,7 +5,7 @@ * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * - * https://www.apache.org/licenses/LICENSE-2.0 + * https://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, diff --git a/JetStreamCompose/jetstream/src/main/java/com/google/jetstream/presentation/theme/JetStreamFocusTheme.kt b/JetStreamCompose/jetstream/src/main/java/com/google/jetstream/presentation/theme/JetStreamFocusTheme.kt index b8dc861a..d71383a4 100644 --- a/JetStreamCompose/jetstream/src/main/java/com/google/jetstream/presentation/theme/JetStreamFocusTheme.kt +++ b/JetStreamCompose/jetstream/src/main/java/com/google/jetstream/presentation/theme/JetStreamFocusTheme.kt @@ -5,7 +5,7 @@ * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * - * https://www.apache.org/licenses/LICENSE-2.0 + * https://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, diff --git a/JetStreamCompose/jetstream/src/main/java/com/google/jetstream/presentation/theme/Theme.kt b/JetStreamCompose/jetstream/src/main/java/com/google/jetstream/presentation/theme/Theme.kt index 46bcc7cd..8e93ece4 100644 --- a/JetStreamCompose/jetstream/src/main/java/com/google/jetstream/presentation/theme/Theme.kt +++ b/JetStreamCompose/jetstream/src/main/java/com/google/jetstream/presentation/theme/Theme.kt @@ -5,7 +5,7 @@ * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * - * https://www.apache.org/licenses/LICENSE-2.0 + * https://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, diff --git a/JetStreamCompose/jetstream/src/main/java/com/google/jetstream/presentation/theme/Type.kt b/JetStreamCompose/jetstream/src/main/java/com/google/jetstream/presentation/theme/Type.kt index 5d3cc4c9..a5896ced 100644 --- a/JetStreamCompose/jetstream/src/main/java/com/google/jetstream/presentation/theme/Type.kt +++ b/JetStreamCompose/jetstream/src/main/java/com/google/jetstream/presentation/theme/Type.kt @@ -5,7 +5,7 @@ * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * - * https://www.apache.org/licenses/LICENSE-2.0 + * https://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, diff --git a/JetStreamCompose/jetstream/src/main/java/com/google/jetstream/presentation/utils/BringIntoViewIfChildrenAreFocused.kt b/JetStreamCompose/jetstream/src/main/java/com/google/jetstream/presentation/utils/BringIntoViewIfChildrenAreFocused.kt index 95f786fc..cd38b791 100644 --- a/JetStreamCompose/jetstream/src/main/java/com/google/jetstream/presentation/utils/BringIntoViewIfChildrenAreFocused.kt +++ b/JetStreamCompose/jetstream/src/main/java/com/google/jetstream/presentation/utils/BringIntoViewIfChildrenAreFocused.kt @@ -5,7 +5,7 @@ * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * - * https://www.apache.org/licenses/LICENSE-2.0 + * https://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, diff --git a/JetStreamCompose/jetstream/src/main/java/com/google/jetstream/presentation/utils/Colors.kt b/JetStreamCompose/jetstream/src/main/java/com/google/jetstream/presentation/utils/Colors.kt index 73634abc..370cea64 100644 --- a/JetStreamCompose/jetstream/src/main/java/com/google/jetstream/presentation/utils/Colors.kt +++ b/JetStreamCompose/jetstream/src/main/java/com/google/jetstream/presentation/utils/Colors.kt @@ -5,7 +5,7 @@ * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * - * https://www.apache.org/licenses/LICENSE-2.0 + * https://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, diff --git a/JetStreamCompose/jetstream/src/main/java/com/google/jetstream/presentation/utils/GradientBg.kt b/JetStreamCompose/jetstream/src/main/java/com/google/jetstream/presentation/utils/GradientBg.kt index 23dd0a64..eaa0a5bf 100644 --- a/JetStreamCompose/jetstream/src/main/java/com/google/jetstream/presentation/utils/GradientBg.kt +++ b/JetStreamCompose/jetstream/src/main/java/com/google/jetstream/presentation/utils/GradientBg.kt @@ -5,7 +5,7 @@ * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * - * https://www.apache.org/licenses/LICENSE-2.0 + * https://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, diff --git a/JetStreamCompose/jetstream/src/main/java/com/google/jetstream/presentation/utils/ModifierUtils.kt b/JetStreamCompose/jetstream/src/main/java/com/google/jetstream/presentation/utils/ModifierUtils.kt index 15766738..a225dea8 100644 --- a/JetStreamCompose/jetstream/src/main/java/com/google/jetstream/presentation/utils/ModifierUtils.kt +++ b/JetStreamCompose/jetstream/src/main/java/com/google/jetstream/presentation/utils/ModifierUtils.kt @@ -5,7 +5,7 @@ * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * - * https://www.apache.org/licenses/LICENSE-2.0 + * https://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, diff --git a/JetStreamCompose/jetstream/src/main/java/com/google/jetstream/presentation/utils/Padding.kt b/JetStreamCompose/jetstream/src/main/java/com/google/jetstream/presentation/utils/Padding.kt index 17df211b..a6ab20d1 100644 --- a/JetStreamCompose/jetstream/src/main/java/com/google/jetstream/presentation/utils/Padding.kt +++ b/JetStreamCompose/jetstream/src/main/java/com/google/jetstream/presentation/utils/Padding.kt @@ -5,7 +5,7 @@ * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * - * https://www.apache.org/licenses/LICENSE-2.0 + * https://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, diff --git a/JetStreamCompose/jetstream/src/main/java/com/google/jetstream/tvmaterial/Dialog.kt b/JetStreamCompose/jetstream/src/main/java/com/google/jetstream/tvmaterial/Dialog.kt index ac683306..6c609df7 100644 --- a/JetStreamCompose/jetstream/src/main/java/com/google/jetstream/tvmaterial/Dialog.kt +++ b/JetStreamCompose/jetstream/src/main/java/com/google/jetstream/tvmaterial/Dialog.kt @@ -5,7 +5,7 @@ * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * - * https://www.apache.org/licenses/LICENSE-2.0 + * https://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, diff --git a/JetStreamCompose/jetstream/src/main/java/com/google/jetstream/tvmaterial/Shapes.kt b/JetStreamCompose/jetstream/src/main/java/com/google/jetstream/tvmaterial/Shapes.kt index fea6d915..6aa34947 100644 --- a/JetStreamCompose/jetstream/src/main/java/com/google/jetstream/tvmaterial/Shapes.kt +++ b/JetStreamCompose/jetstream/src/main/java/com/google/jetstream/tvmaterial/Shapes.kt @@ -5,7 +5,7 @@ * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * - * https://www.apache.org/licenses/LICENSE-2.0 + * https://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, diff --git a/JetStreamCompose/spotless/copyright.kt b/JetStreamCompose/spotless/copyright.kt index d4be1cf0..379c54f9 100644 --- a/JetStreamCompose/spotless/copyright.kt +++ b/JetStreamCompose/spotless/copyright.kt @@ -5,7 +5,7 @@ * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * - * https://www.apache.org/licenses/LICENSE-2.0 + * https://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, From b6d56bcc45321e18d946902443f927b00c8f519c Mon Sep 17 00:00:00 2001 From: Chiko Shimizu Date: Mon, 20 May 2024 14:46:47 +0900 Subject: [PATCH 16/20] Mark MovieList and MovieCategoryList as deprecated. This is because strong skipping mode is enabled. --- .../java/com/google/jetstream/data/entities/MovieCategoryList.kt | 1 + .../main/java/com/google/jetstream/data/entities/MovieList.kt | 1 + 2 files changed, 2 insertions(+) diff --git a/JetStreamCompose/jetstream/src/main/java/com/google/jetstream/data/entities/MovieCategoryList.kt b/JetStreamCompose/jetstream/src/main/java/com/google/jetstream/data/entities/MovieCategoryList.kt index 99b3fcec..cc89391c 100644 --- a/JetStreamCompose/jetstream/src/main/java/com/google/jetstream/data/entities/MovieCategoryList.kt +++ b/JetStreamCompose/jetstream/src/main/java/com/google/jetstream/data/entities/MovieCategoryList.kt @@ -18,6 +18,7 @@ package com.google.jetstream.data.entities import androidx.compose.runtime.Immutable +@Deprecated("This data class is deprecated as strong skip mode is enabled.") @Immutable data class MovieCategoryList( val value: List = emptyList() diff --git a/JetStreamCompose/jetstream/src/main/java/com/google/jetstream/data/entities/MovieList.kt b/JetStreamCompose/jetstream/src/main/java/com/google/jetstream/data/entities/MovieList.kt index eb6a37ae..d3d75232 100644 --- a/JetStreamCompose/jetstream/src/main/java/com/google/jetstream/data/entities/MovieList.kt +++ b/JetStreamCompose/jetstream/src/main/java/com/google/jetstream/data/entities/MovieList.kt @@ -18,6 +18,7 @@ package com.google.jetstream.data.entities import androidx.compose.runtime.Immutable +@Deprecated("This data class is deprecated as strong skip mode is enabled.") @Immutable data class MovieList( val value: List = emptyList() From 2643026efa6b98fab0c98591a322911c3f4b1424 Mon Sep 17 00:00:00 2001 From: Chiko Shimizu Date: Mon, 20 May 2024 15:09:02 +0900 Subject: [PATCH 17/20] Changed to refer to strings.xml from the actual string values. --- .../java/com/google/jetstream/presentation/common/Error.kt | 7 ++++++- .../com/google/jetstream/presentation/common/Loading.kt | 7 ++++++- JetStreamCompose/jetstream/src/main/res/values/strings.xml | 3 ++- 3 files changed, 14 insertions(+), 3 deletions(-) diff --git a/JetStreamCompose/jetstream/src/main/java/com/google/jetstream/presentation/common/Error.kt b/JetStreamCompose/jetstream/src/main/java/com/google/jetstream/presentation/common/Error.kt index a5ab1c9b..01933a10 100644 --- a/JetStreamCompose/jetstream/src/main/java/com/google/jetstream/presentation/common/Error.kt +++ b/JetStreamCompose/jetstream/src/main/java/com/google/jetstream/presentation/common/Error.kt @@ -18,9 +18,14 @@ package com.google.jetstream.presentation.common import androidx.compose.runtime.Composable import androidx.compose.ui.Modifier +import androidx.compose.ui.res.stringResource import androidx.tv.material3.Text +import com.google.jetstream.R @Composable fun Error(modifier: Modifier = Modifier) { - Text(text = "Wops, something went wrong...", modifier = modifier) + Text( + text = stringResource(id = R.string.message_error), + modifier = modifier + ) } diff --git a/JetStreamCompose/jetstream/src/main/java/com/google/jetstream/presentation/common/Loading.kt b/JetStreamCompose/jetstream/src/main/java/com/google/jetstream/presentation/common/Loading.kt index 81f3c7a7..7504b40a 100644 --- a/JetStreamCompose/jetstream/src/main/java/com/google/jetstream/presentation/common/Loading.kt +++ b/JetStreamCompose/jetstream/src/main/java/com/google/jetstream/presentation/common/Loading.kt @@ -20,9 +20,11 @@ import androidx.compose.foundation.layout.Box 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.text.TextStyle import androidx.tv.material3.MaterialTheme import androidx.tv.material3.Text +import com.google.jetstream.R @Composable fun Loading( @@ -30,6 +32,9 @@ fun Loading( style: TextStyle = MaterialTheme.typography.displayMedium ) { Box(modifier = modifier, contentAlignment = Alignment.Center) { - Text(text = "Loading...", style = style) + Text( + text = stringResource(id = R.string.message_loading), + style = style + ) } } diff --git a/JetStreamCompose/jetstream/src/main/res/values/strings.xml b/JetStreamCompose/jetstream/src/main/res/values/strings.xml index 56849726..0f737cb4 100644 --- a/JetStreamCompose/jetstream/src/main/res/values/strings.xml +++ b/JetStreamCompose/jetstream/src/main/res/values/strings.xml @@ -37,7 +37,6 @@ https://www.apache.org/licenses/LICENSE-2.0 Top 10 in the US %s icon %s language option - Loading movie category %s Movies TV Shows @@ -46,4 +45,6 @@ https://www.apache.org/licenses/LICENSE-2.0 Unknown filter Ad Live + Loading… + Wops, something went wrong… \ No newline at end of file From 149466c5ec488ab22b92763bc832ba2d49f9cb9f Mon Sep 17 00:00:00 2001 From: Chiko Shimizu Date: Mon, 20 May 2024 16:37:19 +0900 Subject: [PATCH 18/20] Remove redundant conditional branch --- .../presentation/utils/ModifierUtils.kt | 51 ++++++------------- 1 file changed, 16 insertions(+), 35 deletions(-) diff --git a/JetStreamCompose/jetstream/src/main/java/com/google/jetstream/presentation/utils/ModifierUtils.kt b/JetStreamCompose/jetstream/src/main/java/com/google/jetstream/presentation/utils/ModifierUtils.kt index a225dea8..8d89c66c 100644 --- a/JetStreamCompose/jetstream/src/main/java/com/google/jetstream/presentation/utils/ModifierUtils.kt +++ b/JetStreamCompose/jetstream/src/main/java/com/google/jetstream/presentation/utils/ModifierUtils.kt @@ -31,20 +31,6 @@ import androidx.compose.ui.input.key.onKeyEvent import androidx.compose.ui.input.key.onPreviewKeyEvent import androidx.compose.ui.layout.onPlaced -private val DPadEventsKeyCodes = listOf( - KeyEvent.KEYCODE_DPAD_LEFT, - KeyEvent.KEYCODE_SYSTEM_NAVIGATION_LEFT, - KeyEvent.KEYCODE_DPAD_RIGHT, - KeyEvent.KEYCODE_SYSTEM_NAVIGATION_RIGHT, - KeyEvent.KEYCODE_DPAD_UP, - KeyEvent.KEYCODE_SYSTEM_NAVIGATION_UP, - KeyEvent.KEYCODE_DPAD_DOWN, - KeyEvent.KEYCODE_SYSTEM_NAVIGATION_DOWN, - KeyEvent.KEYCODE_DPAD_CENTER, - KeyEvent.KEYCODE_ENTER, - KeyEvent.KEYCODE_NUMPAD_ENTER -) - /** * Handles horizontal (Left & Right) D-Pad Keys and consumes the event(s) so that the focus doesn't * accidentally move to another element. @@ -58,30 +44,28 @@ fun Modifier.handleDPadKeyEvents( if (it.nativeKeyEvent.action == KeyEvent.ACTION_UP) block() } - if (DPadEventsKeyCodes.contains(it.nativeKeyEvent.keyCode)) { - when (it.nativeKeyEvent.keyCode) { - KeyEvent.KEYCODE_DPAD_LEFT, KeyEvent.KEYCODE_SYSTEM_NAVIGATION_LEFT -> { - onLeft?.apply { - onActionUp(::invoke) - return@onPreviewKeyEvent true - } + when (it.nativeKeyEvent.keyCode) { + KeyEvent.KEYCODE_DPAD_LEFT, KeyEvent.KEYCODE_SYSTEM_NAVIGATION_LEFT -> { + onLeft?.apply { + onActionUp(::invoke) + return@onPreviewKeyEvent true } + } - KeyEvent.KEYCODE_DPAD_RIGHT, KeyEvent.KEYCODE_SYSTEM_NAVIGATION_RIGHT -> { - onRight?.apply { - onActionUp(::invoke) - return@onPreviewKeyEvent true - } + KeyEvent.KEYCODE_DPAD_RIGHT, KeyEvent.KEYCODE_SYSTEM_NAVIGATION_RIGHT -> { + onRight?.apply { + onActionUp(::invoke) + return@onPreviewKeyEvent true } + } - KeyEvent.KEYCODE_DPAD_CENTER, KeyEvent.KEYCODE_ENTER, KeyEvent.KEYCODE_NUMPAD_ENTER -> { - onEnter?.apply { - onActionUp(::invoke) - return@onPreviewKeyEvent true - } + KeyEvent.KEYCODE_DPAD_CENTER, KeyEvent.KEYCODE_ENTER, KeyEvent.KEYCODE_NUMPAD_ENTER -> { + onEnter?.invoke().also { + return@onPreviewKeyEvent true } } } + false } @@ -96,10 +80,7 @@ fun Modifier.handleDPadKeyEvents( onEnter: (() -> Unit)? = null ) = onKeyEvent { - if ( - DPadEventsKeyCodes.contains(it.nativeKeyEvent.keyCode) && - it.nativeKeyEvent.action == KeyEvent.ACTION_UP - ) { + if (it.nativeKeyEvent.action == KeyEvent.ACTION_UP) { when (it.nativeKeyEvent.keyCode) { KeyEvent.KEYCODE_DPAD_LEFT, KeyEvent.KEYCODE_SYSTEM_NAVIGATION_LEFT -> { onLeft?.invoke().also { return@onKeyEvent true } From 21ec05b8aac091cb76892b04b8bb56e635456716 Mon Sep 17 00:00:00 2001 From: Chiko Shimizu Date: Mon, 20 May 2024 16:40:24 +0900 Subject: [PATCH 19/20] Add a todo comment --- .../presentation/utils/BringIntoViewIfChildrenAreFocused.kt | 1 + 1 file changed, 1 insertion(+) diff --git a/JetStreamCompose/jetstream/src/main/java/com/google/jetstream/presentation/utils/BringIntoViewIfChildrenAreFocused.kt b/JetStreamCompose/jetstream/src/main/java/com/google/jetstream/presentation/utils/BringIntoViewIfChildrenAreFocused.kt index cd38b791..6f1eb9ba 100644 --- a/JetStreamCompose/jetstream/src/main/java/com/google/jetstream/presentation/utils/BringIntoViewIfChildrenAreFocused.kt +++ b/JetStreamCompose/jetstream/src/main/java/com/google/jetstream/presentation/utils/BringIntoViewIfChildrenAreFocused.kt @@ -31,6 +31,7 @@ import androidx.compose.ui.unit.toSize @Suppress("IllegalExperimentalApiUsage") // TODO (b/233188423): Address before moving to beta @OptIn(ExperimentalFoundationApi::class) +// ToDo: Migrate to Modifier.Node and stop using composed function. internal fun Modifier.bringIntoViewIfChildrenAreFocused( paddingValues: PaddingValues = PaddingValues() ): Modifier = composed( From def415d7b2ffcdaffbda17158c0bb59969274793 Mon Sep 17 00:00:00 2001 From: Chiko Shimizu Date: Mon, 20 May 2024 17:03:33 +0900 Subject: [PATCH 20/20] Fix a layout issue where the background image is not fully visible when the MovieDetailsScreen is displayed. --- .../screens/movies/MovieDetails.kt | 65 +++++-------------- 1 file changed, 18 insertions(+), 47 deletions(-) diff --git a/JetStreamCompose/jetstream/src/main/java/com/google/jetstream/presentation/screens/movies/MovieDetails.kt b/JetStreamCompose/jetstream/src/main/java/com/google/jetstream/presentation/screens/movies/MovieDetails.kt index 4b928474..5466d819 100644 --- a/JetStreamCompose/jetstream/src/main/java/com/google/jetstream/presentation/screens/movies/MovieDetails.kt +++ b/JetStreamCompose/jetstream/src/main/java/com/google/jetstream/presentation/screens/movies/MovieDetails.kt @@ -17,7 +17,6 @@ package com.google.jetstream.presentation.screens.movies import androidx.compose.foundation.ExperimentalFoundationApi -import androidx.compose.foundation.background import androidx.compose.foundation.layout.Box import androidx.compose.foundation.layout.Column import androidx.compose.foundation.layout.Row @@ -36,11 +35,11 @@ import androidx.compose.runtime.remember import androidx.compose.runtime.rememberCoroutineScope import androidx.compose.ui.Modifier import androidx.compose.ui.draw.alpha +import androidx.compose.ui.draw.drawWithContent +import androidx.compose.ui.focus.onFocusChanged import androidx.compose.ui.geometry.Offset import androidx.compose.ui.graphics.Brush import androidx.compose.ui.graphics.Color -import androidx.compose.ui.input.key.NativeKeyEvent -import androidx.compose.ui.input.key.onKeyEvent import androidx.compose.ui.layout.ContentScale import androidx.compose.ui.platform.LocalContext import androidx.compose.ui.res.stringResource @@ -49,7 +48,6 @@ import androidx.compose.ui.unit.dp import androidx.compose.ui.unit.sp import androidx.tv.material3.Button import androidx.tv.material3.ButtonDefaults -import androidx.tv.material3.ExperimentalTvMaterial3Api import androidx.tv.material3.Icon import androidx.tv.material3.MaterialTheme import androidx.tv.material3.Text @@ -76,10 +74,11 @@ fun MovieDetails( modifier = Modifier .fillMaxWidth() .height(432.dp) + .bringIntoViewRequester(bringIntoViewRequester) ) { MovieImageWithGradients( movieDetails = movieDetails, - bringIntoViewRequester = bringIntoViewRequester + modifier = Modifier.fillMaxSize() ) Column(modifier = Modifier.fillMaxWidth(0.55f)) { @@ -109,11 +108,10 @@ fun MovieDetails( ) } WatchTrailerButton( - modifier = Modifier.onKeyEvent { - if (it.nativeKeyEvent.keyCode == NativeKeyEvent.KEYCODE_DPAD_UP) { + modifier = Modifier.onFocusChanged { + if (it.isFocused) { coroutineScope.launch { bringIntoViewRequester.bringIntoView() } } - false }, goToMoviePlayer = goToMoviePlayer ) @@ -122,7 +120,6 @@ fun MovieDetails( } } -@OptIn(ExperimentalTvMaterial3Api::class) @Composable private fun WatchTrailerButton( modifier: Modifier = Modifier, @@ -177,7 +174,6 @@ private fun DirectorScreenplayMusicRow( } } -@OptIn(ExperimentalTvMaterial3Api::class) @Composable private fun MovieDescription(description: String) { Text( @@ -191,7 +187,6 @@ private fun MovieDescription(description: String) { ) } -@OptIn(ExperimentalTvMaterial3Api::class) @Composable private fun MovieLargeTitle(movieTitle: String) { Text( @@ -203,11 +198,11 @@ private fun MovieLargeTitle(movieTitle: String) { ) } -@OptIn(ExperimentalFoundationApi::class, ExperimentalTvMaterial3Api::class) @Composable private fun MovieImageWithGradients( movieDetails: MovieDetails, - bringIntoViewRequester: BringIntoViewRequester + modifier: Modifier = Modifier, + gradientColor: Color = MaterialTheme.colorScheme.surface, ) { AsyncImage( model = ImageRequest.Builder(LocalContext.current).data(movieDetails.posterUri) @@ -216,53 +211,29 @@ private fun MovieImageWithGradients( .Composable .ContentDescription .moviePoster(movieDetails.name), - modifier = Modifier - .fillMaxSize() - .bringIntoViewRequester(bringIntoViewRequester), - contentScale = ContentScale.Crop - ) - - Box( - modifier = Modifier - .fillMaxSize() - .background( + contentScale = ContentScale.Crop, + modifier = modifier.drawWithContent { + drawContent() + drawRect( Brush.verticalGradient( - colors = listOf( - Color.Transparent, - MaterialTheme.colorScheme.surface - ), + colors = listOf(Color.Transparent, gradientColor), startY = 600f ) ) - ) - - Box( - modifier = Modifier - .fillMaxSize() - .background( + drawRect( Brush.horizontalGradient( - colors = listOf( - MaterialTheme.colorScheme.surface, - Color.Transparent - ), + colors = listOf(gradientColor, Color.Transparent), endX = 1000f, startX = 300f ) ) - ) - - Box( - modifier = Modifier - .fillMaxSize() - .background( + drawRect( Brush.linearGradient( - colors = listOf( - MaterialTheme.colorScheme.surface, - Color.Transparent - ), + colors = listOf(gradientColor, Color.Transparent), start = Offset(x = 500f, y = 500f), end = Offset(x = 1000f, y = 0f) ) ) + } ) }