From 07e2882a6da097873e7f18ab5201a3b9c690db98 Mon Sep 17 00:00:00 2001 From: klaus Date: Fri, 2 Oct 2026 18:31:02 +0900 Subject: [PATCH] =?UTF-8?q?feat(gift):=20=EC=84=A0=EB=AC=BC=20=EC=83=81?= =?UTF-8?q?=EC=84=B8=20=EC=A0=95=EB=B3=B4=20=ED=96=89=EC=9D=84=20=EC=B6=94?= =?UTF-8?q?=EA=B0=80=ED=95=9C=EB=8B=A4?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../sodalive/v2/gift/ui/GiftInfoRows.kt | 32 +++++++++++++++++++ .../main/res/layout/item_gift_info_row.xml | 20 ++++++++++++ 2 files changed, 52 insertions(+) create mode 100644 app/src/main/java/kr/co/vividnext/sodalive/v2/gift/ui/GiftInfoRows.kt create mode 100644 app/src/main/res/layout/item_gift_info_row.xml diff --git a/app/src/main/java/kr/co/vividnext/sodalive/v2/gift/ui/GiftInfoRows.kt b/app/src/main/java/kr/co/vividnext/sodalive/v2/gift/ui/GiftInfoRows.kt new file mode 100644 index 00000000..ef4b5d5b --- /dev/null +++ b/app/src/main/java/kr/co/vividnext/sodalive/v2/gift/ui/GiftInfoRows.kt @@ -0,0 +1,32 @@ +package kr.co.vividnext.sodalive.v2.gift.ui + +import android.view.LayoutInflater +import android.widget.LinearLayout +import androidx.core.view.updateLayoutParams +import kr.co.vividnext.sodalive.R +import kr.co.vividnext.sodalive.databinding.ItemGiftInfoRowBinding +import kotlin.math.roundToInt + +internal object GiftInfoRows { + fun bind(container: LinearLayout, rows: List>, labelWidth: Int = 84) { + container.removeAllViews() + rows.forEach { (label, value) -> + if (value != null) { + val binding = ItemGiftInfoRowBinding.inflate(LayoutInflater.from(container.context), container, false) + binding.label.setText(label) + binding.label.updateLayoutParams { + width = (labelWidth * container.resources.displayMetrics.density).roundToInt() + } + binding.value.text = value + binding.root.updateLayoutParams { + topMargin = if (container.childCount == 0) { + 0 + } else { + container.resources.getDimensionPixelSize(R.dimen.spacing_12) + } + } + container.addView(binding.root) + } + } + } +} diff --git a/app/src/main/res/layout/item_gift_info_row.xml b/app/src/main/res/layout/item_gift_info_row.xml new file mode 100644 index 00000000..8a7f6ee3 --- /dev/null +++ b/app/src/main/res/layout/item_gift_info_row.xml @@ -0,0 +1,20 @@ + + + + +