feat(gift): 선물 진행 상태 표시를 추가한다

This commit is contained in:
2026-10-02 18:31:12 +09:00
parent 07e2882a6d
commit 81435e2cb2
2 changed files with 74 additions and 0 deletions
@@ -0,0 +1,49 @@
package kr.co.vividnext.sodalive.v2.gift.ui
import android.view.LayoutInflater
import android.view.ViewGroup
import androidx.core.content.ContextCompat
import androidx.core.view.isVisible
import androidx.recyclerview.widget.DiffUtil
import androidx.recyclerview.widget.ListAdapter
import androidx.recyclerview.widget.RecyclerView
import kr.co.vividnext.sodalive.R
import kr.co.vividnext.sodalive.databinding.ItemGiftStatusTimelineBinding
import kr.co.vividnext.sodalive.v2.gift.GiftDetailTimelineStep
import kr.co.vividnext.sodalive.v2.gift.resolveGiftDetailText
class GiftStatusTimelineAdapter : ListAdapter<GiftDetailTimelineStep, GiftStatusTimelineAdapter.Holder>(
object : DiffUtil.ItemCallback<GiftDetailTimelineStep>() {
override fun areItemsTheSame(oldItem: GiftDetailTimelineStep, newItem: GiftDetailTimelineStep) =
oldItem.status == newItem.status
override fun areContentsTheSame(oldItem: GiftDetailTimelineStep, newItem: GiftDetailTimelineStep) =
oldItem == newItem
}
) {
override fun onCreateViewHolder(parent: ViewGroup, viewType: Int) = Holder(
ItemGiftStatusTimelineBinding.inflate(LayoutInflater.from(parent.context), parent, false)
)
override fun onBindViewHolder(holder: Holder, position: Int) = holder.bind(getItem(position))
class Holder(private val binding: ItemGiftStatusTimelineBinding) : RecyclerView.ViewHolder(binding.root) {
fun bind(step: GiftDetailTimelineStep) {
val context = binding.root.context
val color = ContextCompat.getColor(context, if (step.completed) R.color.soda_400 else R.color.gray_500)
binding.segment.setBackgroundColor(color)
binding.title.text = if (step.status == "RECEIVED") {
context.getString(R.string.gift_detail_application_received)
} else {
context.resolveGiftDetailText(step.title)
}
binding.title.setTextColor(color)
binding.title.contentDescription = listOf(
binding.title.text,
context.getString(if (step.completed) R.string.gift_detail_step_completed else R.string.gift_detail_step_pending)
).joinToString(", ")
binding.date.isVisible = step.date != null
binding.date.text = step.date
}
}
}
@@ -0,0 +1,25 @@
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="vertical"
android:paddingEnd="@dimen/spacing_4">
<View
android:id="@+id/segment"
android:layout_width="match_parent"
android:layout_height="@dimen/spacing_4"
android:importantForAccessibility="no" />
<TextView
android:id="@+id/title"
style="@style/Typography.Caption2"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginTop="@dimen/spacing_8" />
<TextView
android:id="@+id/date"
style="@style/Typography.Caption3"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginTop="@dimen/spacing_4"
android:textColor="@color/gray_400" />
</LinearLayout>