From 7585f21b26414b2b6780619672cdb89a39243192 Mon Sep 17 00:00:00 2001 From: Umair Date: Mon, 27 Mar 2023 18:40:41 +0200 Subject: [PATCH 1/4] Nested navigation introduced --- .../composetv/favorites/SearchScreen.kt | 23 +++++++ .../composetv/home/HomeNestedScreen.kt | 16 +++++ .../composetv/home/HomeScreenContent.kt | 11 +++- .../com/techlads/composetv/home/MenuData.kt | 15 ----- .../home/navigation/NestedHomeNavigation.kt | 18 ++---- .../navigation/NestedHomeScreenNavigation.kt | 64 +++++++++++++++++++ .../home/navigation/NestedScreens.kt | 10 +++ .../techlads/composetv/leftmenu/LeftMenu.kt | 3 +- .../composetv/leftmenu/data/MenuData.kt | 11 ++-- .../techlads/composetv/movies/MoviesScreen.kt | 23 +++++++ .../composetv/navigation/AppNavigation.kt | 4 +- .../techlads/composetv/search/SearchScreen.kt | 23 +++++++ .../composetv/settings/SearchScreen.kt | 23 +++++++ .../techlads/composetv/songs/SearchScreen.kt | 23 +++++++ 14 files changed, 231 insertions(+), 36 deletions(-) create mode 100644 app/src/main/java/com/techlads/composetv/favorites/SearchScreen.kt create mode 100644 app/src/main/java/com/techlads/composetv/home/HomeNestedScreen.kt delete mode 100644 app/src/main/java/com/techlads/composetv/home/MenuData.kt create mode 100644 app/src/main/java/com/techlads/composetv/home/navigation/NestedHomeScreenNavigation.kt create mode 100644 app/src/main/java/com/techlads/composetv/home/navigation/NestedScreens.kt create mode 100644 app/src/main/java/com/techlads/composetv/movies/MoviesScreen.kt create mode 100644 app/src/main/java/com/techlads/composetv/search/SearchScreen.kt create mode 100644 app/src/main/java/com/techlads/composetv/settings/SearchScreen.kt create mode 100644 app/src/main/java/com/techlads/composetv/songs/SearchScreen.kt diff --git a/app/src/main/java/com/techlads/composetv/favorites/SearchScreen.kt b/app/src/main/java/com/techlads/composetv/favorites/SearchScreen.kt new file mode 100644 index 0000000..8a7837e --- /dev/null +++ b/app/src/main/java/com/techlads/composetv/favorites/SearchScreen.kt @@ -0,0 +1,23 @@ +package com.techlads.composetv.favorites + +import androidx.compose.foundation.layout.Box +import androidx.compose.foundation.layout.fillMaxSize +import androidx.compose.material3.Text +import androidx.compose.runtime.Composable +import androidx.compose.ui.Alignment +import androidx.compose.ui.Modifier +import androidx.compose.ui.tooling.preview.Preview + +@Composable +fun FavoritesScreen(){ + Box(modifier = Modifier.fillMaxSize(), contentAlignment = Alignment.Center) { + Text(text = "Favorites") + } +} + + +@Preview +@Composable +fun FavoritesScreenPrev() { + FavoritesScreen() +} \ No newline at end of file diff --git a/app/src/main/java/com/techlads/composetv/home/HomeNestedScreen.kt b/app/src/main/java/com/techlads/composetv/home/HomeNestedScreen.kt new file mode 100644 index 0000000..ad5f3f2 --- /dev/null +++ b/app/src/main/java/com/techlads/composetv/home/HomeNestedScreen.kt @@ -0,0 +1,16 @@ +package com.techlads.composetv.home + +import androidx.compose.foundation.layout.Column +import androidx.compose.foundation.layout.fillMaxSize +import androidx.compose.runtime.Composable +import androidx.compose.ui.Modifier +import com.techlads.composetv.hero.HeroItem +import com.techlads.composetv.home.carousel.HomeCarousel + +@Composable +fun HomeNestedScreen(){ + Column(Modifier.fillMaxSize()) { + HeroItem() + HomeCarousel(Modifier.weight(1f)) + } +} \ No newline at end of file diff --git a/app/src/main/java/com/techlads/composetv/home/HomeScreenContent.kt b/app/src/main/java/com/techlads/composetv/home/HomeScreenContent.kt index 28ee03a..50b7d21 100644 --- a/app/src/main/java/com/techlads/composetv/home/HomeScreenContent.kt +++ b/app/src/main/java/com/techlads/composetv/home/HomeScreenContent.kt @@ -1,5 +1,6 @@ package com.techlads.composetv.home +import androidx.compose.animation.ExperimentalAnimationApi import androidx.compose.foundation.layout.Row import androidx.compose.foundation.layout.wrapContentWidth import androidx.compose.runtime.Composable @@ -7,12 +8,17 @@ import androidx.compose.runtime.mutableStateOf import androidx.compose.runtime.remember import androidx.compose.ui.Modifier import androidx.compose.ui.tooling.preview.Preview +import com.google.accompanist.navigation.animation.rememberAnimatedNavController import com.techlads.composetv.home.navigation.NestedHomeNavigation import com.techlads.composetv.leftmenu.LeftMenu import com.techlads.composetv.leftmenu.data.MenuData +@OptIn(ExperimentalAnimationApi::class) @Composable fun HomeScreenContent() { + + val navController = rememberAnimatedNavController() + val isExpanded = remember { mutableStateOf(false) } @@ -27,9 +33,10 @@ fun HomeScreenContent() { isExpanded.value = !isExpanded.value && isSelected } ) { - + navController.navigate(it.id) } - NestedHomeNavigation() + + NestedHomeNavigation(navController) } } diff --git a/app/src/main/java/com/techlads/composetv/home/MenuData.kt b/app/src/main/java/com/techlads/composetv/home/MenuData.kt deleted file mode 100644 index 0b08d06..0000000 --- a/app/src/main/java/com/techlads/composetv/home/MenuData.kt +++ /dev/null @@ -1,15 +0,0 @@ -package com.techlads.composetv.home - -import com.techlads.composetv.leftmenu.model.MenuItem -import compose.icons.LineAwesomeIcons -import compose.icons.lineawesomeicons.* - -object MenuData { - val menuItems = listOf( - MenuItem("", "Home", LineAwesomeIcons.HomeSolid), - MenuItem("", "Search", LineAwesomeIcons.SearchSolid), - MenuItem("", "Movies", LineAwesomeIcons.VideoSolid), - MenuItem("", "Songs", LineAwesomeIcons.MusicSolid), - MenuItem("", "Favorites", LineAwesomeIcons.HeartSolid), - ) -} \ No newline at end of file diff --git a/app/src/main/java/com/techlads/composetv/home/navigation/NestedHomeNavigation.kt b/app/src/main/java/com/techlads/composetv/home/navigation/NestedHomeNavigation.kt index 4ba1813..cf7a425 100644 --- a/app/src/main/java/com/techlads/composetv/home/navigation/NestedHomeNavigation.kt +++ b/app/src/main/java/com/techlads/composetv/home/navigation/NestedHomeNavigation.kt @@ -1,23 +1,19 @@ package com.techlads.composetv.home.navigation -import androidx.compose.foundation.layout.Column -import androidx.compose.foundation.layout.fillMaxSize +import androidx.compose.animation.ExperimentalAnimationApi import androidx.compose.runtime.Composable -import androidx.compose.ui.Modifier import androidx.compose.ui.tooling.preview.Preview -import com.techlads.composetv.hero.HeroItem -import com.techlads.composetv.home.carousel.HomeCarousel +import androidx.navigation.NavHostController +import com.google.accompanist.navigation.animation.rememberAnimatedNavController @Composable -fun NestedHomeNavigation() { - Column(Modifier.fillMaxSize()) { - HeroItem() - HomeCarousel(Modifier.weight(1f)) - } +fun NestedHomeNavigation(navController: NavHostController) { + NestedHomeScreenNavigation(navController) } +@OptIn(ExperimentalAnimationApi::class) @Preview @Composable fun NestedHomeNavigationPrev() { - NestedHomeNavigation() + NestedHomeNavigation(rememberAnimatedNavController()) } \ No newline at end of file diff --git a/app/src/main/java/com/techlads/composetv/home/navigation/NestedHomeScreenNavigation.kt b/app/src/main/java/com/techlads/composetv/home/navigation/NestedHomeScreenNavigation.kt new file mode 100644 index 0000000..91d4a08 --- /dev/null +++ b/app/src/main/java/com/techlads/composetv/home/navigation/NestedHomeScreenNavigation.kt @@ -0,0 +1,64 @@ +package com.techlads.composetv.home.navigation + +import androidx.compose.animation.ExperimentalAnimationApi +import androidx.compose.runtime.Composable +import androidx.navigation.NavHostController +import com.google.accompanist.navigation.animation.AnimatedNavHost +import com.google.accompanist.navigation.animation.composable +import com.techlads.composetv.favorites.FavoritesScreen +import com.techlads.composetv.home.HomeNestedScreen +import com.techlads.composetv.movies.MoviesScreen +import com.techlads.composetv.navigation.tabEnterTransition +import com.techlads.composetv.navigation.tabExitTransition +import com.techlads.composetv.search.SearchScreen +import com.techlads.composetv.settings.SettingsScreen +import com.techlads.composetv.songs.SongsScreen + +@OptIn(ExperimentalAnimationApi::class) +@Composable +fun NestedHomeScreenNavigation(navController: NavHostController) { + AnimatedNavHost(navController = navController, startDestination = NestedScreens.Home.title) { + // e.g will add auth routes here if when we will extend project + composable( + NestedScreens.Home.title, + enterTransition = { tabEnterTransition() }, + exitTransition = { tabExitTransition() }) { + HomeNestedScreen() + } + + composable( + NestedScreens.Search.title, + enterTransition = { tabEnterTransition() }, + exitTransition = { tabExitTransition() }) { + SearchScreen() + } + + composable( + NestedScreens.Movies.title, + enterTransition = { tabEnterTransition() }, + exitTransition = { tabExitTransition() }) { + MoviesScreen() + } + + composable( + NestedScreens.Songs.title, + enterTransition = { tabEnterTransition() }, + exitTransition = { tabExitTransition() }) { + SongsScreen() + } + + composable( + NestedScreens.Favorites.title, + enterTransition = { tabEnterTransition() }, + exitTransition = { tabExitTransition() }) { + FavoritesScreen() + } + + composable( + NestedScreens.Settings.title, + enterTransition = { tabEnterTransition() }, + exitTransition = { tabExitTransition() }) { + SettingsScreen() + } + } +} \ No newline at end of file diff --git a/app/src/main/java/com/techlads/composetv/home/navigation/NestedScreens.kt b/app/src/main/java/com/techlads/composetv/home/navigation/NestedScreens.kt new file mode 100644 index 0000000..3555782 --- /dev/null +++ b/app/src/main/java/com/techlads/composetv/home/navigation/NestedScreens.kt @@ -0,0 +1,10 @@ +package com.techlads.composetv.home.navigation + +sealed class NestedScreens(val title: String) { + object Home : NestedScreens("home") + object Search : NestedScreens("search") + object Movies : NestedScreens("movies") + object Songs : NestedScreens("songs") + object Favorites : NestedScreens("favourites") + object Settings : NestedScreens("settings") +} \ No newline at end of file diff --git a/app/src/main/java/com/techlads/composetv/leftmenu/LeftMenu.kt b/app/src/main/java/com/techlads/composetv/leftmenu/LeftMenu.kt index 6798a10..e9b3881 100644 --- a/app/src/main/java/com/techlads/composetv/leftmenu/LeftMenu.kt +++ b/app/src/main/java/com/techlads/composetv/leftmenu/LeftMenu.kt @@ -11,6 +11,7 @@ import androidx.compose.ui.focus.FocusRequester import androidx.compose.ui.graphics.Color import androidx.compose.ui.tooling.preview.Preview import androidx.compose.ui.unit.dp +import com.techlads.composetv.home.navigation.NestedScreens import com.techlads.composetv.leftmenu.model.MenuItem import compose.icons.LineAwesomeIcons import compose.icons.lineawesomeicons.CogSolid @@ -63,7 +64,7 @@ fun LeftMenu( ) Spacer(modifier = Modifier.weight(1f)) LeftMenuItem( - menuItem = MenuItem("", "Settings", LineAwesomeIcons.CogSolid), + menuItem = MenuItem(NestedScreens.Settings.title, "Settings", LineAwesomeIcons.CogSolid), modifier = Modifier.fillMaxWidth(), expanded = isExpanded, onMenuFocused = onMenuFocused, diff --git a/app/src/main/java/com/techlads/composetv/leftmenu/data/MenuData.kt b/app/src/main/java/com/techlads/composetv/leftmenu/data/MenuData.kt index 066a98d..bfef518 100644 --- a/app/src/main/java/com/techlads/composetv/leftmenu/data/MenuData.kt +++ b/app/src/main/java/com/techlads/composetv/leftmenu/data/MenuData.kt @@ -1,15 +1,16 @@ package com.techlads.composetv.leftmenu.data +import com.techlads.composetv.home.navigation.NestedScreens.* import com.techlads.composetv.leftmenu.model.MenuItem import compose.icons.LineAwesomeIcons import compose.icons.lineawesomeicons.* object MenuData { val menuItems = listOf( - MenuItem("", "Home", LineAwesomeIcons.HomeSolid), - MenuItem("", "Search", LineAwesomeIcons.SearchSolid), - MenuItem("", "Movies", LineAwesomeIcons.VideoSolid), - MenuItem("", "Songs", LineAwesomeIcons.MusicSolid), - MenuItem("", "Favorites", LineAwesomeIcons.HeartSolid), + MenuItem(Home.title, "Home", LineAwesomeIcons.HomeSolid), + MenuItem(Search.title, "Search", LineAwesomeIcons.SearchSolid), + MenuItem(Movies.title, "Movies", LineAwesomeIcons.VideoSolid), + MenuItem(Songs.title, "Songs", LineAwesomeIcons.MusicSolid), + MenuItem(Favorites.title, "Favorites", LineAwesomeIcons.HeartSolid), ) } \ No newline at end of file diff --git a/app/src/main/java/com/techlads/composetv/movies/MoviesScreen.kt b/app/src/main/java/com/techlads/composetv/movies/MoviesScreen.kt new file mode 100644 index 0000000..fd31ce0 --- /dev/null +++ b/app/src/main/java/com/techlads/composetv/movies/MoviesScreen.kt @@ -0,0 +1,23 @@ +package com.techlads.composetv.movies + +import androidx.compose.foundation.layout.Box +import androidx.compose.foundation.layout.fillMaxSize +import androidx.compose.material3.Text +import androidx.compose.runtime.Composable +import androidx.compose.ui.Alignment +import androidx.compose.ui.Modifier +import androidx.compose.ui.tooling.preview.Preview + +@Composable +fun MoviesScreen(){ + Box(modifier = Modifier.fillMaxSize(), contentAlignment = Alignment.Center) { + Text(text = "Movies") + } +} + + +@Preview +@Composable +fun MoviesScreenPrev() { + MoviesScreen() +} \ No newline at end of file diff --git a/app/src/main/java/com/techlads/composetv/navigation/AppNavigation.kt b/app/src/main/java/com/techlads/composetv/navigation/AppNavigation.kt index a7f9960..7cd58eb 100644 --- a/app/src/main/java/com/techlads/composetv/navigation/AppNavigation.kt +++ b/app/src/main/java/com/techlads/composetv/navigation/AppNavigation.kt @@ -46,11 +46,11 @@ fun AppNavigation(navController: NavHostController) { } } -private fun tabExitTransition( +fun tabExitTransition( duration: Int = 500 ) = fadeOut(tween(duration / 2, easing = LinearEasing)) -private fun tabEnterTransition( +fun tabEnterTransition( duration: Int = 500, delay: Int = duration - 350 ) = fadeIn(tween(duration, duration - delay)) diff --git a/app/src/main/java/com/techlads/composetv/search/SearchScreen.kt b/app/src/main/java/com/techlads/composetv/search/SearchScreen.kt new file mode 100644 index 0000000..ec0d710 --- /dev/null +++ b/app/src/main/java/com/techlads/composetv/search/SearchScreen.kt @@ -0,0 +1,23 @@ +package com.techlads.composetv.search + +import androidx.compose.foundation.layout.Box +import androidx.compose.foundation.layout.fillMaxSize +import androidx.compose.material3.Text +import androidx.compose.runtime.Composable +import androidx.compose.ui.Alignment +import androidx.compose.ui.Modifier +import androidx.compose.ui.tooling.preview.Preview + +@Composable +fun SearchScreen(){ + Box(modifier = Modifier.fillMaxSize(), contentAlignment = Alignment.Center) { + Text(text = "Search") + } +} + + +@Preview +@Composable +fun SearchScreenPrev() { + SearchScreen() +} \ No newline at end of file diff --git a/app/src/main/java/com/techlads/composetv/settings/SearchScreen.kt b/app/src/main/java/com/techlads/composetv/settings/SearchScreen.kt new file mode 100644 index 0000000..9c02bf2 --- /dev/null +++ b/app/src/main/java/com/techlads/composetv/settings/SearchScreen.kt @@ -0,0 +1,23 @@ +package com.techlads.composetv.settings + +import androidx.compose.foundation.layout.Box +import androidx.compose.foundation.layout.fillMaxSize +import androidx.compose.material3.Text +import androidx.compose.runtime.Composable +import androidx.compose.ui.Alignment +import androidx.compose.ui.Modifier +import androidx.compose.ui.tooling.preview.Preview + +@Composable +fun SettingsScreen(){ + Box(modifier = Modifier.fillMaxSize(), contentAlignment = Alignment.Center) { + Text(text = "Settings") + } +} + + +@Preview +@Composable +fun SettingsScreenPrev() { + SettingsScreen() +} \ No newline at end of file diff --git a/app/src/main/java/com/techlads/composetv/songs/SearchScreen.kt b/app/src/main/java/com/techlads/composetv/songs/SearchScreen.kt new file mode 100644 index 0000000..67a9328 --- /dev/null +++ b/app/src/main/java/com/techlads/composetv/songs/SearchScreen.kt @@ -0,0 +1,23 @@ +package com.techlads.composetv.songs + +import androidx.compose.foundation.layout.Box +import androidx.compose.foundation.layout.fillMaxSize +import androidx.compose.material3.Text +import androidx.compose.runtime.Composable +import androidx.compose.ui.Alignment +import androidx.compose.ui.Modifier +import androidx.compose.ui.tooling.preview.Preview + +@Composable +fun SongsScreen(){ + Box(modifier = Modifier.fillMaxSize(), contentAlignment = Alignment.Center) { + Text(text = "Songs") + } +} + + +@Preview +@Composable +fun SongsScreenPrev() { + SongsScreen() +} \ No newline at end of file From d73a6e6ead37c37bcb9e2e708cb6db28a1cac5d3 Mon Sep 17 00:00:00 2001 From: Umair Date: Mon, 27 Mar 2023 20:10:54 +0200 Subject: [PATCH 2/4] Movies grid introduced --- .../composetv/favorites/SearchScreen.kt | 23 ---------- .../composetv/home/carousel/CarouselItem.kt | 46 +++++++++++++++++++ .../techlads/composetv/movies/MoviesScreen.kt | 41 ++++++++++++++--- .../songs/{SearchScreen.kt => SongsScreen.kt} | 0 4 files changed, 81 insertions(+), 29 deletions(-) delete mode 100644 app/src/main/java/com/techlads/composetv/favorites/SearchScreen.kt rename app/src/main/java/com/techlads/composetv/songs/{SearchScreen.kt => SongsScreen.kt} (100%) diff --git a/app/src/main/java/com/techlads/composetv/favorites/SearchScreen.kt b/app/src/main/java/com/techlads/composetv/favorites/SearchScreen.kt deleted file mode 100644 index 8a7837e..0000000 --- a/app/src/main/java/com/techlads/composetv/favorites/SearchScreen.kt +++ /dev/null @@ -1,23 +0,0 @@ -package com.techlads.composetv.favorites - -import androidx.compose.foundation.layout.Box -import androidx.compose.foundation.layout.fillMaxSize -import androidx.compose.material3.Text -import androidx.compose.runtime.Composable -import androidx.compose.ui.Alignment -import androidx.compose.ui.Modifier -import androidx.compose.ui.tooling.preview.Preview - -@Composable -fun FavoritesScreen(){ - Box(modifier = Modifier.fillMaxSize(), contentAlignment = Alignment.Center) { - Text(text = "Favorites") - } -} - - -@Preview -@Composable -fun FavoritesScreenPrev() { - FavoritesScreen() -} \ No newline at end of file diff --git a/app/src/main/java/com/techlads/composetv/home/carousel/CarouselItem.kt b/app/src/main/java/com/techlads/composetv/home/carousel/CarouselItem.kt index e4518b9..457ba26 100644 --- a/app/src/main/java/com/techlads/composetv/home/carousel/CarouselItem.kt +++ b/app/src/main/java/com/techlads/composetv/home/carousel/CarouselItem.kt @@ -59,8 +59,54 @@ fun CarouselItem(parent: Int, child: Int) { } } + +@Composable +fun VerticalCarouselItem(parent: Int, child: Int) { + + var isFocused by remember { mutableStateOf(false) } + val scale = animateFloatAsState(if (isFocused) 1.05f else 1f) + + + Card( + modifier = Modifier + .zIndex(if (isFocused) 20f else 1f) + .graphicsLayer( + scaleX = scale.value, + scaleY = scale.value + ) + .padding(8.dp) + .fillMaxWidth() + .aspectRatio(0.6f) + .onFocusChanged { + isFocused = it.isFocused + } + .border( + border = BorderStroke( + 1.dp, + if (isFocused) + Color.LightGray + else + Color.Transparent + ), shape = MaterialTheme.shapes.medium + ) + .clickable { } + .focusable() + ) { + Box(contentAlignment = Alignment.Center, modifier = Modifier.fillMaxSize()) { + Text(text = "Item $parent x $child", textAlign = TextAlign.Center) + } + } +} + @Preview @Composable fun CarouselItemPrev() { CarouselItem(1, 1) } + + +@Preview +@Composable +fun VerticalCarouselItemPrev() { + VerticalCarouselItem(1, 1) +} diff --git a/app/src/main/java/com/techlads/composetv/movies/MoviesScreen.kt b/app/src/main/java/com/techlads/composetv/movies/MoviesScreen.kt index fd31ce0..6518962 100644 --- a/app/src/main/java/com/techlads/composetv/movies/MoviesScreen.kt +++ b/app/src/main/java/com/techlads/composetv/movies/MoviesScreen.kt @@ -1,20 +1,49 @@ package com.techlads.composetv.movies -import androidx.compose.foundation.layout.Box -import androidx.compose.foundation.layout.fillMaxSize +import androidx.compose.foundation.layout.* +import androidx.compose.material3.MaterialTheme import androidx.compose.material3.Text import androidx.compose.runtime.Composable -import androidx.compose.ui.Alignment import androidx.compose.ui.Modifier import androidx.compose.ui.tooling.preview.Preview +import androidx.compose.ui.unit.dp +import androidx.tv.foundation.lazy.grid.TvGridCells +import androidx.tv.foundation.lazy.grid.TvGridItemSpan +import androidx.tv.foundation.lazy.grid.TvLazyVerticalGrid +import com.techlads.composetv.home.carousel.VerticalCarouselItem @Composable -fun MoviesScreen(){ - Box(modifier = Modifier.fillMaxSize(), contentAlignment = Alignment.Center) { - Text(text = "Movies") +fun MoviesScreen() { + MoviesGrid(Modifier) +} + +@Composable +fun MoviesGrid(modifier: Modifier) { + TvLazyVerticalGrid( + modifier = modifier, + columns = TvGridCells.Fixed(5), + contentPadding = PaddingValues(start = 24.dp, top = 24.dp, end = 24.dp, bottom = 48.dp) + ) { + item(span = { + TvGridItemSpan(5) + }) { + GridHeader() + } + items(30) { + VerticalCarouselItem(parent = 0, child = 0) + } } } +@Composable +fun GridHeader() { + Text( + text = "Movies", + style = MaterialTheme.typography.titleLarge, + modifier = Modifier.padding(bottom = 24.dp, start = 8.dp) + ) +} + @Preview @Composable diff --git a/app/src/main/java/com/techlads/composetv/songs/SearchScreen.kt b/app/src/main/java/com/techlads/composetv/songs/SongsScreen.kt similarity index 100% rename from app/src/main/java/com/techlads/composetv/songs/SearchScreen.kt rename to app/src/main/java/com/techlads/composetv/songs/SongsScreen.kt From 19a8a531b076f879a076b68b0940c9a79d30b4d4 Mon Sep 17 00:00:00 2001 From: Umair Date: Mon, 27 Mar 2023 20:53:37 +0200 Subject: [PATCH 3/4] Favorites grid introduced --- .../composetv/favorites/FavoritesScreen.kt | 53 +++++++++++++++++++ 1 file changed, 53 insertions(+) create mode 100644 app/src/main/java/com/techlads/composetv/favorites/FavoritesScreen.kt diff --git a/app/src/main/java/com/techlads/composetv/favorites/FavoritesScreen.kt b/app/src/main/java/com/techlads/composetv/favorites/FavoritesScreen.kt new file mode 100644 index 0000000..93b21b0 --- /dev/null +++ b/app/src/main/java/com/techlads/composetv/favorites/FavoritesScreen.kt @@ -0,0 +1,53 @@ +package com.techlads.composetv.favorites + +import androidx.compose.foundation.layout.PaddingValues +import androidx.compose.foundation.layout.padding +import androidx.compose.material3.MaterialTheme +import androidx.compose.material3.Text +import androidx.compose.runtime.Composable +import androidx.compose.ui.Modifier +import androidx.compose.ui.tooling.preview.Preview +import androidx.compose.ui.unit.dp +import androidx.tv.foundation.lazy.grid.TvGridCells +import androidx.tv.foundation.lazy.grid.TvGridItemSpan +import androidx.tv.foundation.lazy.grid.TvLazyVerticalGrid +import com.techlads.composetv.home.carousel.VerticalCarouselItem + +@Composable +fun FavoritesScreen() { + FavoritesGrid(Modifier) +} + +@Composable +fun FavoritesGrid(modifier: Modifier) { + TvLazyVerticalGrid( + modifier = modifier, + columns = TvGridCells.Fixed(5), + contentPadding = PaddingValues(start = 24.dp, top = 24.dp, end = 24.dp, bottom = 48.dp) + ) { + item(span = { + TvGridItemSpan(5) + }) { + GridHeader() + } + items(30) { + VerticalCarouselItem(parent = 0, child = 0) + } + } +} + +@Composable +fun GridHeader() { + Text( + text = "Favorites", + style = MaterialTheme.typography.titleLarge, + modifier = Modifier.padding(bottom = 24.dp, start = 8.dp) + ) +} + +@Preview +@Composable +fun FavoritesScreenPrev() { + FavoritesScreen() +} + From 4f22baff2c37e260427230466ae063b3efc52180 Mon Sep 17 00:00:00 2001 From: Umair Khalid Date: Mon, 27 Mar 2023 21:04:40 +0200 Subject: [PATCH 4/4] Update README.md --- README.md | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/README.md b/README.md index 066a3b2..f28d75f 100644 --- a/README.md +++ b/README.md @@ -3,14 +3,20 @@ ## Signin with QR code UX ![QR Code](https://user-images.githubusercontent.com/21205138/211226659-249d191c-d930-4dd7-8aa2-e9a0056539c8.png) - ## Signin with Email UX ![Email Password](https://user-images.githubusercontent.com/21205138/211226691-c74f286f-52bc-4b56-a4bc-928be7660aa4.png) -## Home +## Home - Collapsed ![Screenshot_1679864769](https://user-images.githubusercontent.com/21205138/227805696-bef7d6d9-b275-43cd-891d-d42eb687fdac.png) + +## Home - Expandded ![Screenshot_1679864765](https://user-images.githubusercontent.com/21205138/227805700-c5fc5909-3fb9-4fc2-a348-382a792d15c9.png) +## Favorites +![favoritesscreen](https://user-images.githubusercontent.com/21205138/228040345-387ba9be-0792-4e8e-810d-e5ad9b63dcde.png) + +## Movies +![MoviesGrid](https://user-images.githubusercontent.com/21205138/228040389-25c4f8c1-b600-411c-9d35-00fb18de8e3e.png) ## Whole Experience