Skip to content

Commit

Permalink
chore: remove deprecated accompanist library
Browse files Browse the repository at this point in the history
  • Loading branch information
I-Info committed Oct 19, 2023
1 parent 0af55eb commit 9d732fd
Show file tree
Hide file tree
Showing 8 changed files with 24 additions and 28 deletions.
4 changes: 2 additions & 2 deletions app/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -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'
Expand Down
Original file line number Diff line number Diff line change
@@ -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,
) {
Expand Down
Original file line number Diff line number Diff line change
@@ -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,
Expand Down
Original file line number Diff line number Diff line change
@@ -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,
Expand Down
17 changes: 10 additions & 7 deletions app/src/main/kotlin/com/zjutjh/ijh/ui/navigation/IJhNavHost.kt
Original file line number Diff line number Diff line change
@@ -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,
Expand Down
Original file line number Diff line number Diff line change
@@ -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,
Expand Down
Original file line number Diff line number Diff line change
@@ -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,
) {
Expand Down
3 changes: 1 addition & 2 deletions build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand Down

0 comments on commit 9d732fd

Please sign in to comment.