-
Notifications
You must be signed in to change notification settings - Fork 3
[FEAT] 네비게이션 연결 기초 세팅 완료 #57
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
Changes from all commits
7346140
f0b61fe
d3519c6
050f59f
47a7660
843327c
f77ea31
1fae915
ab8640f
fb21d79
caa86c9
53b0e58
cc9c701
e35062d
e4b4a28
d6ffedd
b16c04b
c4b2c8d
dd15818
14d5b7b
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change | ||||||
|---|---|---|---|---|---|---|---|---|
|
|
@@ -15,33 +15,31 @@ import androidx.compose.runtime.collectAsState | |||||||
| import androidx.compose.runtime.getValue | ||||||||
| import androidx.compose.runtime.mutableStateOf | ||||||||
| import androidx.compose.runtime.remember | ||||||||
| import androidx.compose.runtime.setValue | ||||||||
| import androidx.compose.ui.Modifier | ||||||||
| import androidx.compose.ui.res.painterResource | ||||||||
| import androidx.compose.ui.tooling.preview.Preview | ||||||||
| import androidx.compose.ui.unit.dp | ||||||||
| import androidx.lifecycle.viewmodel.compose.viewModel | ||||||||
| import androidx.navigation.NavHostController | ||||||||
| import com.texthip.thip.R | ||||||||
| import com.texthip.thip.ui.common.buttons.FloatingButton | ||||||||
| import com.texthip.thip.ui.common.topappbar.LogoTopAppBar | ||||||||
| import com.texthip.thip.ui.group.myroom.component.GroupMySectionHeader | ||||||||
| import com.texthip.thip.ui.group.myroom.component.GroupPager | ||||||||
| import com.texthip.thip.ui.group.myroom.component.GroupRoomDeadlineSection | ||||||||
| import com.texthip.thip.ui.group.myroom.component.GroupSearchTextField | ||||||||
| import com.texthip.thip.ui.group.myroom.mock.GroupViewModel | ||||||||
| import com.texthip.thip.ui.group.viewmodel.GroupViewModel | ||||||||
| import com.texthip.thip.ui.theme.ThipTheme | ||||||||
| import com.texthip.thip.ui.theme.ThipTheme.colors | ||||||||
|
|
||||||||
| @Composable | ||||||||
| fun GroupScreen( | ||||||||
| navController: NavHostController? = null, | ||||||||
| onNavigateToMakeRoom: () -> Unit = {}, | ||||||||
| viewModel: GroupViewModel = viewModel() | ||||||||
| ) { | ||||||||
| val myGroups by viewModel.myGroups.collectAsState() | ||||||||
| val roomSections by viewModel.roomSections.collectAsState() | ||||||||
| val scrollState = rememberScrollState() | ||||||||
| var searchText by remember { mutableStateOf("") } | ||||||||
| val searchText by remember { mutableStateOf("") } | ||||||||
|
||||||||
| val searchText by remember { mutableStateOf("") } | |
| val searchText = remember { mutableStateOf("") } | |
| val filteredGroups = myGroups.filter { it.name.contains(searchText.value, ignoreCase = true) } |
This file was deleted.
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -17,17 +17,25 @@ import androidx.compose.runtime.Composable | |
| import androidx.compose.ui.Alignment | ||
| import androidx.compose.ui.Modifier | ||
| import androidx.compose.ui.draw.clip | ||
| import androidx.compose.ui.draw.drawBehind | ||
| import androidx.compose.ui.graphics.Color | ||
| import androidx.compose.ui.graphics.Path | ||
| import androidx.compose.ui.graphics.drawscope.Stroke | ||
| import androidx.compose.ui.res.painterResource | ||
| import androidx.compose.ui.res.stringResource | ||
| import androidx.compose.ui.unit.dp | ||
| import androidx.navigation.NavController | ||
| import androidx.navigation.NavHostController | ||
| import androidx.navigation.compose.currentBackStackEntryAsState | ||
| import com.texthip.thip.ui.navigator.data.NavBarItems | ||
| import com.texthip.thip.ui.navigator.extensions.navigateToTab | ||
| import com.texthip.thip.ui.navigator.extensions.isRoute | ||
| import com.texthip.thip.ui.theme.ThipTheme.colors | ||
| import com.texthip.thip.ui.theme.ThipTheme.typography | ||
|
|
||
| @Composable | ||
| fun BottomNavigationBar(navController: NavController) { | ||
| val currentRoute = navController.currentBackStackEntryAsState().value?.destination?.route | ||
| fun BottomNavigationBar(navController: NavHostController) { | ||
| val currentDestination = navController.currentBackStackEntryAsState().value?.destination | ||
| val greyColor = colors.Grey02 | ||
|
|
||
| Box( | ||
| modifier = Modifier | ||
|
|
@@ -41,9 +49,48 @@ fun BottomNavigationBar(navController: NavController) { | |
| bottomEnd = 0.dp | ||
| ) | ||
| ) | ||
| .background(colors.Black), | ||
| .background(colors.Black) | ||
| .drawBehind { | ||
| val cornerRadius = 12.dp.toPx() | ||
| val strokeWidth = 2.dp.toPx() | ||
|
|
||
| val path = Path().apply { | ||
|
||
| // 좌상단 모서리부터 시작 | ||
| moveTo(0f, cornerRadius) | ||
| arcTo( | ||
| rect = androidx.compose.ui.geometry.Rect( | ||
| left = 0f, | ||
| top = 0f, | ||
| right = cornerRadius * 2, | ||
| bottom = cornerRadius * 2 | ||
| ), | ||
| startAngleDegrees = 180f, | ||
| sweepAngleDegrees = 90f, | ||
| forceMoveTo = false | ||
| ) | ||
| lineTo(size.width - cornerRadius, 0f) | ||
| arcTo( | ||
| rect = androidx.compose.ui.geometry.Rect( | ||
| left = size.width - cornerRadius * 2, | ||
| top = 0f, | ||
| right = size.width, | ||
| bottom = cornerRadius * 2 | ||
| ), | ||
| startAngleDegrees = 270f, | ||
| sweepAngleDegrees = 90f, | ||
| forceMoveTo = false | ||
| ) | ||
| } | ||
|
|
||
| drawPath( | ||
| path = path, | ||
| color = greyColor, | ||
| style = Stroke(width = strokeWidth) | ||
| ) | ||
| }, | ||
| contentAlignment = Alignment.Center | ||
| ) { | ||
|
|
||
| Row( | ||
| modifier = Modifier | ||
| .fillMaxSize() | ||
|
|
@@ -52,39 +99,32 @@ fun BottomNavigationBar(navController: NavController) { | |
| verticalAlignment = Alignment.CenterVertically | ||
| ) { | ||
| NavBarItems.BarItems.forEach { item -> | ||
| val isSelected = currentRoute == item.route | ||
| val isSelected = currentDestination?.isRoute(item.route) == true | ||
| NavigationBarItem( | ||
| icon = { | ||
| Icon( | ||
| painter = painterResource(id = if (isSelected) item.SelectedIconRes else item.IconRes), | ||
| contentDescription = item.title, | ||
| painter = painterResource(id = if (isSelected) item.selectedIconRes else item.iconRes), | ||
| contentDescription = stringResource(item.titleRes), | ||
| ) | ||
| }, | ||
| label = { | ||
| Text( | ||
| text = item.title, | ||
| text = stringResource(item.titleRes), | ||
| style = typography.navi_m500_s10 | ||
| ) | ||
| }, | ||
| selected = isSelected, | ||
| onClick = { | ||
| if (!isSelected) { | ||
| navController.navigate(item.route) { | ||
| popUpTo(navController.graph.startDestinationId) { | ||
| saveState = true | ||
| } | ||
| launchSingleTop = true | ||
| restoreState = true | ||
| } | ||
| navController.navigateToTab(item.route) | ||
| } | ||
| }, | ||
|
|
||
| colors = NavigationBarItemDefaults.colors( | ||
| indicatorColor = Color.Transparent, | ||
| selectedIconColor = colors.Purple, | ||
| unselectedIconColor = Color.Unspecified, | ||
| unselectedIconColor = colors.Grey02, | ||
| selectedTextColor = colors.Purple, | ||
| unselectedTextColor = Color.Unspecified | ||
| unselectedTextColor = colors.Grey02 | ||
| ) | ||
| ) | ||
| } | ||
|
|
||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Production code should not have Mock implementations as default parameters. Consider using dependency injection or factory patterns to provide the appropriate repository implementation based on the environment.