-
-
Notifications
You must be signed in to change notification settings - Fork 31
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #20 from UmairKhalid786/develop
Movies and Favorites Grid added
- Loading branch information
Showing
16 changed files
with
344 additions
and
38 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
53 changes: 53 additions & 0 deletions
53
app/src/main/java/com/techlads/composetv/favorites/FavoritesScreen.kt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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() | ||
} | ||
|
16 changes: 16 additions & 0 deletions
16
app/src/main/java/com/techlads/composetv/home/HomeNestedScreen.kt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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)) | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
18 changes: 7 additions & 11 deletions
18
app/src/main/java/com/techlads/composetv/home/navigation/NestedHomeNavigation.kt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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()) | ||
} |
64 changes: 64 additions & 0 deletions
64
app/src/main/java/com/techlads/composetv/home/navigation/NestedHomeScreenNavigation.kt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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() | ||
} | ||
} | ||
} |
10 changes: 10 additions & 0 deletions
10
app/src/main/java/com/techlads/composetv/home/navigation/NestedScreens.kt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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") | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
11 changes: 6 additions & 5 deletions
11
app/src/main/java/com/techlads/composetv/leftmenu/data/MenuData.kt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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), | ||
) | ||
} |
Oops, something went wrong.