-
-
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 #16 from UmairKhalid786/feature/nested_navigation_…
…introduced Nested navigation introduced
- Loading branch information
Showing
14 changed files
with
231 additions
and
36 deletions.
There are no files selected for viewing
23 changes: 23 additions & 0 deletions
23
app/src/main/java/com/techlads/composetv/favorites/SearchScreen.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,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() | ||
} |
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.
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), | ||
) | ||
} |
23 changes: 23 additions & 0 deletions
23
app/src/main/java/com/techlads/composetv/movies/MoviesScreen.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,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() | ||
} |
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
23 changes: 23 additions & 0 deletions
23
app/src/main/java/com/techlads/composetv/search/SearchScreen.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,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() | ||
} |
23 changes: 23 additions & 0 deletions
23
app/src/main/java/com/techlads/composetv/settings/SearchScreen.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,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() | ||
} |
23 changes: 23 additions & 0 deletions
23
app/src/main/java/com/techlads/composetv/songs/SearchScreen.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,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() | ||
} |