Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[FIX/#50] 홈화면 QA 해결 #51

Merged
merged 7 commits into from
Nov 29, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
package com.sopt.shinmungo.presentation.allcategory.navigation

import androidx.compose.animation.EnterTransition
import androidx.compose.animation.ExitTransition
import androidx.compose.ui.Modifier
import androidx.navigation.NavGraphBuilder
import androidx.navigation.NavHostController
Expand All @@ -20,7 +22,20 @@ fun NavGraphBuilder.allCategoryScreen(
navController: NavHostController,
modifier: Modifier = Modifier
) {
composable<AllCategory> {
composable<AllCategory>(
exitTransition = {
ExitTransition.None
},
popEnterTransition = {
EnterTransition.None
},
enterTransition = {
EnterTransition.None
},
popExitTransition = {
ExitTransition.None
}
) {
AllCategoryScreen(
onNavigateBack = navController::navigateUp,
onNavigateToReport = { navController.navigateToReport() }, // ReportScreen으로 이동
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -37,8 +37,10 @@ private const val EMPTY_DESCRIPTION = ""
@Preview(showBackground = true)
@Composable
private fun BannerIconButtonPreview() {
BannerIconButton(
imageVector = ImageVector.vectorResource(R.drawable.ic_arrow_right_24),
onClick = {}
)
ShinMunGoTheme {
BannerIconButton(
imageVector = ImageVector.vectorResource(R.drawable.ic_arrow_right_24),
onClick = {}
)
}
}
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
package com.sopt.shinmungo.presentation.home.navigation

import androidx.compose.animation.EnterTransition
import androidx.compose.animation.ExitTransition
import androidx.compose.ui.Modifier
import androidx.navigation.NavGraphBuilder
import androidx.navigation.NavHostController
Expand All @@ -11,13 +13,28 @@ import com.sopt.shinmungo.presentation.home.HomeRoute
import com.sopt.shinmungo.presentation.report.navigation.navigateToReport
import kotlinx.serialization.Serializable

fun NavHostController.navigateToHome(navOptions: NavOptions? = null) = navigate(Home)
fun NavHostController.navigateToHome(navOptions: NavOptions? = null) =
navigate(route = Home, navOptions = navOptions)

fun NavGraphBuilder.homeScreen(
navController: NavHostController,
modifier: Modifier = Modifier
) {
composable<Home> {
composable<Home>(
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

애니메이션 삭제해서 문제를 해결한건가요??

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

그 부분은 메인화면에서 바텀바로 화면 전환할 때 fade 효과가 싫어서 없앤거에요!
QA 건이 아니라 그냥 제 개인적인 욕심에 의해 적용한겁니다ㅎㅎ

exitTransition = {
ExitTransition.None
},
popEnterTransition = {
EnterTransition.None
},
enterTransition = {
EnterTransition.None
},
popExitTransition = {
ExitTransition.None
}
) {

HomeRoute(
modifier = modifier,
navigateToCategory = navController::navigateToAllCategory,
Expand All @@ -27,4 +44,4 @@ fun NavGraphBuilder.homeScreen(
}

@Serializable
data object Home: MainTabRoute
data object Home : MainTabRoute
Original file line number Diff line number Diff line change
Expand Up @@ -35,9 +35,11 @@ class MainNavigator(

fun navigate(tab: MainTab) {
val mainNavOption = navOptions {
popUpTo(navController.graph.startDestinationId) {
saveState = true
inclusive = true
navController.currentDestination?.route?.let {
popUpTo(it) {
saveState = true
inclusive = true
}
}
launchSingleTop = true
restoreState = true
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,10 @@
package com.sopt.shinmungo.presentation.main.component

import androidx.compose.animation.AnimatedVisibility
import androidx.compose.animation.fadeIn
import androidx.compose.animation.fadeOut
import androidx.compose.animation.slideIn
import androidx.compose.animation.slideOut
import androidx.compose.foundation.background
import androidx.compose.foundation.layout.Arrangement
import androidx.compose.foundation.layout.Box
Expand All @@ -24,10 +29,10 @@ import androidx.compose.ui.graphics.vector.ImageVector
import androidx.compose.ui.res.stringResource
import androidx.compose.ui.res.vectorResource
import androidx.compose.ui.tooling.preview.Preview
import androidx.compose.ui.unit.IntOffset
import androidx.compose.ui.unit.dp
import com.sopt.shinmungo.core.designsystem.theme.ShinMunGoTheme
import com.sopt.shinmungo.core.extension.noRippleClickable
import com.sopt.shinmungo.core.extension.showIf
import com.sopt.shinmungo.presentation.main.MainTab

/**
Expand All @@ -54,38 +59,44 @@ fun MainBottomBars(
selectedColor: Color = ShinMunGoTheme.color.primary,
unselectedColor: Color = ShinMunGoTheme.color.gray6,
) {
Card(
elevation = CardDefaults.elevatedCardElevation(defaultElevation = 10.dp),
shape = RectangleShape,
modifier = Modifier.showIf(visibility)
AnimatedVisibility(
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Animation은 어렵다,,

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

그냥 if문 쓰면 바텀바가 깜박이는게 안없어지더라구요,,
저도 애니메이션이 익숙하진 않아서 좀더 알아봐야겠어요,,

visible = visibility,
enter = fadeIn() + slideIn { IntOffset(0, 0) },
exit = fadeOut() + slideOut { IntOffset(0, 0) }
) {
Row(
Card(
elevation = CardDefaults.elevatedCardElevation(defaultElevation = 10.dp),
shape = RectangleShape,
modifier = modifier
.fillMaxWidth()
.background(color = containerColor)
.navigationBarsPadding()
.padding(start = 37.dp, end = 37.dp, top = 8.dp, bottom = 31.dp),
horizontalArrangement = Arrangement.SpaceBetween
) {
tabs.forEach { tab ->
val selected = tab == selectedTab
val color = if (selected) selectedColor else unselectedColor
val icon = if (selected) tab.selectedIconRes else tab.unselectedIconRes
Column(
modifier = Modifier.noRippleClickable { onTabSelect(tab) },
horizontalAlignment = Alignment.CenterHorizontally
) {
Icon(
imageVector = ImageVector.vectorResource(id = icon),
contentDescription = stringResource(id = tab.title),
tint = color
)
Spacer(modifier = Modifier.height(4.dp))
Text(
text = stringResource(id = tab.title),
style = ShinMunGoTheme.typography.caption6,
color = color
)
Row(
modifier = Modifier
.fillMaxWidth()
.background(color = containerColor)
.navigationBarsPadding()
.padding(start = 37.dp, end = 37.dp, top = 8.dp, bottom = 31.dp),
horizontalArrangement = Arrangement.SpaceBetween
) {
tabs.forEach { tab ->
val selected = tab == selectedTab
val color = if (selected) selectedColor else unselectedColor
val icon = if (selected) tab.selectedIconRes else tab.unselectedIconRes
Column(
modifier = Modifier.noRippleClickable { onTabSelect(tab) },
horizontalAlignment = Alignment.CenterHorizontally
) {
Icon(
imageVector = ImageVector.vectorResource(id = icon),
contentDescription = stringResource(id = tab.title),
tint = color
)
Spacer(modifier = Modifier.height(4.dp))
Text(
text = stringResource(id = tab.title),
style = ShinMunGoTheme.typography.caption6,
color = color
)
}
}
}
}
Expand Down
4 changes: 2 additions & 2 deletions app/src/main/res/drawable/ic_home_24.xml
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
<vector xmlns:android="http://schemas.android.com/apk/res/android"
android:width="25dp"
android:width="24dp"
android:height="24dp"
android:viewportWidth="25"
android:viewportWidth="24"
android:viewportHeight="24">
<path
android:pathData="M3,10.938C3,9.714 3.561,8.557 4.521,7.799L10.021,3.457C11.475,2.309 13.525,2.309 14.979,3.457L20.479,7.799C21.439,8.557 22,9.714 22,10.938V17.5C22,19.709 20.209,21.5 18,21.5H16.5C15.948,21.5 15.5,21.052 15.5,20.5V17.5C15.5,16.395 14.605,15.5 13.5,15.5H11.5C10.395,15.5 9.5,16.395 9.5,17.5V20.5C9.5,21.052 9.052,21.5 8.5,21.5H7C4.791,21.5 3,19.709 3,17.5L3,10.938Z"
Expand Down