diff --git a/.idea/kotlinc.xml b/.idea/kotlinc.xml index 148fdd2..6d0ee1c 100644 --- a/.idea/kotlinc.xml +++ b/.idea/kotlinc.xml @@ -1,6 +1,6 @@ - \ No newline at end of file diff --git a/app/src/main/java/com/kanyideveloper/muviz/MainActivity.kt b/app/src/main/java/com/kanyideveloper/muviz/MainActivity.kt index 550fd3d..2b232b8 100644 --- a/app/src/main/java/com/kanyideveloper/muviz/MainActivity.kt +++ b/app/src/main/java/com/kanyideveloper/muviz/MainActivity.kt @@ -29,10 +29,11 @@ import androidx.navigation.compose.rememberNavController import com.kanyideveloper.muviz.common.presentation.components.StandardScaffold import com.kanyideveloper.muviz.common.presentation.theme.MuvizTheme import com.kanyideveloper.muviz.common.presentation.theme.Theme -import com.kanyideveloper.muviz.destinations.AccountScreenDestination -import com.kanyideveloper.muviz.destinations.FavoritesScreenDestination -import com.kanyideveloper.muviz.destinations.HomeScreenDestination import com.ramcosta.composedestinations.DestinationsNavHost +import com.ramcosta.composedestinations.generated.NavGraphs +import com.ramcosta.composedestinations.generated.destinations.AccountScreenDestination +import com.ramcosta.composedestinations.generated.destinations.FavoritesScreenDestination +import com.ramcosta.composedestinations.generated.destinations.HomeScreenDestination import com.ramcosta.composedestinations.rememberNavHostEngine import dagger.hilt.android.AndroidEntryPoint import kotlinx.coroutines.Dispatchers diff --git a/app/src/main/java/com/kanyideveloper/muviz/about/presentation/AboutScreen.kt b/app/src/main/java/com/kanyideveloper/muviz/about/presentation/AboutScreen.kt index 35ea61f..7d2ddc9 100644 --- a/app/src/main/java/com/kanyideveloper/muviz/about/presentation/AboutScreen.kt +++ b/app/src/main/java/com/kanyideveloper/muviz/about/presentation/AboutScreen.kt @@ -39,9 +39,10 @@ import com.kanyideveloper.muviz.common.presentation.theme.MuvizTheme import com.kanyideveloper.muviz.common.util.appVersionCode import com.kanyideveloper.muviz.common.util.appVersionName import com.ramcosta.composedestinations.annotation.Destination +import com.ramcosta.composedestinations.annotation.RootGraph import com.ramcosta.composedestinations.navigation.DestinationsNavigator -@Destination +@Destination @Composable fun AboutScreen( navigator: DestinationsNavigator diff --git a/app/src/main/java/com/kanyideveloper/muviz/account/presentation/AccountScreen.kt b/app/src/main/java/com/kanyideveloper/muviz/account/presentation/AccountScreen.kt index c1764da..8266d81 100644 --- a/app/src/main/java/com/kanyideveloper/muviz/account/presentation/AccountScreen.kt +++ b/app/src/main/java/com/kanyideveloper/muviz/account/presentation/AccountScreen.kt @@ -69,11 +69,12 @@ import com.kanyideveloper.muviz.about.domain.model.AccountItem import com.kanyideveloper.muviz.common.presentation.components.StandardToolbar import com.kanyideveloper.muviz.common.presentation.theme.MuvizTheme import com.kanyideveloper.muviz.common.presentation.theme.Theme -import com.kanyideveloper.muviz.destinations.AboutScreenDestination import com.ramcosta.composedestinations.annotation.Destination +import com.ramcosta.composedestinations.annotation.RootGraph +import com.ramcosta.composedestinations.generated.destinations.AboutScreenDestination import com.ramcosta.composedestinations.navigation.DestinationsNavigator -@Destination +@Destination @Composable fun AccountScreen( navigator: DestinationsNavigator, diff --git a/app/src/main/java/com/kanyideveloper/muviz/cast/presentation/castdetails/CastDetailsScreen.kt b/app/src/main/java/com/kanyideveloper/muviz/cast/presentation/castdetails/CastDetailsScreen.kt index 2fa24f5..0d996fd 100644 --- a/app/src/main/java/com/kanyideveloper/muviz/cast/presentation/castdetails/CastDetailsScreen.kt +++ b/app/src/main/java/com/kanyideveloper/muviz/cast/presentation/castdetails/CastDetailsScreen.kt @@ -34,9 +34,10 @@ import androidx.hilt.navigation.compose.hiltViewModel import com.kanyideveloper.muviz.cast.domain.model.Cast import com.kanyideveloper.muviz.common.presentation.components.StandardToolbar import com.ramcosta.composedestinations.annotation.Destination +import com.ramcosta.composedestinations.annotation.RootGraph import com.ramcosta.composedestinations.navigation.DestinationsNavigator -@Destination +@Destination @Composable fun CastDetailsScreen( cast: Cast, diff --git a/app/src/main/java/com/kanyideveloper/muviz/cast/presentation/casts/CastsScreen.kt b/app/src/main/java/com/kanyideveloper/muviz/cast/presentation/casts/CastsScreen.kt index fb5cca1..1fc0ad3 100644 --- a/app/src/main/java/com/kanyideveloper/muviz/cast/presentation/casts/CastsScreen.kt +++ b/app/src/main/java/com/kanyideveloper/muviz/cast/presentation/casts/CastsScreen.kt @@ -45,11 +45,12 @@ import com.kanyideveloper.muviz.cast.domain.model.Credits import com.kanyideveloper.muviz.common.presentation.components.StandardToolbar import com.kanyideveloper.muviz.common.presentation.theme.MuvizTheme import com.kanyideveloper.muviz.common.util.Constants -import com.kanyideveloper.muviz.destinations.CastDetailsScreenDestination import com.ramcosta.composedestinations.annotation.Destination +import com.ramcosta.composedestinations.annotation.RootGraph +import com.ramcosta.composedestinations.generated.destinations.CastDetailsScreenDestination import com.ramcosta.composedestinations.navigation.DestinationsNavigator -@Destination +@Destination @Composable fun CastsScreen( credits: Credits, diff --git a/app/src/main/java/com/kanyideveloper/muviz/common/domain/model/BottomNavItem.kt b/app/src/main/java/com/kanyideveloper/muviz/common/domain/model/BottomNavItem.kt index 8e2dcbe..1de2ada 100644 --- a/app/src/main/java/com/kanyideveloper/muviz/common/domain/model/BottomNavItem.kt +++ b/app/src/main/java/com/kanyideveloper/muviz/common/domain/model/BottomNavItem.kt @@ -16,25 +16,28 @@ package com.kanyideveloper.muviz.common.domain.model import com.kanyideveloper.muviz.R -import com.kanyideveloper.muviz.destinations.AccountScreenDestination -import com.kanyideveloper.muviz.destinations.Destination -import com.kanyideveloper.muviz.destinations.FavoritesScreenDestination -import com.kanyideveloper.muviz.destinations.HomeScreenDestination +import com.ramcosta.composedestinations.generated.destinations.AccountScreenDestination +import com.ramcosta.composedestinations.generated.destinations.FavoritesScreenDestination +import com.ramcosta.composedestinations.generated.destinations.HomeScreenDestination -sealed class BottomNavItem(var title: String, var icon: Int, var destination: Destination) { +sealed class BottomNavItem( + val title: String, + val icon: Int, + val route: String, +) { data object Home : BottomNavItem( title = "Home", icon = R.drawable.ic_home, - destination = HomeScreenDestination + route = HomeScreenDestination.route ) data object Favorites: BottomNavItem( title = "Favorites", icon = R.drawable.ic_star, - destination = FavoritesScreenDestination + route = FavoritesScreenDestination.route ) data object Account: BottomNavItem( title = "Account", icon = R.drawable.ic_profile, - destination = AccountScreenDestination + route = AccountScreenDestination.route ) } diff --git a/app/src/main/java/com/kanyideveloper/muviz/common/presentation/components/StandardScaffold.kt b/app/src/main/java/com/kanyideveloper/muviz/common/presentation/components/StandardScaffold.kt index 5341662..b5d89b9 100644 --- a/app/src/main/java/com/kanyideveloper/muviz/common/presentation/components/StandardScaffold.kt +++ b/app/src/main/java/com/kanyideveloper/muviz/common/presentation/components/StandardScaffold.kt @@ -69,9 +69,9 @@ fun StandardScaffold( ) }, alwaysShowLabel = true, - selected = currentDestination?.route?.contains(item.destination.route) == true, + selected = currentDestination?.route?.contains(item.route) == true, onClick = { - navController.navigate(item.destination.route) { + navController.navigate(item.route) { navController.graph.startDestinationRoute?.let { screenRoute -> popUpTo(screenRoute) { saveState = true diff --git a/app/src/main/java/com/kanyideveloper/muviz/common/presentation/components/StandardToolbar.kt b/app/src/main/java/com/kanyideveloper/muviz/common/presentation/components/StandardToolbar.kt index e4ea265..8e700a8 100644 --- a/app/src/main/java/com/kanyideveloper/muviz/common/presentation/components/StandardToolbar.kt +++ b/app/src/main/java/com/kanyideveloper/muviz/common/presentation/components/StandardToolbar.kt @@ -21,7 +21,7 @@ import androidx.compose.material3.IconButton import androidx.compose.material3.Text import androidx.compose.material3.TopAppBar import androidx.compose.material.icons.Icons -import androidx.compose.material.icons.filled.ArrowBack +import androidx.compose.material.icons.automirrored.filled.ArrowBack import androidx.compose.material3.ExperimentalMaterial3Api import androidx.compose.material3.MaterialTheme import androidx.compose.material3.TopAppBarDefaults @@ -49,7 +49,7 @@ fun StandardToolbar( onBackArrowClicked ) { Icon( - imageVector = Icons.Default.ArrowBack, + imageVector = Icons.AutoMirrored.Default.ArrowBack, contentDescription = null, ) } diff --git a/app/src/main/java/com/kanyideveloper/muviz/favorites/presentation/FavoritesScreen.kt b/app/src/main/java/com/kanyideveloper/muviz/favorites/presentation/FavoritesScreen.kt index 896bafa..b7d99b2 100644 --- a/app/src/main/java/com/kanyideveloper/muviz/favorites/presentation/FavoritesScreen.kt +++ b/app/src/main/java/com/kanyideveloper/muviz/favorites/presentation/FavoritesScreen.kt @@ -55,10 +55,12 @@ import coil.compose.rememberImagePainter import com.kanyideveloper.muviz.common.presentation.components.StandardToolbar import com.kanyideveloper.muviz.favorites.data.data.local.Favorite import com.kanyideveloper.muviz.filmdetail.presentation.common.VoteAverageRatingIndicator +import com.ramcosta.composedestinations.annotation.RootGraph +import com.ramcosta.composedestinations.generated.destinations.FilmDetailsScreenDestination import timber.log.Timber @OptIn(ExperimentalMaterialApi::class) -@Destination +@Destination @Composable fun FavoritesScreen( navigator: DestinationsNavigator, @@ -162,14 +164,14 @@ fun FavoritesScreen( .clickable { if (favorite.mediaType == "tv") { navigator.navigate( - com.kanyideveloper.muviz.destinations.FilmDetailsScreenDestination( + FilmDetailsScreenDestination( filmId = favorite.mediaId, filmType = "tv" ) ) } else if (favorite.mediaType == "movie") { navigator.navigate( - com.kanyideveloper.muviz.destinations.FilmDetailsScreenDestination( + FilmDetailsScreenDestination( filmId = favorite.mediaId, filmType = "movie" ) diff --git a/app/src/main/java/com/kanyideveloper/muviz/filmdetail/presentation/FilmDetailsScreen.kt b/app/src/main/java/com/kanyideveloper/muviz/filmdetail/presentation/FilmDetailsScreen.kt index 3b311ff..5b959cd 100644 --- a/app/src/main/java/com/kanyideveloper/muviz/filmdetail/presentation/FilmDetailsScreen.kt +++ b/app/src/main/java/com/kanyideveloper/muviz/filmdetail/presentation/FilmDetailsScreen.kt @@ -32,14 +32,15 @@ import androidx.compose.ui.Modifier import androidx.compose.ui.tooling.preview.Preview import androidx.compose.ui.unit.dp import androidx.hilt.navigation.compose.hiltViewModel -import com.kanyideveloper.muviz.destinations.CastDetailsScreenDestination -import com.kanyideveloper.muviz.destinations.CastsScreenDestination import com.kanyideveloper.muviz.filmdetail.presentation.common.FilmImageBanner import com.kanyideveloper.muviz.filmdetail.presentation.common.FilmInfo import com.ramcosta.composedestinations.annotation.Destination +import com.ramcosta.composedestinations.annotation.RootGraph +import com.ramcosta.composedestinations.generated.destinations.CastDetailsScreenDestination +import com.ramcosta.composedestinations.generated.destinations.CastsScreenDestination import com.ramcosta.composedestinations.navigation.DestinationsNavigator -@Destination +@Destination @Composable fun FilmDetailsScreen( filmId: Int, diff --git a/app/src/main/java/com/kanyideveloper/muviz/home/presentation/HomeScreen.kt b/app/src/main/java/com/kanyideveloper/muviz/home/presentation/HomeScreen.kt index 62cf013..561fcf1 100644 --- a/app/src/main/java/com/kanyideveloper/muviz/home/presentation/HomeScreen.kt +++ b/app/src/main/java/com/kanyideveloper/muviz/home/presentation/HomeScreen.kt @@ -68,16 +68,15 @@ import coil.request.ImageRequest import com.kanyideveloper.muviz.R import com.kanyideveloper.muviz.common.presentation.components.StandardToolbar import com.kanyideveloper.muviz.common.util.Constants.IMAGE_BASE_UR -import com.kanyideveloper.muviz.destinations.FilmDetailsScreenDestination -import com.kanyideveloper.muviz.destinations.SearchScreenDestination import com.ramcosta.composedestinations.annotation.Destination -import com.ramcosta.composedestinations.annotation.RootNavGraph +import com.ramcosta.composedestinations.annotation.RootGraph +import com.ramcosta.composedestinations.generated.destinations.FilmDetailsScreenDestination +import com.ramcosta.composedestinations.generated.destinations.SearchScreenDestination import com.ramcosta.composedestinations.navigation.DestinationsNavigator import retrofit2.HttpException import java.io.IOException -@RootNavGraph(start = true) -@Destination +@Destination(start = true) @Composable fun HomeScreen( navigator: DestinationsNavigator, diff --git a/app/src/main/java/com/kanyideveloper/muviz/search/presentation/SearchScreen.kt b/app/src/main/java/com/kanyideveloper/muviz/search/presentation/SearchScreen.kt index 8336747..e84ccc7 100644 --- a/app/src/main/java/com/kanyideveloper/muviz/search/presentation/SearchScreen.kt +++ b/app/src/main/java/com/kanyideveloper/muviz/search/presentation/SearchScreen.kt @@ -76,16 +76,17 @@ import com.kanyideveloper.muviz.R import com.kanyideveloper.muviz.common.presentation.components.StandardToolbar import com.kanyideveloper.muviz.common.presentation.theme.MuvizTheme import com.kanyideveloper.muviz.common.util.Constants -import com.kanyideveloper.muviz.destinations.FilmDetailsScreenDestination import com.kanyideveloper.muviz.genre.domain.model.Genre import com.kanyideveloper.muviz.search.domain.model.Search import com.ramcosta.composedestinations.annotation.Destination +import com.ramcosta.composedestinations.annotation.RootGraph +import com.ramcosta.composedestinations.generated.destinations.FilmDetailsScreenDestination import com.ramcosta.composedestinations.navigation.DestinationsNavigator import retrofit2.HttpException import java.io.IOException @OptIn(androidx.compose.ui.ExperimentalComposeUiApi::class) -@Destination(start = false) +@Destination @Composable fun SearchScreen( navigator: DestinationsNavigator, diff --git a/gradle/libs.versions.toml b/gradle/libs.versions.toml index b7c08b6..b85a522 100644 --- a/gradle/libs.versions.toml +++ b/gradle/libs.versions.toml @@ -12,7 +12,7 @@ accompanistFlowlayout = "0.34.0" accompanist = "0.34.0" activityCompose = "1.9.0" androidxJunit = "1.1.5" -animationsCore = "1.10.2" +composeDestinations = "2.1.0-beta08" coilCompose = "2.6.0" constraintlayout = "2.1.4" coreKtx = "1.13.1" @@ -60,7 +60,7 @@ androidx-ui = { module = "androidx.compose.ui:ui", version.ref = "compose" } androidx-ui-test-junit4 = { module = "androidx.compose.ui:ui-test-junit4", version.ref = "compose" } androidx-ui-tooling = { module = "androidx.compose.ui:ui-tooling", version.ref = "compose" } androidx-ui-tooling-preview = { module = "androidx.compose.ui:ui-tooling-preview", version.ref = "compose" } -compose-destination-core = { module = "io.github.raamcosta.compose-destinations:animations-core", version.ref = "animationsCore" } +compose-destination-core = { module = "io.github.raamcosta.compose-destinations:core", version.ref = "composeDestinations" } coil-compose = { module = "io.coil-kt:coil-compose", version.ref = "coilCompose" } converter-gson = { module = "com.squareup.retrofit2:converter-gson", version.ref = "retrofit" } hilt-android = { module = "com.google.dagger:hilt-android", version.ref = "hiltAndroid" } @@ -69,7 +69,7 @@ jakewharton-timber = { module = "com.jakewharton.timber:timber", version.ref = " junit = { module = "junit:junit", version.ref = "junitVersion" } kotlinx-coroutines-android = { module = "org.jetbrains.kotlinx:kotlinx-coroutines-android", version.ref = "kotlinxCoroutinesAndroid" } kotlinx-coroutines-core = { module = "org.jetbrains.kotlinx:kotlinx-coroutines-core", version.ref = "kotlinxCoroutinesCore" } -compose-destination-ksp = { module = "io.github.raamcosta.compose-destinations:ksp", version.ref = "animationsCore" } +compose-destination-ksp = { module = "io.github.raamcosta.compose-destinations:ksp", version.ref = "composeDestinations" } logging-interceptor = { module = "com.squareup.okhttp3:logging-interceptor", version.ref = "okhttp" } okhttp = { module = "com.squareup.okhttp3:okhttp", version.ref = "okhttp" } retrofit = { module = "com.squareup.retrofit2:retrofit", version.ref = "retrofit" }