feat(gift): 선물 상세 정보 행을 추가한다
This commit is contained in:
@@ -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<Pair<Int, String?>>, 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<LinearLayout.LayoutParams> {
|
||||||
|
width = (labelWidth * container.resources.displayMetrics.density).roundToInt()
|
||||||
|
}
|
||||||
|
binding.value.text = value
|
||||||
|
binding.root.updateLayoutParams<LinearLayout.LayoutParams> {
|
||||||
|
topMargin = if (container.childCount == 0) {
|
||||||
|
0
|
||||||
|
} else {
|
||||||
|
container.resources.getDimensionPixelSize(R.dimen.spacing_12)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
container.addView(binding.root)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,20 @@
|
|||||||
|
<?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="horizontal">
|
||||||
|
<TextView
|
||||||
|
android:id="@+id/label"
|
||||||
|
style="@style/Typography.Body6"
|
||||||
|
android:layout_width="84dp"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:textColor="@color/gray_400" />
|
||||||
|
<TextView
|
||||||
|
android:id="@+id/value"
|
||||||
|
style="@style/Typography.Body6"
|
||||||
|
android:layout_width="0dp"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:layout_marginStart="@dimen/spacing_12"
|
||||||
|
android:layout_weight="1"
|
||||||
|
android:textColor="@color/white" />
|
||||||
|
</LinearLayout>
|
||||||
Reference in New Issue
Block a user