라이브 카드 태그 칩 표시
This commit is contained in:
@@ -60,8 +60,31 @@ class LiveNowAdapter(
|
|||||||
binding.tvFree.visibility = View.VISIBLE
|
binding.tvFree.visibility = View.VISIBLE
|
||||||
}
|
}
|
||||||
|
|
||||||
|
bindTags(item)
|
||||||
|
|
||||||
binding.root.setOnClickListener { onClick(item) }
|
binding.root.setOnClickListener { onClick(item) }
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private fun bindTags(item: GetRoomListResponse) {
|
||||||
|
val tags = item.tags.filter { it.isNotBlank() }.take(2)
|
||||||
|
if (tags.isEmpty()) {
|
||||||
|
binding.llTags.visibility = View.GONE
|
||||||
|
binding.tvTag1.visibility = View.GONE
|
||||||
|
binding.tvTag2.visibility = View.GONE
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
|
binding.llTags.visibility = View.VISIBLE
|
||||||
|
binding.tvTag1.text = tags[0]
|
||||||
|
binding.tvTag1.visibility = View.VISIBLE
|
||||||
|
|
||||||
|
if (tags.size > 1) {
|
||||||
|
binding.tvTag2.text = tags[1]
|
||||||
|
binding.tvTag2.visibility = View.VISIBLE
|
||||||
|
} else {
|
||||||
|
binding.tvTag2.visibility = View.GONE
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
override fun onCreateViewHolder(parent: ViewGroup, viewType: Int) = ViewHolder(
|
override fun onCreateViewHolder(parent: ViewGroup, viewType: Int) = ViewHolder(
|
||||||
|
|||||||
@@ -34,9 +34,14 @@ class LiveNowAllAdapter(
|
|||||||
|
|
||||||
val rootLayoutParams = binding.root.layoutParams
|
val rootLayoutParams = binding.root.layoutParams
|
||||||
rootLayoutParams.width = itemWidth
|
rootLayoutParams.width = itemWidth
|
||||||
rootLayoutParams.height = (baseCardHeight * scale).roundToInt()
|
rootLayoutParams.height = ViewGroup.LayoutParams.WRAP_CONTENT
|
||||||
binding.root.layoutParams = rootLayoutParams
|
binding.root.layoutParams = rootLayoutParams
|
||||||
|
|
||||||
|
val cardLayoutParams = binding.cardLiveNow.layoutParams
|
||||||
|
cardLayoutParams.width = itemWidth
|
||||||
|
cardLayoutParams.height = (baseCardHeight * scale).roundToInt()
|
||||||
|
binding.cardLiveNow.layoutParams = cardLayoutParams
|
||||||
|
|
||||||
val profileLayoutParams = binding.flProfile.layoutParams
|
val profileLayoutParams = binding.flProfile.layoutParams
|
||||||
profileLayoutParams.width = (84.dpToPx() * scale).roundToInt()
|
profileLayoutParams.width = (84.dpToPx() * scale).roundToInt()
|
||||||
profileLayoutParams.height = (84.dpToPx() * scale).roundToInt()
|
profileLayoutParams.height = (84.dpToPx() * scale).roundToInt()
|
||||||
@@ -80,9 +85,31 @@ class LiveNowAllAdapter(
|
|||||||
|
|
||||||
binding.tvTitle.text = item.title
|
binding.tvTitle.text = item.title
|
||||||
binding.tvNickname.text = item.creatorNickname
|
binding.tvNickname.text = item.creatorNickname
|
||||||
|
bindTags(item)
|
||||||
|
|
||||||
binding.root.setOnClickListener { onClick(item) }
|
binding.root.setOnClickListener { onClick(item) }
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private fun bindTags(item: GetRoomListResponse) {
|
||||||
|
val tags = item.tags.filter { it.isNotBlank() }.take(2)
|
||||||
|
if (tags.isEmpty()) {
|
||||||
|
binding.llTags.visibility = View.GONE
|
||||||
|
binding.tvTag1.visibility = View.GONE
|
||||||
|
binding.tvTag2.visibility = View.GONE
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
|
binding.llTags.visibility = View.VISIBLE
|
||||||
|
binding.tvTag1.text = tags[0]
|
||||||
|
binding.tvTag1.visibility = View.VISIBLE
|
||||||
|
|
||||||
|
if (tags.size > 1) {
|
||||||
|
binding.tvTag2.text = tags[1]
|
||||||
|
binding.tvTag2.visibility = View.VISIBLE
|
||||||
|
} else {
|
||||||
|
binding.tvTag2.visibility = View.GONE
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
override fun onCreateViewHolder(parent: ViewGroup, viewType: Int) = ViewHolder(
|
override fun onCreateViewHolder(parent: ViewGroup, viewType: Int) = ViewHolder(
|
||||||
|
|||||||
5
app/src/main/res/drawable/bg_round_corner_8_37474f.xml
Normal file
5
app/src/main/res/drawable/bg_round_corner_8_37474f.xml
Normal file
@@ -0,0 +1,5 @@
|
|||||||
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
|
<shape xmlns:android="http://schemas.android.com/apk/res/android">
|
||||||
|
<solid android:color="@color/color_37474f" />
|
||||||
|
<corners android:radius="8dp" />
|
||||||
|
</shape>
|
||||||
@@ -1,8 +1,14 @@
|
|||||||
<?xml version="1.0" encoding="utf-8"?>
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
<androidx.cardview.widget.CardView xmlns:android="http://schemas.android.com/apk/res/android"
|
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
|
||||||
xmlns:app="http://schemas.android.com/apk/res-auto"
|
xmlns:app="http://schemas.android.com/apk/res-auto"
|
||||||
xmlns:tools="http://schemas.android.com/tools"
|
xmlns:tools="http://schemas.android.com/tools"
|
||||||
android:layout_width="144dp"
|
android:layout_width="144dp"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:orientation="vertical">
|
||||||
|
|
||||||
|
<androidx.cardview.widget.CardView
|
||||||
|
android:id="@+id/card_live_now"
|
||||||
|
android:layout_width="match_parent"
|
||||||
android:layout_height="204dp"
|
android:layout_height="204dp"
|
||||||
app:cardBackgroundColor="#263238"
|
app:cardBackgroundColor="#263238"
|
||||||
app:cardCornerRadius="16dp">
|
app:cardCornerRadius="16dp">
|
||||||
@@ -149,4 +155,46 @@
|
|||||||
</LinearLayout>
|
</LinearLayout>
|
||||||
</FrameLayout>
|
</FrameLayout>
|
||||||
</androidx.constraintlayout.widget.ConstraintLayout>
|
</androidx.constraintlayout.widget.ConstraintLayout>
|
||||||
</androidx.cardview.widget.CardView>
|
</androidx.cardview.widget.CardView>
|
||||||
|
|
||||||
|
<LinearLayout
|
||||||
|
android:id="@+id/ll_tags"
|
||||||
|
android:layout_width="match_parent"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:layout_marginTop="8dp"
|
||||||
|
android:gravity="start|center_vertical"
|
||||||
|
android:orientation="horizontal"
|
||||||
|
android:visibility="gone">
|
||||||
|
|
||||||
|
<TextView
|
||||||
|
android:id="@+id/tv_tag_1"
|
||||||
|
android:layout_width="wrap_content"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:layout_marginEnd="4dp"
|
||||||
|
android:background="@drawable/bg_round_corner_8_37474f"
|
||||||
|
android:ellipsize="end"
|
||||||
|
android:fontFamily="@font/regular"
|
||||||
|
android:maxLines="1"
|
||||||
|
android:paddingHorizontal="8dp"
|
||||||
|
android:paddingVertical="4dp"
|
||||||
|
android:textColor="@color/white"
|
||||||
|
android:textSize="11sp"
|
||||||
|
android:visibility="gone"
|
||||||
|
tools:text="#팬미팅" />
|
||||||
|
|
||||||
|
<TextView
|
||||||
|
android:id="@+id/tv_tag_2"
|
||||||
|
android:layout_width="wrap_content"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:background="@drawable/bg_round_corner_8_37474f"
|
||||||
|
android:ellipsize="end"
|
||||||
|
android:fontFamily="@font/regular"
|
||||||
|
android:maxLines="1"
|
||||||
|
android:paddingHorizontal="8dp"
|
||||||
|
android:paddingVertical="4dp"
|
||||||
|
android:textColor="@color/white"
|
||||||
|
android:textSize="11sp"
|
||||||
|
android:visibility="gone"
|
||||||
|
tools:text="#힐링" />
|
||||||
|
</LinearLayout>
|
||||||
|
</LinearLayout>
|
||||||
|
|||||||
Reference in New Issue
Block a user