Skip to content

Commit

Permalink
Merge pull request #166 from WithPeace/feat/#165-화면_전환_개선
Browse files Browse the repository at this point in the history
Feat/#165 화면 전환 개선
  • Loading branch information
rhkrwngud445 authored Jul 22, 2024
2 parents 52bb62f + bd08f8a commit 4ef1bd0
Show file tree
Hide file tree
Showing 20 changed files with 198 additions and 18 deletions.
4 changes: 2 additions & 2 deletions app/release/output-metadata.json
Original file line number Diff line number Diff line change
Expand Up @@ -11,8 +11,8 @@
"type": "SINGLE",
"filters": [],
"attributes": [],
"versionCode": 5,
"versionName": "1.0.0",
"versionCode": 9,
"versionName": "1.1.1",
"outputFile": "app-release.apk"
}
],
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
package com.withpeace.withpeace.navigation

import androidx.compose.animation.EnterTransition
import androidx.compose.animation.ExitTransition
import androidx.compose.runtime.Composable
import androidx.compose.ui.Modifier
import androidx.navigation.NavHostController
Expand Down Expand Up @@ -55,6 +57,8 @@ fun WithpeaceNavHost(
modifier = modifier,
navController = navController,
startDestination = startDestination,
enterTransition = { EnterTransition.None },
exitTransition = { ExitTransition.None },
) {
loginNavGraph(
onShowSnackBar = { onShowSnackBar(SnackbarState(it)) },
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
package com.withpeace.withpeace.feature.gallery.navigation

import androidx.compose.animation.AnimatedContentTransitionScope
import androidx.compose.animation.core.tween
import androidx.navigation.NavController
import androidx.navigation.NavGraphBuilder
import androidx.navigation.NavOptions
Expand Down Expand Up @@ -32,6 +34,18 @@ fun NavGraphBuilder.galleryNavGraph(
navArgument(GALLERY_IMAGE_LIMIT_ARGUMENT) { type = NavType.IntType },
navArgument(GALLERY_ALREADY_IMAGE_COUNT_ARGUMENT) { type = NavType.IntType },
),
enterTransition = {
slideIntoContainer(
AnimatedContentTransitionScope.SlideDirection.Left,
animationSpec = tween(500),
)
},
exitTransition = {
slideOutOfContainer(
AnimatedContentTransitionScope.SlideDirection.Right,
animationSpec = tween(500),
)
},
) {
GalleryRoute(
onClickBackButton = onClickBackButton,
Expand Down
Original file line number Diff line number Diff line change
@@ -1,10 +1,11 @@
package com.withpeace.withpeace.feature.home.navigation

import androidx.compose.animation.EnterTransition
import androidx.compose.animation.ExitTransition
import androidx.navigation.NavController
import androidx.navigation.NavGraphBuilder
import androidx.navigation.NavOptions
import androidx.navigation.compose.composable
import com.withpeace.withpeace.feature.home.uistate.YouthPolicyUiModel
import com.withpeace.withpeace.feature.home.HomeRoute

const val HOME_ROUTE = "homeRoute"
Expand All @@ -17,7 +18,11 @@ fun NavGraphBuilder.homeNavGraph(
onShowSnackBar: (message: String) -> Unit,
onPolicyClick: (String) -> Unit,
) {
composable(route = HOME_ROUTE) {
composable(
route = HOME_ROUTE,
enterTransition = { EnterTransition.None },
exitTransition = { ExitTransition.None },
) {
HomeRoute(
onShowSnackBar = onShowSnackBar,
onPolicyClick = onPolicyClick
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
package com.withpeace.withpeace.feature.mypage.navigation

import androidx.compose.animation.EnterTransition
import androidx.compose.animation.ExitTransition
import androidx.hilt.navigation.compose.hiltViewModel
import androidx.navigation.NavController
import androidx.navigation.NavGraphBuilder
Expand All @@ -24,7 +26,11 @@ fun NavGraphBuilder.myPageNavGraph(
onAuthExpired: () -> Unit,
onDibsOfPolicyClick: () -> Unit,
) {
composable(route = MY_PAGE_ROUTE) {
composable(
route = MY_PAGE_ROUTE,
enterTransition = { EnterTransition.None },
exitTransition = { ExitTransition.None },
) {
val nickname = it.savedStateHandle.get<String>(MY_PAGE_CHANGED_NICKNAME_ARGUMENT)
val profile = it.savedStateHandle.get<String>(MY_PAGE_CHANGED_IMAGE_ARGUMENT)
val viewModel: MyPageViewModel = hiltViewModel()
Expand Down
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
import androidx.compose.animation.AnimatedContentTransitionScope
import androidx.compose.animation.core.tween
import androidx.navigation.NavController
import androidx.navigation.NavGraphBuilder
import androidx.navigation.NavOptions
Expand All @@ -14,10 +16,25 @@ fun NavGraphBuilder.policyBookmarksNavGraph(
onShowSnackBar: (message: String) -> Unit,
onClickBackButton: () -> Unit,
) {
composable(route = POLICY_BOOKMARKS_ROUTE) {
composable(
route = POLICY_BOOKMARKS_ROUTE,
enterTransition = {
slideIntoContainer(
AnimatedContentTransitionScope.SlideDirection.Left,
animationSpec = tween(500),
)
},
exitTransition = {
slideOutOfContainer(
AnimatedContentTransitionScope.SlideDirection.Right,
animationSpec = tween(500),
)
},
) {
PolicyBookmarksRoute(
onShowSnackBar = onShowSnackBar,
onClickBackButton = onClickBackButton,
)

)
}
}
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
package com.withpeace.withpeace.feature.policyconsent

import androidx.compose.foundation.Image
import androidx.compose.foundation.background
import androidx.compose.foundation.clickable
import androidx.compose.foundation.layout.Arrangement
import androidx.compose.foundation.layout.Column
Expand Down Expand Up @@ -90,8 +91,10 @@ fun PolicyConsentScreen(
) {
val scrollState = rememberScrollState()
Column(
modifier = modifier
.fillMaxSize()
.background(WithpeaceTheme.colors.SystemWhite),
verticalArrangement = Arrangement.SpaceBetween,
modifier = modifier.fillMaxSize(),
) {
Column(
modifier
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
package com.withpeace.withpeace.feature.policyconsent.navigation

import androidx.compose.animation.AnimatedContentTransitionScope
import androidx.compose.animation.core.tween
import androidx.navigation.NavController
import androidx.navigation.NavGraphBuilder
import androidx.navigation.NavOptions
Expand All @@ -17,7 +19,21 @@ fun NavGraphBuilder.policyConsentGraph(
onShowTermsOfServiceClick: () -> Unit,
onSuccessToNext: () -> Unit,
) {
composable(POLICY_CONSENT_ROUTE) {
composable(
POLICY_CONSENT_ROUTE,
enterTransition = {
slideIntoContainer(
AnimatedContentTransitionScope.SlideDirection.Left,
animationSpec = tween(500),
)
},
exitTransition = {
slideOutOfContainer(
AnimatedContentTransitionScope.SlideDirection.Right,
animationSpec = tween(500),
)
},
) {
PolicyConsentRoute(
onShowSnackBar = onShowSnackBar,
onShowPrivacyPolicyClick = onShowPrivacyPolicyClick,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -84,10 +84,12 @@ private fun PolicyDetailContent(
}
val visibility = remember {
derivedStateOf {
scrollState.value >= position.intValue
scrollState.value > position.intValue
}
}
Column(modifier = modifier.fillMaxSize()) {
Column(modifier = modifier
.fillMaxSize()
.background(WithpeaceTheme.colors.SystemWhite)) {
WithPeaceBackButtonTopAppBar(
onClickBackButton = onClickBackButton,
title = {
Expand All @@ -103,6 +105,7 @@ private fun PolicyDetailContent(
overflow = TextOverflow.Ellipsis,
modifier = modifier.padding(end = 24.dp),
)

}
},
)
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
package com.withpeace.withpeace.feature.policydetail.navigation

import androidx.compose.animation.AnimatedContentTransitionScope
import androidx.compose.animation.core.tween
import androidx.navigation.NavController
import androidx.navigation.NavGraphBuilder
import androidx.navigation.NavOptions
Expand Down Expand Up @@ -30,6 +32,18 @@ fun NavGraphBuilder.policyDetailNavGraph(
type = NavType.StringType
},
),
enterTransition = {
slideIntoContainer(
AnimatedContentTransitionScope.SlideDirection.Left,
animationSpec = tween(500),
)
},
exitTransition = {
slideOutOfContainer(
AnimatedContentTransitionScope.SlideDirection.Right,
animationSpec = tween(500),
)
},
) {

PolicyDetailRoute(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,12 @@ fun NavGraphBuilder.postDetailGraph(
animationSpec = tween(500),
)
},
exitTransition = {
slideOutOfContainer(
AnimatedContentTransitionScope.SlideDirection.Right,
animationSpec = tween(500),
)
},
) {
PostDetailRoute(
onShowSnackBar = onShowSnackBar,
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
package com.withpeace.withpeace.feature.postlist.navigation

import androidx.compose.animation.EnterTransition
import androidx.compose.animation.ExitTransition
import androidx.hilt.navigation.compose.hiltViewModel
import androidx.navigation.NavController
import androidx.navigation.NavGraphBuilder
Expand All @@ -19,7 +21,11 @@ fun NavGraphBuilder.postListGraph(
navigateToPostDetail: (postId: Long) -> Unit,
onAuthExpired: () -> Unit,
) {
composable(POST_LIST_ROUTE) {
composable(
route = POST_LIST_ROUTE,
enterTransition = { EnterTransition.None },
exitTransition = { ExitTransition.None },
) {
val deletedId = it.savedStateHandle.get<Long>(POST_LIST_DELETED_POST_ID_ARGUMENT)
val viewModel: PostListViewModel = hiltViewModel()
deletedId?.let { id ->
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
package com.withpeace.withpeace.feature.privacypolicy.navigation

import androidx.compose.animation.AnimatedContentTransitionScope
import androidx.compose.animation.core.tween
import androidx.navigation.NavController
import androidx.navigation.NavGraphBuilder
import androidx.navigation.NavOptions
Expand All @@ -15,7 +17,21 @@ fun NavGraphBuilder.privacyPolicyGraph(
onShowSnackBar: (String) -> Unit,
onClickBackButton: () -> Unit,
) {
composable(PRIVACY_POLICY_ROUTE) {
composable(
route = PRIVACY_POLICY_ROUTE,
enterTransition = {
slideIntoContainer(
AnimatedContentTransitionScope.SlideDirection.Left,
animationSpec = tween(500),
)
},
exitTransition = {
slideOutOfContainer(
AnimatedContentTransitionScope.SlideDirection.Right,
animationSpec = tween(500),
)
},
) {
PrivacyPolicyRoute(
onShowSnackBar = onShowSnackBar,
onClickBackButton = onClickBackButton,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -142,6 +142,7 @@ fun ProfileEditorScreen(
verticalArrangement = Arrangement.SpaceBetween,
modifier = modifier
.fillMaxSize()
.background(WithpeaceTheme.colors.SystemWhite)
.verticalScroll(rememberScrollState())
.padding(top = 0.dp),
) {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
package com.app.profileeditor.navigation

import androidx.compose.animation.AnimatedContentTransitionScope
import androidx.compose.animation.core.tween
import androidx.hilt.navigation.compose.hiltViewModel
import androidx.navigation.NavController
import androidx.navigation.NavGraphBuilder
Expand Down Expand Up @@ -41,6 +43,18 @@ fun NavGraphBuilder.profileEditorNavGraph(
navArgument(PROFILE_NICKNAME_ARGUMENT) { type = NavType.StringType },
navArgument(PROFILE_IMAGE_URL_ARGUMENT) { type = NavType.StringType },
),
enterTransition = {
slideIntoContainer(
AnimatedContentTransitionScope.SlideDirection.Left,
animationSpec = tween(500),
)
},
exitTransition = {
slideOutOfContainer(
AnimatedContentTransitionScope.SlideDirection.Right,
animationSpec = tween(500),
)
},
) { entry ->
val selectedImageUri =
entry.savedStateHandle.get<List<String>>(IMAGE_LIST_ARGUMENT) ?: emptyList()
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
package com.withpeace.withpeace.feature.registerpost.navigation

import androidx.compose.animation.AnimatedContentTransitionScope
import androidx.compose.animation.core.tween
import androidx.hilt.navigation.compose.hiltViewModel
import androidx.navigation.NavController
import androidx.navigation.NavGraphBuilder
Expand All @@ -25,7 +27,21 @@ fun NavGraphBuilder.registerPostNavGraph(
originPost: RegisterPostUiModel?,
onAuthExpired: () -> Unit,
) {
composable(route = REGISTER_POST_ROUTE) { entry ->
composable(
route = REGISTER_POST_ROUTE,
enterTransition = {
slideIntoContainer(
AnimatedContentTransitionScope.SlideDirection.Up,
animationSpec = tween(500),
)
},
exitTransition = {
slideOutOfContainer(
AnimatedContentTransitionScope.SlideDirection.Down,
animationSpec = tween(500),
)
},
) { entry ->
val viewModel: RegisterPostViewModel = hiltViewModel()

viewModel.initRegisterPost(originPost)
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
package com.withpeace.withpeace.feature.signup.navigation

import androidx.compose.animation.AnimatedContentTransitionScope
import androidx.compose.animation.core.tween
import androidx.hilt.navigation.compose.hiltViewModel
import androidx.navigation.NavController
import androidx.navigation.NavGraphBuilder
Expand All @@ -20,7 +22,21 @@ fun NavGraphBuilder.signUpNavGraph(
onNavigateToGallery: () -> Unit,
onSignUpSuccess: () -> Unit,
) {
composable(route = SIGN_UP_ROUTE) { entry ->
composable(
route = SIGN_UP_ROUTE,
enterTransition = {
slideIntoContainer(
AnimatedContentTransitionScope.SlideDirection.Left,
animationSpec = tween(500),
)
},
exitTransition = {
slideOutOfContainer(
AnimatedContentTransitionScope.SlideDirection.Right,
animationSpec = tween(500),
)
},
) { entry ->
val selectedImageUri =
entry.savedStateHandle.get<List<String>>(IMAGE_LIST_ARGUMENT) ?: emptyList()
val viewModel: SignUpViewModel = hiltViewModel()
Expand Down
Loading

0 comments on commit 4ef1bd0

Please sign in to comment.