Skip to content

Commit

Permalink
[FEAT] MissionDetailActivity - SpannableString을 활용한 TimeStamp 형식 적용 (#…
Browse files Browse the repository at this point in the history
  • Loading branch information
KxxHyoRim committed Feb 29, 2024
1 parent f42b14f commit 95d250d
Show file tree
Hide file tree
Showing 7 changed files with 11 additions and 20 deletions.
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
package com.lgtm.android.common_ui.model

import android.text.SpannableString
import com.lgtm.android.common_ui.constant.MissionDetailButtonStatus
import com.lgtm.android.common_ui.constant.MissionStatusUI
import com.lgtm.domain.constants.Role
Expand All @@ -22,6 +23,5 @@ data class MissionDetailUI(
val scraped: Boolean,
val techTagList: List<TechTagVO>,
val missionDetailButtonStatusUI: MissionDetailButtonStatus,
val time: String,
val date: String,
val dateTime: SpannableString,
)
Original file line number Diff line number Diff line change
Expand Up @@ -57,8 +57,7 @@ fun MissionDetailVO.toUiModel(): MissionDetailUI = MissionDetailUI(
scraped = scraped,
techTagList = techTagList,
missionDetailButtonStatusUI = getButtonStatusUI(missionDetailStatus),
time = date?.format(korean12HourTimeFormatter) ?: "",
date = date?.format(dotStyleDateFormatter) ?: ""
dateTime = createLgtmDateTimeSpannable(dateTime)
)

fun ProfileVO.toUiModel(): ProfileGlanceUI = ProfileGlanceUI(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@ data class MissionDetailDTO(
requireNotNull(isParticipated),
requireNotNull(isClosed)
),
date = parseDate(createdAt)
dateTime = parseDate(createdAt)
)
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -22,5 +22,5 @@ data class MissionDetailVO(
val scraped: Boolean,
val techTagList: List<TechTagVO>,
val missionDetailStatus: MissionDetailStatus,
val date: LocalDateTime?,
val dateTime: LocalDateTime?,
)
Original file line number Diff line number Diff line change
Expand Up @@ -96,7 +96,6 @@ class MissionDetailActivity :
techTagAdapter.submitList(missionDetailUi?.techTagList)
binding.profileGlance.data = requireNotNull(missionDetailUi?.memberProfile)
setGithubUrlUI(missionDetailUi?.missionRepositoryUrl)
bindDateAndTimeInfo()
}

is NetworkState.Failure -> {
Expand Down Expand Up @@ -160,11 +159,6 @@ class MissionDetailActivity :
}
}

private fun bindDateAndTimeInfo() {
val (date, time) = missionDetailViewModel.getMissionDateAndTime()
binding.lgtmTimestamp.setTimeStamp(date, time)
}

private fun setMenuButtonClickListener() {
binding.ivMenu.setOnThrottleClickListener {
showMenu(it)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -161,10 +161,4 @@ class MissionDetailViewModel @Inject constructor(
private fun getReviewerNickname(): String {
return missionDetailUiState.value?.memberProfile?.nickname ?: ""
}

fun getMissionDateAndTime(): Pair<String, String> {
val missionDate = missionDetailUiState.value?.date ?: ""
val missionTime = missionDetailUiState.value?.time ?: ""
return missionDate to missionTime
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -122,13 +122,17 @@
app:layout_constraintTop_toBottomOf="@id/btn_progress"
tools:text="개발자 김효림과 함께하는 안드로이드 기초 강의입니다!" />

<com.lgtm.android.common_ui.ui.LGTMTimestamp
<TextView
android:id="@+id/lgtm_timestamp"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginTop="12dp"
android:text="@{viewModel.missionDetailUiState.dateTime}"
android:textAppearance="@style/Description"
app:layout_constraintStart_toStartOf="@id/tv_mission_title"
app:layout_constraintTop_toBottomOf="@id/tv_mission_title" />
app:layout_constraintTop_toBottomOf="@id/tv_mission_title"
tools:text="2021.07.01 | 오후 12:00"
tools:textColor="" />

<!-- 기술 태그 -->
<androidx.recyclerview.widget.RecyclerView
Expand Down

0 comments on commit 95d250d

Please sign in to comment.