From 4df66d9c375b3fc5835c76cbc1f16971d74d9bd9 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=EC=B5=9C=ED=98=84=EC=A0=95?= Date: Sun, 29 Jun 2025 05:47:09 +0900 Subject: [PATCH 1/8] fix: Update Tab UI --- .../notification/presentation/NotificationScreen.kt | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/notification/presentation/src/main/java/com/hyunjung/notification/presentation/NotificationScreen.kt b/notification/presentation/src/main/java/com/hyunjung/notification/presentation/NotificationScreen.kt index 3c95b13..6f20e03 100644 --- a/notification/presentation/src/main/java/com/hyunjung/notification/presentation/NotificationScreen.kt +++ b/notification/presentation/src/main/java/com/hyunjung/notification/presentation/NotificationScreen.kt @@ -108,7 +108,12 @@ fun NotificationScreen( .fillMaxWidth() .background(color = CherrydanColors.White) ) { - + HorizontalDivider( + modifier = Modifier + .fillMaxWidth() + .align(Alignment.BottomCenter), + color = CherrydanColors.PointBeige + ) CherrydanFixedTabRow( selectedTabIndex = selectedTabIndex ) { From af853367260c04e3b7ee6f18fd90cfa0a1dcabb5 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=EC=B5=9C=ED=98=84=EC=A0=95?= Date: Sun, 29 Jun 2025 05:47:47 +0900 Subject: [PATCH 2/8] feat: Add item selected --- .../presentation/NotificationScreen.kt | 204 +++++++----------- 1 file changed, 72 insertions(+), 132 deletions(-) diff --git a/notification/presentation/src/main/java/com/hyunjung/notification/presentation/NotificationScreen.kt b/notification/presentation/src/main/java/com/hyunjung/notification/presentation/NotificationScreen.kt index 6f20e03..8162bc0 100644 --- a/notification/presentation/src/main/java/com/hyunjung/notification/presentation/NotificationScreen.kt +++ b/notification/presentation/src/main/java/com/hyunjung/notification/presentation/NotificationScreen.kt @@ -11,23 +11,18 @@ import androidx.compose.foundation.layout.fillMaxSize import androidx.compose.foundation.layout.fillMaxWidth import androidx.compose.foundation.layout.height import androidx.compose.foundation.layout.padding -import androidx.compose.foundation.layout.size -import androidx.compose.foundation.layout.width import androidx.compose.foundation.lazy.LazyColumn -import androidx.compose.foundation.lazy.items -import androidx.compose.foundation.shape.CircleShape +import androidx.compose.foundation.lazy.itemsIndexed import androidx.compose.material3.HorizontalDivider -import androidx.compose.material3.Icon import androidx.compose.material3.Text import androidx.compose.runtime.Composable import androidx.compose.runtime.getValue import androidx.compose.runtime.mutableIntStateOf +import androidx.compose.runtime.mutableStateOf import androidx.compose.runtime.remember 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.graphics.Color import androidx.compose.ui.platform.LocalInspectionMode import androidx.compose.ui.res.stringResource import androidx.compose.ui.text.SpanStyle @@ -35,16 +30,13 @@ import androidx.compose.ui.text.buildAnnotatedString import androidx.compose.ui.text.font.FontWeight import androidx.compose.ui.tooling.preview.Preview import androidx.compose.ui.unit.dp -import androidx.compose.ui.unit.sp -import com.hyunjung.notification.presentation.component.AlertType -import com.hyunjung.auth.presentation.LocalCherrydanContentColor -import com.hyunjung.notification.presentation.component.NotificationActiveToggleItem -import com.hyunjung.notification.presentation.component.NotificationToggleItem +import com.hyunjung.auth.presentation.AlertType +import com.hyunjung.auth.presentation.NotificationActiveToggleItem +import com.hyunjung.auth.presentation.NotificationToggleItem import com.hyunjung.core.presentation.designsystem.BackIcon import com.hyunjung.core.presentation.designsystem.CherrydanColors import com.hyunjung.core.presentation.designsystem.CherrydanTheme import com.hyunjung.core.presentation.designsystem.CherrydanTypography -import com.hyunjung.core.presentation.designsystem.CircleUnselectedIcon import com.hyunjung.core.presentation.designsystem.TrashIcon import com.hyunjung.core.presentation.designsystem.component.CherrydanFixedTabRow import com.hyunjung.core.presentation.designsystem.component.CherrydanTab @@ -57,9 +49,12 @@ fun NotificationScreen( onDeletePressed: () -> Unit = {} ) { var selectedTabIndex by remember { mutableIntStateOf(0) } - val notificationItems = remember { getSampleNotifications() } + var notificationItems by remember { mutableStateOf(getSampleNotifications()) } val isInPreview = LocalInspectionMode.current + val allSelected = notificationItems.all { it.isSelected } + val hasAnySelected = notificationItems.any { it.isSelected } + Column( modifier = Modifier .fillMaxSize() @@ -90,14 +85,14 @@ fun NotificationScreen( TopBarIconButton( imageVector = BackIcon, contentDescription = "Back", - onClick = {} + onClick = onBackPressed ) }, actions = { TopBarIconButton( imageVector = TrashIcon, contentDescription = "Delete", - onClick = {} + onClick = onDeletePressed ) } ) @@ -145,46 +140,50 @@ fun NotificationScreen( } } } - HorizontalDivider( - modifier = Modifier - .fillMaxWidth() - .align(Alignment.BottomCenter), - color = CherrydanColors.PointBeige - ) } Spacer(modifier = Modifier.height(20.dp)) + // 모두선택 / 읽음 처리 행 Row( modifier = Modifier .fillMaxWidth() .height(32.dp) .padding(horizontal = 16.dp), - horizontalArrangement = Arrangement.SpaceBetween, - verticalAlignment = Alignment.CenterVertically, + verticalAlignment = Alignment.CenterVertically ) { - Icon( - imageVector = CircleUnselectedIcon, - contentDescription = "All Select", - tint = LocalCherrydanContentColor.current, - modifier = Modifier - .size(24.dp) - ) - - Spacer(modifier = Modifier.width(2.dp)) - - Text( - text = stringResource(id = com.hyunjung.core.presentation.ui.R.string.notification_all_select), - style = CherrydanTypography.Main4_R, - color = CherrydanColors.Black, - modifier = Modifier.weight(1f) - ) + NotificationToggleItem( + selected = allSelected, + showBadge = false, + onClick = { + // 모두선택 토글 로직 + notificationItems = notificationItems.map { item -> + item.copy(isSelected = !allSelected) + } + }, + showDivider = false, + paddingValues = PaddingValues(0.dp) + ) { + Row( + modifier = Modifier + .fillMaxWidth() + .height(32.dp), + verticalAlignment = Alignment.CenterVertically, + horizontalArrangement = Arrangement.SpaceBetween + ) { + Text( + text = if (isInPreview) "모든 선택" else stringResource(id = com.hyunjung.core.presentation.ui.R.string.notification_all_select), + style = CherrydanTypography.Main4_R, + color = CherrydanColors.Black + ) - Text( - text = stringResource(id = com.hyunjung.core.presentation.ui.R.string.notification_read), - style = CherrydanTypography.Main4_R, - color = CherrydanColors.Black - ) + Text( + text = if (isInPreview) "읽음" else stringResource(id = com.hyunjung.core.presentation.ui.R.string.notification_read), + style = CherrydanTypography.Main4_R, + color = CherrydanColors.Black + ) + } + } } Spacer(modifier = Modifier.height(12.dp)) @@ -196,28 +195,46 @@ fun NotificationScreen( .padding(horizontal = 16.dp), verticalArrangement = Arrangement.spacedBy(0.dp) ) { - items(notificationItems) { item -> + itemsIndexed(notificationItems) { index, item -> if (selectedTabIndex == 0) { // 활동 탭 - // NotificationActiveToggleItem 사용 val annotatedContent = createAnnotatedString(item.content) NotificationActiveToggleItem( alertType = AlertType.VISITED, content = annotatedContent, time = System.currentTimeMillis(), - selected = !item.isRead, + selected = item.isSelected, showBadge = item.hasHighPriority, - onClick = { /* TODO: 알림 클릭 시 동작 */ }, - showDivider = item.id != (notificationItems.lastOrNull()?.id ?: 0), + onClick = { + // 개별 아이템 선택 토글 + notificationItems = + notificationItems.mapIndexed { idx, notificationItem -> + if (idx == index) { + notificationItem.copy(isSelected = !notificationItem.isSelected) + } else { + notificationItem + } + } + }, + showDivider = index != notificationItems.lastIndex, modifier = Modifier.padding(vertical = 4.dp) ) } else { // 맞춤형 탭 - // 일반 NotificationToggleItem 사용 NotificationToggleItem( - selected = !item.isRead, + selected = item.isSelected, showBadge = item.hasHighPriority, - onClick = { /* TODO: 알림 클릭 시 동작 */ }, - showDivider = item.id != (notificationItems.lastOrNull()?.id ?: 0), + onClick = { + // 개별 아이템 선택 토글 + notificationItems = + notificationItems.mapIndexed { idx, notificationItem -> + if (idx == index) { + notificationItem.copy(isSelected = !notificationItem.isSelected) + } else { + notificationItem + } + } + }, + showDivider = index != notificationItems.lastIndex, paddingValues = PaddingValues(vertical = 8.dp) ) { Column( @@ -267,89 +284,12 @@ private fun createAnnotatedString(content: String) = buildAnnotatedString { } } -@Composable -private fun NotificationItemProduction( - item: NotificationItemData, - modifier: Modifier = Modifier -) { - val isInPreview = LocalInspectionMode.current - - Column( - modifier = modifier - .fillMaxWidth() - .padding(vertical = 16.dp), - ) { - // 알림 내용 - Column( - modifier = Modifier.weight(1f), - verticalArrangement = Arrangement.spacedBy(4.dp) - ) { - Row( - modifier = Modifier.fillMaxWidth(), - horizontalArrangement = Arrangement.SpaceBetween, - verticalAlignment = Alignment.Top - ) { - Text( - text = item.title, - fontSize = 16.sp, - fontWeight = if (item.isRead) FontWeight.Normal else FontWeight.Medium, - color = Color.Black - ) - - Row( - verticalAlignment = Alignment.CenterVertically, - horizontalArrangement = Arrangement.spacedBy(4.dp) - ) { - if (item.hasHighPriority) { - Box( - modifier = Modifier - .size(6.dp) - .clip(CircleShape) - .background(CherrydanColors.MainPink3) - ) - } - Text( - text = if (isInPreview) "읽음" else "읽음", // 프리뷰에서는 하드코딩 - fontSize = 12.sp, - color = Color(0xFF9E9E9E) - ) - } - } - - if (item.content.isNotEmpty()) { - Text( - text = item.content, - fontSize = 14.sp, - color = Color(0xFF757575), - lineHeight = 20.sp - ) - } - - if (item.date.isNotEmpty()) { - Text( - text = item.date, - fontSize = 12.sp, - color = Color(0xFFBDBDBD) - ) - } - } - } - - // 구분선 - if (item.id != 5) { - HorizontalDivider( - modifier = Modifier.padding(start = 36.dp), - color = Color(0xFFF5F5F5), - thickness = 1.dp - ) - } -} - data class NotificationItemData( val id: Int, val title: String, val content: String, val date: String, + val isSelected: Boolean = false, val isRead: Boolean = false, val hasHighPriority: Boolean = false ) From b7540f0f63c5db0b95bf0b11e7b83623feb21057 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=EC=B5=9C=ED=98=84=EC=A0=95?= Date: Mon, 30 Jun 2025 11:06:41 +0900 Subject: [PATCH 3/8] feat: Enhances notification selection UX --- .../presentation/NotificationScreen.kt | 70 ++++++++++--------- 1 file changed, 37 insertions(+), 33 deletions(-) diff --git a/notification/presentation/src/main/java/com/hyunjung/notification/presentation/NotificationScreen.kt b/notification/presentation/src/main/java/com/hyunjung/notification/presentation/NotificationScreen.kt index 8162bc0..1c0e449 100644 --- a/notification/presentation/src/main/java/com/hyunjung/notification/presentation/NotificationScreen.kt +++ b/notification/presentation/src/main/java/com/hyunjung/notification/presentation/NotificationScreen.kt @@ -1,6 +1,7 @@ package com.hyunjung.notification.presentation import androidx.compose.foundation.background +import androidx.compose.foundation.clickable import androidx.compose.foundation.layout.Arrangement import androidx.compose.foundation.layout.Box import androidx.compose.foundation.layout.Column @@ -11,9 +12,12 @@ import androidx.compose.foundation.layout.fillMaxSize import androidx.compose.foundation.layout.fillMaxWidth import androidx.compose.foundation.layout.height import androidx.compose.foundation.layout.padding +import androidx.compose.foundation.layout.size +import androidx.compose.foundation.layout.width import androidx.compose.foundation.lazy.LazyColumn import androidx.compose.foundation.lazy.itemsIndexed import androidx.compose.material3.HorizontalDivider +import androidx.compose.material3.Icon import androidx.compose.material3.Text import androidx.compose.runtime.Composable import androidx.compose.runtime.getValue @@ -23,6 +27,7 @@ import androidx.compose.runtime.remember import androidx.compose.runtime.setValue import androidx.compose.ui.Alignment import androidx.compose.ui.Modifier +import androidx.compose.ui.graphics.Color import androidx.compose.ui.platform.LocalInspectionMode import androidx.compose.ui.res.stringResource import androidx.compose.ui.text.SpanStyle @@ -30,18 +35,20 @@ import androidx.compose.ui.text.buildAnnotatedString import androidx.compose.ui.text.font.FontWeight import androidx.compose.ui.tooling.preview.Preview import androidx.compose.ui.unit.dp -import com.hyunjung.auth.presentation.AlertType -import com.hyunjung.auth.presentation.NotificationActiveToggleItem -import com.hyunjung.auth.presentation.NotificationToggleItem import com.hyunjung.core.presentation.designsystem.BackIcon import com.hyunjung.core.presentation.designsystem.CherrydanColors import com.hyunjung.core.presentation.designsystem.CherrydanTheme import com.hyunjung.core.presentation.designsystem.CherrydanTypography +import com.hyunjung.core.presentation.designsystem.CircleSelectedIcon +import com.hyunjung.core.presentation.designsystem.CircleUnselectedIcon import com.hyunjung.core.presentation.designsystem.TrashIcon import com.hyunjung.core.presentation.designsystem.component.CherrydanFixedTabRow import com.hyunjung.core.presentation.designsystem.component.CherrydanTab import com.hyunjung.core.presentation.designsystem.component.CherrydanTopAppBar import com.hyunjung.core.presentation.designsystem.component.TopBarIconButton +import com.hyunjung.notification.presentation.component.AlertType +import com.hyunjung.notification.presentation.component.NotificationActiveToggleItem +import com.hyunjung.notification.presentation.component.NotificationToggleItem @Composable fun NotificationScreen( @@ -152,38 +159,35 @@ fun NotificationScreen( .padding(horizontal = 16.dp), verticalAlignment = Alignment.CenterVertically ) { - NotificationToggleItem( - selected = allSelected, - showBadge = false, - onClick = { - // 모두선택 토글 로직 - notificationItems = notificationItems.map { item -> - item.copy(isSelected = !allSelected) + Row( + modifier = Modifier + .clickable { + notificationItems = notificationItems.map { item -> + item.copy(isSelected = !allSelected) + } } - }, - showDivider = false, - paddingValues = PaddingValues(0.dp) + .padding(end = 8.dp), + verticalAlignment = Alignment.CenterVertically ) { - Row( - modifier = Modifier - .fillMaxWidth() - .height(32.dp), - verticalAlignment = Alignment.CenterVertically, - horizontalArrangement = Arrangement.SpaceBetween - ) { - Text( - text = if (isInPreview) "모든 선택" else stringResource(id = com.hyunjung.core.presentation.ui.R.string.notification_all_select), - style = CherrydanTypography.Main4_R, - color = CherrydanColors.Black - ) - - Text( - text = if (isInPreview) "읽음" else stringResource(id = com.hyunjung.core.presentation.ui.R.string.notification_read), - style = CherrydanTypography.Main4_R, - color = CherrydanColors.Black - ) - } + Icon( + imageVector = if (allSelected) CircleSelectedIcon else CircleUnselectedIcon, + tint = Color.Unspecified, + contentDescription = null, + modifier = Modifier.size(24.dp) + ) + Spacer(modifier = Modifier.width(4.dp)) + Text( + text = if (isInPreview) "모두 선택" else stringResource(id = com.hyunjung.core.presentation.ui.R.string.notification_all_select), + style = CherrydanTypography.Main4_R, + color = CherrydanColors.Black + ) } + Spacer(modifier = Modifier.weight(1f)) + Text( + text = if (isInPreview) "읽음" else stringResource(id = com.hyunjung.core.presentation.ui.R.string.notification_read), + style = CherrydanTypography.Main4_R, + color = CherrydanColors.Black + ) } Spacer(modifier = Modifier.height(12.dp)) @@ -342,4 +346,4 @@ private fun NotificationScreenPreview() { CherrydanTheme { NotificationScreen() } -} \ No newline at end of file +} From cb7e811e237347698c9be074cf3ef2912b7a6a35 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=EC=B5=9C=ED=98=84=EC=A0=95?= Date: Mon, 30 Jun 2025 11:13:43 +0900 Subject: [PATCH 4/8] feat: Notification read --- .../notification/presentation/NotificationScreen.kt | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/notification/presentation/src/main/java/com/hyunjung/notification/presentation/NotificationScreen.kt b/notification/presentation/src/main/java/com/hyunjung/notification/presentation/NotificationScreen.kt index 1c0e449..029714f 100644 --- a/notification/presentation/src/main/java/com/hyunjung/notification/presentation/NotificationScreen.kt +++ b/notification/presentation/src/main/java/com/hyunjung/notification/presentation/NotificationScreen.kt @@ -186,7 +186,16 @@ fun NotificationScreen( Text( text = if (isInPreview) "읽음" else stringResource(id = com.hyunjung.core.presentation.ui.R.string.notification_read), style = CherrydanTypography.Main4_R, - color = CherrydanColors.Black + color = CherrydanColors.Black, + modifier = Modifier.clickable(enabled = hasAnySelected) { + notificationItems = notificationItems.map { item -> + if (item.isSelected) { + item.copy(isRead = true, isSelected = false, hasHighPriority = false) + } else { + item + } + } + } ) } From be426f85469b98d83bc3f2d2dcef0df3cb659413 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=EC=B5=9C=ED=98=84=EC=A0=95?= Date: Wed, 2 Jul 2025 00:13:42 +0900 Subject: [PATCH 5/8] feat: Implement delete mode --- .../presentation/NotificationScreen.kt | 102 +++++++++++++----- 1 file changed, 78 insertions(+), 24 deletions(-) diff --git a/notification/presentation/src/main/java/com/hyunjung/notification/presentation/NotificationScreen.kt b/notification/presentation/src/main/java/com/hyunjung/notification/presentation/NotificationScreen.kt index 029714f..ae0d9b3 100644 --- a/notification/presentation/src/main/java/com/hyunjung/notification/presentation/NotificationScreen.kt +++ b/notification/presentation/src/main/java/com/hyunjung/notification/presentation/NotificationScreen.kt @@ -35,6 +35,7 @@ import androidx.compose.ui.text.buildAnnotatedString import androidx.compose.ui.text.font.FontWeight import androidx.compose.ui.tooling.preview.Preview import androidx.compose.ui.unit.dp +import androidx.compose.ui.unit.sp import com.hyunjung.core.presentation.designsystem.BackIcon import com.hyunjung.core.presentation.designsystem.CherrydanColors import com.hyunjung.core.presentation.designsystem.CherrydanTheme @@ -57,6 +58,7 @@ fun NotificationScreen( ) { var selectedTabIndex by remember { mutableIntStateOf(0) } var notificationItems by remember { mutableStateOf(getSampleNotifications()) } + var isDeleteMode by remember { mutableStateOf(false) } val isInPreview = LocalInspectionMode.current val allSelected = notificationItems.all { it.isSelected } @@ -78,11 +80,13 @@ fun NotificationScreen( ) }, actions = { - TopBarIconButton( - imageVector = TrashIcon, - contentDescription = "Delete", - onClick = {} - ) + if (!isDeleteMode) { + TopBarIconButton( + imageVector = TrashIcon, + contentDescription = "Delete", + onClick = { isDeleteMode = true } + ) + } } ) } else { @@ -96,11 +100,13 @@ fun NotificationScreen( ) }, actions = { - TopBarIconButton( - imageVector = TrashIcon, - contentDescription = "Delete", - onClick = onDeletePressed - ) + if (!isDeleteMode) { + TopBarIconButton( + imageVector = TrashIcon, + contentDescription = "Delete", + onClick = { isDeleteMode = true } + ) + } } ) } @@ -151,7 +157,7 @@ fun NotificationScreen( Spacer(modifier = Modifier.height(20.dp)) - // 모두선택 / 읽음 처리 행 + // 모두선택 / 읽음처리 또는 삭제 행 Row( modifier = Modifier .fillMaxWidth() @@ -183,20 +189,68 @@ fun NotificationScreen( ) } Spacer(modifier = Modifier.weight(1f)) - Text( - text = if (isInPreview) "읽음" else stringResource(id = com.hyunjung.core.presentation.ui.R.string.notification_read), - style = CherrydanTypography.Main4_R, - color = CherrydanColors.Black, - modifier = Modifier.clickable(enabled = hasAnySelected) { - notificationItems = notificationItems.map { item -> - if (item.isSelected) { - item.copy(isRead = true, isSelected = false, hasHighPriority = false) - } else { - item + + if (isDeleteMode) { + // 삭제 모드: "삭제 | 취소" 표시 + Row( + verticalAlignment = Alignment.CenterVertically + ) { + Text( + text = if (isInPreview) "삭제" else stringResource(id = com.hyunjung.core.presentation.ui.R.string.notification_delete), + style = CherrydanTypography.Main4_B.copy(fontSize = 14.sp), + color = CherrydanColors.MainPink3, + modifier = Modifier + .clickable(enabled = hasAnySelected) { + // 선택된 항목들을 삭제 + notificationItems = notificationItems.filter { !it.isSelected } + isDeleteMode = false + onDeletePressed() + } + .padding(end = 12.dp) + ) + + Text( + text = "|", + style = CherrydanTypography.Main5_R, + color = CherrydanColors.Gray4 + ) + + Text( + text = if (isInPreview) "취소" else stringResource(id = com.hyunjung.core.presentation.ui.R.string.notification_cancel), + style = CherrydanTypography.Main4_B.copy(fontSize = 14.sp), + color = CherrydanColors.Black, + modifier = Modifier + .clickable { + // 삭제 모드 취소 및 선택 해제 + notificationItems = + notificationItems.map { it.copy(isSelected = false) } + isDeleteMode = false + } + .padding(start = 12.dp) + ) + } + } else { + // 일반 모드: "읽음" 표시 + Text( + text = if (isInPreview) "읽음" else stringResource(id = com.hyunjung.core.presentation.ui.R.string.notification_read), + style = CherrydanTypography.Main4_R, + color = if (hasAnySelected) CherrydanColors.Black else CherrydanColors.Gray4, + modifier = Modifier.clickable(enabled = hasAnySelected) { + // 선택된 항목들을 읽음 처리 + notificationItems = notificationItems.map { item -> + if (item.isSelected) { + item.copy( + isRead = true, + isSelected = false, + hasHighPriority = false + ) + } else { + item + } } } - } - ) + ) + } } Spacer(modifier = Modifier.height(12.dp)) @@ -355,4 +409,4 @@ private fun NotificationScreenPreview() { CherrydanTheme { NotificationScreen() } -} +} \ No newline at end of file From 10220d8bd7bd3964de5dab513042a1a4f83a32ae Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=EC=B5=9C=ED=98=84=EC=A0=95?= Date: Wed, 2 Jul 2025 00:32:55 +0900 Subject: [PATCH 6/8] refactor: Notification actions for delete mode toggle --- .../presentation/NotificationScreen.kt | 25 +++++++++++++------ 1 file changed, 18 insertions(+), 7 deletions(-) diff --git a/notification/presentation/src/main/java/com/hyunjung/notification/presentation/NotificationScreen.kt b/notification/presentation/src/main/java/com/hyunjung/notification/presentation/NotificationScreen.kt index ae0d9b3..71eb2df 100644 --- a/notification/presentation/src/main/java/com/hyunjung/notification/presentation/NotificationScreen.kt +++ b/notification/presentation/src/main/java/com/hyunjung/notification/presentation/NotificationScreen.kt @@ -80,13 +80,10 @@ fun NotificationScreen( ) }, actions = { - if (!isDeleteMode) { - TopBarIconButton( - imageVector = TrashIcon, - contentDescription = "Delete", - onClick = { isDeleteMode = true } - ) - } + NotificationScreenActions( + isDeleteMode = isDeleteMode, + onDeleteModeToggle = { isDeleteMode = !isDeleteMode } + ) } ) } else { @@ -336,6 +333,20 @@ fun NotificationScreen( } } +@Composable +private fun NotificationScreenActions( + isDeleteMode: Boolean, + onDeleteModeToggle: () -> Unit +) { + if (!isDeleteMode) { + TopBarIconButton( + imageVector = TrashIcon, + contentDescription = "Delete", + onClick = onDeleteModeToggle + ) + } +} + @Composable private fun createAnnotatedString(content: String) = buildAnnotatedString { append(content) From 60175ed0651198abcf313ede0d37d84697cd881e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=EC=B5=9C=ED=98=84=EC=A0=95?= Date: Wed, 2 Jul 2025 00:37:33 +0900 Subject: [PATCH 7/8] fix: Add toggle for notification selection --- .../presentation/NotificationScreen.kt | 22 +++++++++---------- 1 file changed, 11 insertions(+), 11 deletions(-) diff --git a/notification/presentation/src/main/java/com/hyunjung/notification/presentation/NotificationScreen.kt b/notification/presentation/src/main/java/com/hyunjung/notification/presentation/NotificationScreen.kt index 71eb2df..fd359bc 100644 --- a/notification/presentation/src/main/java/com/hyunjung/notification/presentation/NotificationScreen.kt +++ b/notification/presentation/src/main/java/com/hyunjung/notification/presentation/NotificationScreen.kt @@ -64,6 +64,16 @@ fun NotificationScreen( val allSelected = notificationItems.all { it.isSelected } val hasAnySelected = notificationItems.any { it.isSelected } + val toggleItemSelection: (Int) -> Unit = { index -> + notificationItems = notificationItems.mapIndexed { idx, item -> + if (idx == index) { + item.copy(isSelected = !item.isSelected) + } else { + item + } + } + } + Column( modifier = Modifier .fillMaxSize() @@ -269,17 +279,7 @@ fun NotificationScreen( time = System.currentTimeMillis(), selected = item.isSelected, showBadge = item.hasHighPriority, - onClick = { - // 개별 아이템 선택 토글 - notificationItems = - notificationItems.mapIndexed { idx, notificationItem -> - if (idx == index) { - notificationItem.copy(isSelected = !notificationItem.isSelected) - } else { - notificationItem - } - } - }, + onClick = { toggleItemSelection(index) }, showDivider = index != notificationItems.lastIndex, modifier = Modifier.padding(vertical = 4.dp) ) From 217cfdd094cc1019e35ca38b077730ce13091624 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=EC=B5=9C=ED=98=84=EC=A0=95?= Date: Wed, 2 Jul 2025 00:39:58 +0900 Subject: [PATCH 8/8] fix: Update onDeletePressed --- .../hyunjung/notification/presentation/NotificationScreen.kt | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/notification/presentation/src/main/java/com/hyunjung/notification/presentation/NotificationScreen.kt b/notification/presentation/src/main/java/com/hyunjung/notification/presentation/NotificationScreen.kt index fd359bc..91df054 100644 --- a/notification/presentation/src/main/java/com/hyunjung/notification/presentation/NotificationScreen.kt +++ b/notification/presentation/src/main/java/com/hyunjung/notification/presentation/NotificationScreen.kt @@ -54,7 +54,7 @@ import com.hyunjung.notification.presentation.component.NotificationToggleItem @Composable fun NotificationScreen( onBackPressed: () -> Unit = {}, - onDeletePressed: () -> Unit = {} + onDeletePressed: (deletedItems: List) -> Unit = {} ) { var selectedTabIndex by remember { mutableIntStateOf(0) } var notificationItems by remember { mutableStateOf(getSampleNotifications()) } @@ -209,9 +209,10 @@ fun NotificationScreen( modifier = Modifier .clickable(enabled = hasAnySelected) { // 선택된 항목들을 삭제 + val itemsToDelete = notificationItems.filter { it.isSelected } notificationItems = notificationItems.filter { !it.isSelected } isDeleteMode = false - onDeletePressed() + onDeletePressed(itemsToDelete) } .padding(end = 12.dp) )