From 98cc7106a017afbad41c51933b39b723f777578a Mon Sep 17 00:00:00 2001 From: eastshine2741 Date: Thu, 30 Nov 2023 04:33:56 +0900 Subject: [PATCH] =?UTF-8?q?=EC=86=8C=EC=86=8C=ED=95=9C=20ui=20=EC=88=98?= =?UTF-8?q?=EC=A0=95?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../notifications/NotificationPage.kt | 57 +++++++++++-------- 1 file changed, 32 insertions(+), 25 deletions(-) diff --git a/app/src/main/java/com/wafflestudio/snutt2/views/logged_in/notifications/NotificationPage.kt b/app/src/main/java/com/wafflestudio/snutt2/views/logged_in/notifications/NotificationPage.kt index 79c087c4c..0e8674d6a 100644 --- a/app/src/main/java/com/wafflestudio/snutt2/views/logged_in/notifications/NotificationPage.kt +++ b/app/src/main/java/com/wafflestudio/snutt2/views/logged_in/notifications/NotificationPage.kt @@ -3,6 +3,7 @@ package com.wafflestudio.snutt2.views.logged_in.notifications import androidx.compose.foundation.background import androidx.compose.foundation.layout.* import androidx.compose.foundation.lazy.LazyColumn +import androidx.compose.material.Divider import androidx.compose.material.Text import androidx.compose.runtime.Composable import androidx.compose.ui.Alignment @@ -10,6 +11,7 @@ import androidx.compose.ui.Modifier import androidx.compose.ui.graphics.ColorFilter import androidx.compose.ui.platform.LocalContext import androidx.compose.ui.res.stringResource +import androidx.compose.ui.text.font.FontWeight import androidx.compose.ui.text.style.TextAlign import androidx.compose.ui.text.style.TextOverflow import androidx.compose.ui.tooling.preview.Preview @@ -49,7 +51,9 @@ fun NotificationPage() { when { refreshState is LoadState.NotLoading && appendState.endOfPaginationReached && notificationList.itemCount < 1 -> NotificationPlaceholder() refreshState is LoadState.Error -> NotificationError() - else -> LazyColumn { + else -> LazyColumn( + modifier = Modifier.padding(horizontal = 9.dp) + ) { items(notificationList) { it?.let { NotificationItem(it) } } @@ -61,34 +65,37 @@ fun NotificationPage() { @Composable fun NotificationItem(info: NotificationDto) { val context = LocalContext.current - Row(modifier = Modifier.padding(horizontal = 15.dp, vertical = 10.dp)) { - when (info.type) { - 0 -> WarningIcon(modifier = Modifier.size(20.dp), colorFilter = ColorFilter.tint(SNUTTColors.Black900)) - 1 -> CalendarIcon(modifier = Modifier.size(20.dp), colorFilter = ColorFilter.tint(SNUTTColors.Black900)) - 2 -> RefreshIcon(modifier = Modifier.size(20.dp), colorFilter = ColorFilter.tint(SNUTTColors.Black900)) - 3 -> TrashIcon(modifier = Modifier.size(20.dp), colorFilter = ColorFilter.tint(SNUTTColors.Black900)) - 4 -> NotificationIcon(modifier = Modifier.size(20.dp), colorFilter = ColorFilter.tint(SNUTTColors.Black900)) - 5 -> PeopleIcon(modifier = Modifier.size(20.dp), colorFilter = ColorFilter.tint(SNUTTColors.Black900)) - else -> MegaphoneIcon(modifier = Modifier.size(20.dp), colorFilter = ColorFilter.tint(SNUTTColors.Black900)) - } - Spacer(modifier = Modifier.width(10.dp)) - Column { - Row(modifier = Modifier.fillMaxWidth()) { - Text(text = info.title) - Spacer(modifier = Modifier.weight(1f)) + Column { + Row(modifier = Modifier.padding(horizontal = 15.dp, vertical = 15.dp)) { + when (info.type) { + 0 -> WarningIcon(modifier = Modifier.size(20.dp), colorFilter = ColorFilter.tint(SNUTTColors.Black900)) + 1 -> CalendarIcon(modifier = Modifier.size(20.dp), colorFilter = ColorFilter.tint(SNUTTColors.Black900)) + 2 -> RefreshIcon(modifier = Modifier.size(20.dp), colorFilter = ColorFilter.tint(SNUTTColors.Black900)) + 3 -> TrashIcon(modifier = Modifier.size(20.dp), colorFilter = ColorFilter.tint(SNUTTColors.Black900)) + 4 -> NotificationIcon(modifier = Modifier.size(20.dp), colorFilter = ColorFilter.tint(SNUTTColors.Black900)) + 5 -> PeopleIcon(modifier = Modifier.size(20.dp), colorFilter = ColorFilter.tint(SNUTTColors.Black900)) + else -> MegaphoneIcon(modifier = Modifier.size(20.dp), colorFilter = ColorFilter.tint(SNUTTColors.Black900)) + } + Spacer(modifier = Modifier.width(10.dp)) + Column { + Row(modifier = Modifier.fillMaxWidth()) { + Text(text = info.title, fontWeight = FontWeight.SemiBold) + Spacer(modifier = Modifier.weight(1f)) + Text( + text = getNotificationTime(context, info), + style = SNUTTTypography.body2.copy(color = SNUTTColors.Gray600), + maxLines = 1, + overflow = TextOverflow.Ellipsis, + ) + } + Spacer(modifier = Modifier.height(7.dp)) Text( - text = getNotificationTime(context, info), - style = SNUTTTypography.body2.copy(color = SNUTTColors.Gray600), - maxLines = 1, - overflow = TextOverflow.Ellipsis, + text = info.message, + style = SNUTTTypography.body2, ) } - Spacer(modifier = Modifier.height(7.dp)) - Text( - text = info.message, - style = SNUTTTypography.body2, - ) } + Divider(thickness = 0.5.dp, color = SNUTTColors.Gray400) } }