diff --git a/common-ui/src/main/java/com/lgtm/android/common_ui/model/NotificationUI.kt b/common-ui/src/main/java/com/lgtm/android/common_ui/model/NotificationUI.kt index 02220b51..8b054783 100644 --- a/common-ui/src/main/java/com/lgtm/android/common_ui/model/NotificationUI.kt +++ b/common-ui/src/main/java/com/lgtm/android/common_ui/model/NotificationUI.kt @@ -1,10 +1,11 @@ package com.lgtm.android.common_ui.model +import android.text.SpannableString + data class NotificationUI( val title: String, val body: String, val isRead: Boolean, val notificationId: Int, - val date: String, - val time: String, + val dateTime: SpannableString, ) \ No newline at end of file diff --git a/common-ui/src/main/java/com/lgtm/android/common_ui/model/mapper/UiMapper.kt b/common-ui/src/main/java/com/lgtm/android/common_ui/model/mapper/UiMapper.kt index 58e261b5..116cbb6c 100644 --- a/common-ui/src/main/java/com/lgtm/android/common_ui/model/mapper/UiMapper.kt +++ b/common-ui/src/main/java/com/lgtm/android/common_ui/model/mapper/UiMapper.kt @@ -38,6 +38,7 @@ import java.time.LocalDateTime const val LGTM_RED = "#fe504f" const val LGTM_GRAY_3 = "#cfd8e7" +const val LGTM_GRAY_5 = "#78879f" fun MissionDetailVO.toUiModel(): MissionDetailUI = MissionDetailUI( currentPeopleNumber = currentPeopleNumber, @@ -136,20 +137,29 @@ fun createRedSpannableText(text: String, redTextStart: Int, redTextEnd: Int): Sp return spannableText } -fun createLgtmDateTimeSpannable(localDateTime: LocalDateTime?): SpannableString { +fun createLgtmDateTimeSpannable( + localDateTime: LocalDateTime?, +): SpannableString { return when (localDateTime) { null -> SpannableString("-") else -> { val time = localDateTime.format(korean12HourTimeFormatter) val date = localDateTime.format(dotStyleDateFormatter) - val spannableText = SpannableString("$date | $time") - spannableText.setSpan( - ForegroundColorSpan(Color.parseColor(LGTM_GRAY_3)), - date.length + 1, - date.length + 2, - Spannable.SPAN_EXCLUSIVE_INCLUSIVE - ) + val spannableText = SpannableString("$date | $time").apply { + setSpan( + ForegroundColorSpan(Color.parseColor(LGTM_GRAY_5)), + 0, + this@apply.length, + Spannable.SPAN_EXCLUSIVE_INCLUSIVE + ) + setSpan( + ForegroundColorSpan(Color.parseColor(LGTM_GRAY_3)), + date.length + 1, + date.length + 2, + Spannable.SPAN_EXCLUSIVE_INCLUSIVE + ) + } spannableText } } @@ -261,7 +271,6 @@ fun NotificationVO.toUiModel(): NotificationUI { body = body, notificationId = notificationId, isRead = isRead, - time = date?.format(korean12HourTimeFormatter) ?: "", - date = date?.format(dotStyleDateFormatter) ?: "" + dateTime = createLgtmDateTimeSpannable(dateTime) ) } \ No newline at end of file diff --git a/data/src/main/java/com/lgtm/android/data/model/response/NotificationDTO.kt b/data/src/main/java/com/lgtm/android/data/model/response/NotificationDTO.kt index 9209f7a5..8abf6f60 100644 --- a/data/src/main/java/com/lgtm/android/data/model/response/NotificationDTO.kt +++ b/data/src/main/java/com/lgtm/android/data/model/response/NotificationDTO.kt @@ -16,7 +16,7 @@ data class NotificationDTO( body = body.orEmpty(), isRead = isRead ?: false, notificationId = requireNotNull(notificationId) { "notificationId is null" }, - date = parseDate(createdAt) + dateTime = parseDate(createdAt) ) } } \ No newline at end of file diff --git a/domain/src/main/java/com/lgtm/domain/entity/response/NotificationVO.kt b/domain/src/main/java/com/lgtm/domain/entity/response/NotificationVO.kt index ef816155..5eecb696 100644 --- a/domain/src/main/java/com/lgtm/domain/entity/response/NotificationVO.kt +++ b/domain/src/main/java/com/lgtm/domain/entity/response/NotificationVO.kt @@ -7,5 +7,5 @@ data class NotificationVO( val body: String, val isRead: Boolean, val notificationId: Int, - val date: LocalDateTime?, + val dateTime: LocalDateTime?, ) \ No newline at end of file diff --git a/feature/main/src/main/java/com/lgtm/android/main/notification/NotificationAdapter.kt b/feature/main/src/main/java/com/lgtm/android/main/notification/NotificationAdapter.kt index c801e50f..b8db569d 100644 --- a/feature/main/src/main/java/com/lgtm/android/main/notification/NotificationAdapter.kt +++ b/feature/main/src/main/java/com/lgtm/android/main/notification/NotificationAdapter.kt @@ -30,6 +30,5 @@ class NotificationViewHolder( ) : RecyclerView.ViewHolder(binding.root) { fun onBind(item: NotificationUI) { binding.data = item - binding.lgtmTimestamp.setTimeStamp(item.date, item.time) } } \ No newline at end of file diff --git a/feature/main/src/main/res/layout/item_notification_center.xml b/feature/main/src/main/res/layout/item_notification_center.xml index e43abb10..23ee2ab5 100644 --- a/feature/main/src/main/res/layout/item_notification_center.xml +++ b/feature/main/src/main/res/layout/item_notification_center.xml @@ -57,12 +57,14 @@ app:layout_constraintTop_toBottomOf="@id/tv_notification_title" tools:text="This is Body Part." /> -