From 9d732fd61821fd5b545c4b419c5d65064df3d6ac Mon Sep 17 00:00:00 2001 From: I-Info Date: Thu, 19 Oct 2023 15:31:08 +0800 Subject: [PATCH] chore: remove deprecated accompanist library --- app/build.gradle | 4 ++-- .../zjutjh/ijh/ui/navigation/AboutNavigation.kt | 4 +--- .../ui/navigation/ClassScheduleNavigation.kt | 8 ++++---- .../zjutjh/ijh/ui/navigation/HomeNavigation.kt | 8 ++++---- .../com/zjutjh/ijh/ui/navigation/IJhNavHost.kt | 17 ++++++++++------- .../zjutjh/ijh/ui/navigation/LoginNavigation.kt | 4 +--- .../ijh/ui/navigation/ProfileNavigation.kt | 4 +--- build.gradle | 3 +-- 8 files changed, 24 insertions(+), 28 deletions(-) diff --git a/app/build.gradle b/app/build.gradle index 5c5099d..a85994b 100644 --- a/app/build.gradle +++ b/app/build.gradle @@ -76,10 +76,10 @@ dependencies { implementation 'androidx.compose.material3:material3:1.1.2' implementation 'androidx.compose.material:material-icons-extended:1.5.4' implementation 'androidx.core:core-splashscreen:1.0.1' + implementation "androidx.navigation:navigation-compose:2.7.4" implementation 'androidx.profileinstaller:profileinstaller:1.3.1' implementation 'com.google.android.material:material:1.10.0' - implementation "com.google.accompanist:accompanist-systemuicontroller:$accompanist_version" - implementation "com.google.accompanist:accompanist-navigation-animation:$accompanist_version" + implementation "com.google.accompanist:accompanist-systemuicontroller:0.32.0" // For building appwidgets with Glance implementation 'androidx.glance:glance-appwidget:1.0.0' diff --git a/app/src/main/kotlin/com/zjutjh/ijh/ui/navigation/AboutNavigation.kt b/app/src/main/kotlin/com/zjutjh/ijh/ui/navigation/AboutNavigation.kt index ef43835..2e563dc 100644 --- a/app/src/main/kotlin/com/zjutjh/ijh/ui/navigation/AboutNavigation.kt +++ b/app/src/main/kotlin/com/zjutjh/ijh/ui/navigation/AboutNavigation.kt @@ -1,15 +1,13 @@ package com.zjutjh.ijh.ui.navigation -import androidx.compose.animation.ExperimentalAnimationApi import androidx.navigation.NavController import androidx.navigation.NavGraphBuilder import androidx.navigation.NavOptions -import com.google.accompanist.navigation.animation.composable +import androidx.navigation.compose.composable import com.zjutjh.ijh.ui.screen.AboutRoute private const val aboutRoute = "about" -@OptIn(ExperimentalAnimationApi::class) fun NavGraphBuilder.aboutScreen( onPopBackStack: () -> Unit, ) { diff --git a/app/src/main/kotlin/com/zjutjh/ijh/ui/navigation/ClassScheduleNavigation.kt b/app/src/main/kotlin/com/zjutjh/ijh/ui/navigation/ClassScheduleNavigation.kt index 1e86642..a8c0877 100644 --- a/app/src/main/kotlin/com/zjutjh/ijh/ui/navigation/ClassScheduleNavigation.kt +++ b/app/src/main/kotlin/com/zjutjh/ijh/ui/navigation/ClassScheduleNavigation.kt @@ -1,17 +1,17 @@ package com.zjutjh.ijh.ui.navigation import androidx.activity.compose.BackHandler -import androidx.compose.animation.ExperimentalAnimationApi import androidx.compose.runtime.remember -import androidx.navigation.* -import com.google.accompanist.navigation.animation.composable +import androidx.navigation.NavController +import androidx.navigation.NavGraphBuilder +import androidx.navigation.NavOptions +import androidx.navigation.compose.composable import com.zjutjh.ijh.ui.screen.ClassScheduleRoute import com.zjutjh.ijh.ui.viewmodel.ClassScheduleViewModel import com.zjutjh.ijh.util.ViewModelStoreMappingOwner private const val CLASS_SCHEDULE_ROUTE = "classSchedule" -@OptIn(ExperimentalAnimationApi::class) fun NavGraphBuilder.classScheduleScreen( mappingOwner: ViewModelStoreMappingOwner, onNavigateBack: () -> Unit, diff --git a/app/src/main/kotlin/com/zjutjh/ijh/ui/navigation/HomeNavigation.kt b/app/src/main/kotlin/com/zjutjh/ijh/ui/navigation/HomeNavigation.kt index e7f2341..3ff3248 100644 --- a/app/src/main/kotlin/com/zjutjh/ijh/ui/navigation/HomeNavigation.kt +++ b/app/src/main/kotlin/com/zjutjh/ijh/ui/navigation/HomeNavigation.kt @@ -1,13 +1,13 @@ package com.zjutjh.ijh.ui.navigation -import androidx.compose.animation.ExperimentalAnimationApi -import androidx.navigation.* -import com.google.accompanist.navigation.animation.composable +import androidx.navigation.NavController +import androidx.navigation.NavGraphBuilder +import androidx.navigation.NavOptions +import androidx.navigation.compose.composable import com.zjutjh.ijh.ui.screen.HomeRoute const val homeRoute = "home" -@OptIn(ExperimentalAnimationApi::class) fun NavGraphBuilder.homeScreen( onNavigateToLogin: () -> Unit, onNavigateToProfile: () -> Unit, diff --git a/app/src/main/kotlin/com/zjutjh/ijh/ui/navigation/IJhNavHost.kt b/app/src/main/kotlin/com/zjutjh/ijh/ui/navigation/IJhNavHost.kt index 9004f29..4b044e7 100644 --- a/app/src/main/kotlin/com/zjutjh/ijh/ui/navigation/IJhNavHost.kt +++ b/app/src/main/kotlin/com/zjutjh/ijh/ui/navigation/IJhNavHost.kt @@ -1,30 +1,33 @@ package com.zjutjh.ijh.ui.navigation -import androidx.compose.animation.* import androidx.compose.animation.core.tween -import androidx.compose.runtime.* +import androidx.compose.animation.fadeIn +import androidx.compose.animation.fadeOut +import androidx.compose.animation.slideIn +import androidx.compose.animation.slideOut +import androidx.compose.runtime.Composable +import androidx.compose.runtime.rememberCoroutineScope import androidx.compose.ui.Modifier import androidx.compose.ui.unit.IntOffset import androidx.navigation.NavHostController +import androidx.navigation.compose.NavHost +import androidx.navigation.compose.rememberNavController import androidx.navigation.navOptions -import com.google.accompanist.navigation.animation.AnimatedNavHost -import com.google.accompanist.navigation.animation.rememberAnimatedNavController import com.zjutjh.ijh.util.ViewModelStoreMappingOwner import kotlinx.coroutines.launch private const val ANIM_DURATION: Int = 300 -@OptIn(ExperimentalAnimationApi::class) @Composable fun IJhNavHost( modifier: Modifier = Modifier, sharedViewModelStoreOwner: ViewModelStoreMappingOwner, - navController: NavHostController = rememberAnimatedNavController(), + navController: NavHostController = rememberNavController(), startDestination: String = homeRoute ) { val scope = rememberCoroutineScope() - AnimatedNavHost( + NavHost( modifier = modifier, navController = navController, startDestination = startDestination, diff --git a/app/src/main/kotlin/com/zjutjh/ijh/ui/navigation/LoginNavigation.kt b/app/src/main/kotlin/com/zjutjh/ijh/ui/navigation/LoginNavigation.kt index adfe5fc..6e5f236 100644 --- a/app/src/main/kotlin/com/zjutjh/ijh/ui/navigation/LoginNavigation.kt +++ b/app/src/main/kotlin/com/zjutjh/ijh/ui/navigation/LoginNavigation.kt @@ -1,15 +1,13 @@ package com.zjutjh.ijh.ui.navigation -import androidx.compose.animation.ExperimentalAnimationApi import androidx.navigation.NavController import androidx.navigation.NavGraphBuilder import androidx.navigation.NavOptions -import com.google.accompanist.navigation.animation.composable +import androidx.navigation.compose.composable import com.zjutjh.ijh.ui.screen.LoginScreen private const val loginRoute = "login" -@OptIn(ExperimentalAnimationApi::class) fun NavGraphBuilder.loginScreen( onPopBackStack: () -> Unit, onPopUpAndNavigateToHomeScreen: () -> Unit, diff --git a/app/src/main/kotlin/com/zjutjh/ijh/ui/navigation/ProfileNavigation.kt b/app/src/main/kotlin/com/zjutjh/ijh/ui/navigation/ProfileNavigation.kt index c520d32..ce79a3e 100644 --- a/app/src/main/kotlin/com/zjutjh/ijh/ui/navigation/ProfileNavigation.kt +++ b/app/src/main/kotlin/com/zjutjh/ijh/ui/navigation/ProfileNavigation.kt @@ -1,15 +1,13 @@ package com.zjutjh.ijh.ui.navigation -import androidx.compose.animation.ExperimentalAnimationApi import androidx.navigation.NavController import androidx.navigation.NavGraphBuilder import androidx.navigation.NavOptions -import com.google.accompanist.navigation.animation.composable +import androidx.navigation.compose.composable import com.zjutjh.ijh.ui.screen.ProfileRoute private const val profileRoute = "profile" -@OptIn(ExperimentalAnimationApi::class) fun NavGraphBuilder.profileScreen( onPopBackStack: () -> Unit, ) { diff --git a/build.gradle b/build.gradle index 6a574bb..ac6257b 100644 --- a/build.gradle +++ b/build.gradle @@ -8,8 +8,7 @@ buildscript { compose_version = '1.5.4' hilt_version = '2.48.1' retrofit_version = "2.9.0" - accompanist_version = "0.32.0" - protobuf_version = '3.23.4' + protobuf_version = '3.24.0' room_version = '2.6.0' } } // Top-level build file where you can add configuration options common to all sub-projects/modules.