From d869ca993cf347a27d34c507a619617228ade648 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=EA=B9=80=EC=A7=84=EC=9A=B0?= <85734140+jinuemong@users.noreply.github.com> Date: Wed, 21 Feb 2024 09:56:56 +0900 Subject: [PATCH] =?UTF-8?q?[Feat]:=20=EA=B2=BD=EC=A1=B0=EC=82=AC=EB=B9=84?= =?UTF-8?q?=20=EB=A9=94=EC=9D=B8=20=EB=94=94=EC=9E=90=EC=9D=B8=20QA=20(#10?= =?UTF-8?q?9)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../presentation/common/view/chip/ChipItem.kt | 4 +- .../history/HistoryBackgroundComponent.kt | 17 +- .../ui/main/home/history/HistoryPageScreen.kt | 11 +- .../ui/main/home/history/HistoryScreen.kt | 236 +++++++++--------- .../src/main/res/drawable/ic_alarm_white.xml | 13 + .../res/drawable/ic_chevron_right_gray.xml | 13 + .../drawable/ic_close_circle_inner_gray.xml | 23 ++ .../main/res/drawable/ic_close_rounded.xml | 20 ++ .../main/res/drawable/ic_history_check.xml | 13 + 9 files changed, 216 insertions(+), 134 deletions(-) create mode 100644 presentation/src/main/res/drawable/ic_alarm_white.xml create mode 100644 presentation/src/main/res/drawable/ic_chevron_right_gray.xml create mode 100644 presentation/src/main/res/drawable/ic_close_circle_inner_gray.xml create mode 100644 presentation/src/main/res/drawable/ic_close_rounded.xml create mode 100644 presentation/src/main/res/drawable/ic_history_check.xml diff --git a/presentation/src/main/kotlin/ac/dnd/mour/android/presentation/common/view/chip/ChipItem.kt b/presentation/src/main/kotlin/ac/dnd/mour/android/presentation/common/view/chip/ChipItem.kt index cbabd627..986f4f50 100644 --- a/presentation/src/main/kotlin/ac/dnd/mour/android/presentation/common/view/chip/ChipItem.kt +++ b/presentation/src/main/kotlin/ac/dnd/mour/android/presentation/common/view/chip/ChipItem.kt @@ -24,6 +24,7 @@ import androidx.compose.ui.Alignment import androidx.compose.ui.Modifier import androidx.compose.ui.draw.clip import androidx.compose.ui.graphics.Color +import androidx.compose.ui.text.font.FontWeight import androidx.compose.ui.tooling.preview.Preview import androidx.compose.ui.unit.dp @@ -84,7 +85,8 @@ fun ChipItem( Text( text = chipText, style = Body1.merge( - color = textColor.value + color = textColor.value, + fontWeight = if (isSelected) FontWeight.SemiBold else FontWeight.Normal ) ) if (chipCount > 0) { diff --git a/presentation/src/main/kotlin/ac/dnd/mour/android/presentation/ui/main/home/history/HistoryBackgroundComponent.kt b/presentation/src/main/kotlin/ac/dnd/mour/android/presentation/ui/main/home/history/HistoryBackgroundComponent.kt index 6f470425..faffd639 100644 --- a/presentation/src/main/kotlin/ac/dnd/mour/android/presentation/ui/main/home/history/HistoryBackgroundComponent.kt +++ b/presentation/src/main/kotlin/ac/dnd/mour/android/presentation/ui/main/home/history/HistoryBackgroundComponent.kt @@ -7,6 +7,7 @@ import ac.dnd.mour.android.presentation.R import ac.dnd.mour.android.presentation.common.theme.Body1 import ac.dnd.mour.android.presentation.common.theme.Gray000 import ac.dnd.mour.android.presentation.common.theme.Gray500 +import ac.dnd.mour.android.presentation.common.theme.Gray600 import ac.dnd.mour.android.presentation.common.theme.Gray700 import ac.dnd.mour.android.presentation.common.theme.Headline1 import ac.dnd.mour.android.presentation.common.theme.Primary2 @@ -64,7 +65,7 @@ fun HistoryBackgroundComponent( isTextFieldFocused: Boolean, isViewUnrecordedState: Boolean, onFocusChange: (Boolean) -> Unit, - alarmState: Boolean = true, + alarmState: Boolean = false, onClickUnrecorded: () -> Unit, onDeleteUnrecorded: () -> Unit, onClickAlarm: () -> Unit, @@ -83,11 +84,6 @@ fun HistoryBackgroundComponent( label = "color state" ) - @Composable - fun getAlarmImage(): Painter { - return painterResource(if (alarmState) R.drawable.ic_notification_on else R.drawable.ic_notification) - } - Column( modifier = Modifier .fillMaxWidth() @@ -105,7 +101,7 @@ fun HistoryBackgroundComponent( modifier = Modifier.align(Alignment.CenterStart) ) Image( - painter = getAlarmImage(), + painter = painterResource(R.drawable.ic_alarm_white), contentDescription = null, modifier = Modifier .align(Alignment.CenterEnd) @@ -206,7 +202,7 @@ fun HistoryBackgroundComponent( .padding(16.dp) ) { Image( - painter = painterResource(R.drawable.ic_close_circle), + painter = painterResource(R.drawable.ic_close_circle_inner_gray), contentDescription = null, modifier = Modifier .align(Alignment.TopEnd) @@ -242,14 +238,13 @@ fun HistoryBackgroundComponent( Text( text = "한번에 기록하기", style = Body1.merge( - color = Gray500, + color = Gray600, fontWeight = FontWeight.Medium ) ) Image( - painter = painterResource(R.drawable.ic_chevron_right), + painter = painterResource(R.drawable.ic_chevron_right_gray), contentDescription = null, - modifier = Modifier.size(16.dp) ) } } diff --git a/presentation/src/main/kotlin/ac/dnd/mour/android/presentation/ui/main/home/history/HistoryPageScreen.kt b/presentation/src/main/kotlin/ac/dnd/mour/android/presentation/ui/main/home/history/HistoryPageScreen.kt index 39688b27..bc5359f0 100644 --- a/presentation/src/main/kotlin/ac/dnd/mour/android/presentation/ui/main/home/history/HistoryPageScreen.kt +++ b/presentation/src/main/kotlin/ac/dnd/mour/android/presentation/ui/main/home/history/HistoryPageScreen.kt @@ -9,6 +9,7 @@ import ac.dnd.mour.android.presentation.common.theme.Gray400 import ac.dnd.mour.android.presentation.common.theme.Gray500 import ac.dnd.mour.android.presentation.common.theme.Gray600 import ac.dnd.mour.android.presentation.common.theme.Gray700 +import ac.dnd.mour.android.presentation.common.theme.Gray800 import ac.dnd.mour.android.presentation.common.theme.Primary4 import ac.dnd.mour.android.presentation.common.theme.Shapes import ac.dnd.mour.android.presentation.common.theme.Space16 @@ -177,7 +178,7 @@ fun HistoryPageScreen( Text( text = "내역 ${relations.size}", style = Body1.merge( - color = Gray600, + color = Gray700, fontWeight = FontWeight.SemiBold ), modifier = Modifier.align(Alignment.CenterStart) @@ -193,7 +194,7 @@ fun HistoryPageScreen( Text( text = viewSortType.typeName, style = Body1.merge( - color = Gray700, + color = Gray800, fontWeight = FontWeight.Medium ) ) @@ -220,7 +221,7 @@ fun HistoryPageScreen( contentPadding = PaddingValues(0.dp), modifier = Modifier .width(116.dp) - .height(40.dp) + .wrapContentHeight() ) { Row( modifier = Modifier @@ -233,10 +234,8 @@ fun HistoryPageScreen( ) { if (viewSortType == type) { Image( - painter = painterResource(R.drawable.ic_check_line), + painter = painterResource(R.drawable.ic_history_check), contentDescription = null, - colorFilter = ColorFilter.tint(Primary4), - modifier = Modifier.size(Space24) ) } else { Box( diff --git a/presentation/src/main/kotlin/ac/dnd/mour/android/presentation/ui/main/home/history/HistoryScreen.kt b/presentation/src/main/kotlin/ac/dnd/mour/android/presentation/ui/main/home/history/HistoryScreen.kt index 835dd907..1ef3251a 100644 --- a/presentation/src/main/kotlin/ac/dnd/mour/android/presentation/ui/main/home/history/HistoryScreen.kt +++ b/presentation/src/main/kotlin/ac/dnd/mour/android/presentation/ui/main/home/history/HistoryScreen.kt @@ -29,6 +29,7 @@ import ac.dnd.mour.android.presentation.common.view.textfield.TypingTextFieldTyp import ac.dnd.mour.android.presentation.model.history.HistoryViewSwipingType import ac.dnd.mour.android.presentation.model.history.HistoryViewType import ac.dnd.mour.android.presentation.ui.main.ApplicationState +import ac.dnd.mour.android.presentation.ui.main.home.common.notification.NotificationConstant import ac.dnd.mour.android.presentation.ui.main.home.common.relation.RelationConstant import ac.dnd.mour.android.presentation.ui.main.home.history.registration.HistoryRegistrationConstant import ac.dnd.mour.android.presentation.ui.main.home.history.unrecorded.HistoryUnrecordedConstant @@ -49,9 +50,11 @@ import androidx.compose.foundation.layout.Column import androidx.compose.foundation.layout.PaddingValues import androidx.compose.foundation.layout.Row import androidx.compose.foundation.layout.Spacer +import androidx.compose.foundation.layout.fillMaxHeight import androidx.compose.foundation.layout.fillMaxSize import androidx.compose.foundation.layout.fillMaxWidth import androidx.compose.foundation.layout.height +import androidx.compose.foundation.layout.offset import androidx.compose.foundation.layout.padding import androidx.compose.foundation.layout.size import androidx.compose.foundation.layout.width @@ -80,6 +83,7 @@ import androidx.compose.runtime.rememberCoroutineScope import androidx.compose.runtime.setValue import androidx.compose.ui.Alignment import androidx.compose.ui.Modifier +import androidx.compose.ui.draw.clip import androidx.compose.ui.geometry.Offset import androidx.compose.ui.graphics.Color import androidx.compose.ui.graphics.ColorFilter @@ -149,6 +153,7 @@ private fun HistoryScreen( ) { var isPlayingLoading by remember { mutableStateOf(true) } + var isDropDownMenuExpanded by remember { mutableStateOf(false) } isPlayingLoading = when (model.state) { HistoryState.Init -> false @@ -220,6 +225,10 @@ private fun HistoryScreen( appState.navController.navigate(HistoryUnrecordedConstant.ROUTE) } + fun navigateToNotification() { + appState.navController.navigate(NotificationConstant.ROUTE) + } + fun navigateToAddRelation() { appState.navController.navigate(RelationConstant.ROUTE) } @@ -256,7 +265,7 @@ private fun HistoryScreen( isPlayingLoading = isPlayingLoading, model = model, onClickAlarm = { - + navigateToNotification() }, isTextFieldFocused = isTextFieldFocused, isViewUnrecordedState = isViewUnrecordedState, @@ -420,6 +429,7 @@ private fun HistoryScreen( topEnd = 16.dp ) ) + .fillMaxHeight() .padding(horizontal = 20.dp), divider = { Box( @@ -441,7 +451,7 @@ private fun HistoryScreen( Text( text = pageText, style = Headline3.merge( - color = if (index == pagerState.currentPage) Primary4 else Gray500, + color = if (index == pagerState.currentPage) Primary4 else Gray600, fontWeight = FontWeight.SemiBold ) ) @@ -468,8 +478,113 @@ private fun HistoryScreen( } } } + } + + if (isDropDownMenuExpanded) { + val isNotEmptyRelation = model.groups.isNotEmpty() - var isDropDownMenuExpanded by remember { mutableStateOf(false) } + Box( + modifier = Modifier + .fillMaxSize() + .clickable { + isDropDownMenuExpanded = false + } + .background(Color(0x66313131)) + ) { + Row( + modifier = Modifier + .align(Alignment.BottomEnd) + .offset( + x = (-14).dp, + y = (-152).dp + ) + .clip(RoundedCornerShape(100.dp)) + .clickable { + isDropDownMenuExpanded = false + if (isNotEmptyRelation) { + isDropDownMenuExpanded = false + navigateToAddHeart() + } + } + .border( + width = 1.dp, + shape = RoundedCornerShape(100.dp), + color = if (isNotEmptyRelation) Gray300 else Gray500 + ) + .background( + color = if (isNotEmptyRelation) Gray000 else Gray500, + shape = RoundedCornerShape(100.dp) + ) + .padding( + horizontal = 16.dp, + vertical = 12.dp + ), + verticalAlignment = Alignment.CenterVertically, + horizontalArrangement = Arrangement.Center, + ) { + val iconResource = + if (isNotEmptyRelation) R.drawable.ic_gift_activate else R.drawable.ic_gift_disabled + Image( + painter = painterResource(iconResource), + contentDescription = null, + ) + Spacer(modifier = Modifier.width(6.dp)) + Text( + text = "마음 등록", + style = Headline3.merge( + color = if (isNotEmptyRelation) Primary3 else Gray600, + fontWeight = FontWeight.SemiBold + ) + ) + } + + Row( + modifier = Modifier + .align(Alignment.BottomEnd) + .offset( + x = (-14).dp, + y = (-92).dp + ) + .clickable { + isDropDownMenuExpanded = false + navigateToAddRelation() + } + .border( + width = 1.dp, + shape = RoundedCornerShape(100.dp), + color = Gray300 + ) + .background( + color = Gray000, + shape = RoundedCornerShape(100.dp) + ) + .clip(RoundedCornerShape(100.dp)) + .padding( + horizontal = 16.dp, + vertical = 12.dp + ), + verticalAlignment = Alignment.CenterVertically, + horizontalArrangement = Arrangement.Center, + ) { + Image( + painter = painterResource(R.drawable.ic_person), + colorFilter = ColorFilter.tint(Secondary5), + modifier = Modifier.size(24.dp), + contentDescription = null, + ) + Spacer(modifier = Modifier.width(6.dp)) + Text( + text = "관계 등록", + style = Headline3.merge( + color = Secondary6, + fontWeight = FontWeight.SemiBold + ) + ) + } + } + } + + Box(modifier = Modifier.fillMaxSize()) { FloatingActionButton( modifier = Modifier .padding(bottom = 24.dp, end = 20.dp) @@ -477,13 +592,13 @@ private fun HistoryScreen( .align(Alignment.BottomEnd), backgroundColor = if (isDropDownMenuExpanded) Gray000 else Gray800, onClick = { - isDropDownMenuExpanded = true + isDropDownMenuExpanded = !isDropDownMenuExpanded } ) { if (isDropDownMenuExpanded) { Icon( modifier = Modifier.size(32.dp), - painter = painterResource(id = R.drawable.ic_close), + painter = painterResource(id = R.drawable.ic_close_rounded), contentDescription = null, tint = Gray800 ) @@ -495,117 +610,6 @@ private fun HistoryScreen( tint = Gray000 ) } - - val isNotEmptyRelation = model.groups.isNotEmpty() - - MaterialTheme(shapes = MaterialTheme.shapes.copy(medium = RoundedCornerShape(100.dp))) { - DropdownMenu( - modifier = Modifier - .border( - width = 1.dp, - shape = RoundedCornerShape(100.dp), - color = if (isNotEmptyRelation) Gray300 else Gray500 - ) - .background( - color = if (isNotEmptyRelation) Gray000 else Gray500, - shape = RoundedCornerShape(100.dp) - ) - .width(120.dp) - .height(48.dp), - onDismissRequest = { - isDropDownMenuExpanded = false - }, - offset = DpOffset(y = 76.dp, x = 0.dp), - expanded = isDropDownMenuExpanded - ) { - DropdownMenuItem( - contentPadding = PaddingValues(bottom = 12.dp), - onClick = { - if (isNotEmptyRelation) { - isDropDownMenuExpanded = false - navigateToAddHeart() - } - }, - modifier = Modifier.height(48.dp) - ) { - Row( - modifier = Modifier.fillMaxSize(), - verticalAlignment = Alignment.CenterVertically, - horizontalArrangement = Arrangement.Center, - ) { - val iconResource = - if (isNotEmptyRelation) R.drawable.ic_gift_activate else R.drawable.ic_gift_disabled - Image( - painter = painterResource(iconResource), - contentDescription = null, - ) - Spacer(modifier = Modifier.width(6.dp)) - Text( - text = "마음 등록", - style = Headline3.merge( - color = if (isNotEmptyRelation) Primary3 else Gray600, - fontWeight = FontWeight.SemiBold - ) - ) - } - } - } - } - - MaterialTheme(shapes = MaterialTheme.shapes.copy(medium = RoundedCornerShape(100.dp))) { - DropdownMenu( - modifier = Modifier - .border( - width = 1.dp, - shape = RoundedCornerShape(100.dp), - color = Gray300 - ) - .background( - color = Gray000, - shape = RoundedCornerShape(100.dp) - ) - .width(120.dp) - .height(48.dp), - onDismissRequest = { - isDropDownMenuExpanded = false - }, - properties = PopupProperties( - dismissOnClickOutside = false - ), - offset = DpOffset(y = 16.dp, x = 0.dp), - expanded = isDropDownMenuExpanded - ) { - DropdownMenuItem( - contentPadding = PaddingValues(bottom = 12.dp), - onClick = { - isDropDownMenuExpanded = false - navigateToAddRelation() - }, - modifier = Modifier.height(48.dp) - ) { - Row( - modifier = Modifier.fillMaxSize(), - verticalAlignment = Alignment.CenterVertically, - horizontalArrangement = Arrangement.Center, - ) { - Image( - painter = painterResource(R.drawable.ic_person), - colorFilter = ColorFilter.tint(Secondary5), - modifier = Modifier.size(24.dp), - contentDescription = null, - ) - Spacer(modifier = Modifier.width(6.dp)) - Text( - text = "관계 등록", - style = Headline3.merge( - color = Secondary6, - fontWeight = FontWeight.SemiBold - ) - ) - } - } - } - } } } } diff --git a/presentation/src/main/res/drawable/ic_alarm_white.xml b/presentation/src/main/res/drawable/ic_alarm_white.xml new file mode 100644 index 00000000..aa8c60d9 --- /dev/null +++ b/presentation/src/main/res/drawable/ic_alarm_white.xml @@ -0,0 +1,13 @@ + + + diff --git a/presentation/src/main/res/drawable/ic_chevron_right_gray.xml b/presentation/src/main/res/drawable/ic_chevron_right_gray.xml new file mode 100644 index 00000000..3407e5e7 --- /dev/null +++ b/presentation/src/main/res/drawable/ic_chevron_right_gray.xml @@ -0,0 +1,13 @@ + + + diff --git a/presentation/src/main/res/drawable/ic_close_circle_inner_gray.xml b/presentation/src/main/res/drawable/ic_close_circle_inner_gray.xml new file mode 100644 index 00000000..526c9736 --- /dev/null +++ b/presentation/src/main/res/drawable/ic_close_circle_inner_gray.xml @@ -0,0 +1,23 @@ + + + + + diff --git a/presentation/src/main/res/drawable/ic_close_rounded.xml b/presentation/src/main/res/drawable/ic_close_rounded.xml new file mode 100644 index 00000000..14113fdb --- /dev/null +++ b/presentation/src/main/res/drawable/ic_close_rounded.xml @@ -0,0 +1,20 @@ + + + + diff --git a/presentation/src/main/res/drawable/ic_history_check.xml b/presentation/src/main/res/drawable/ic_history_check.xml new file mode 100644 index 00000000..f4ba274e --- /dev/null +++ b/presentation/src/main/res/drawable/ic_history_check.xml @@ -0,0 +1,13 @@ + + +