feat(creator): 채널 홈 오디오 콘텐츠 카드를 추가한다

This commit is contained in:
2026-06-15 15:01:21 +09:00
parent 573df4318b
commit edb7d98de7
2 changed files with 164 additions and 0 deletions

View File

@@ -0,0 +1,53 @@
package kr.co.vividnext.sodalive.v2.creator.channel.ui
import android.content.Context
import android.graphics.Outline
import android.util.AttributeSet
import android.view.View
import android.view.ViewOutlineProvider
import android.widget.FrameLayout
import android.widget.ImageView
import android.widget.TextView
import androidx.core.view.isVisible
import kr.co.vividnext.sodalive.R
import kr.co.vividnext.sodalive.extensions.loadUrl
import kr.co.vividnext.sodalive.v2.creator.channel.data.CreatorChannelAudioContentResponse
class CreatorChannelHomeAudioContentCardView @JvmOverloads constructor(
context: Context,
attrs: AttributeSet? = null,
defStyleAttr: Int = 0
) : FrameLayout(context, attrs, defStyleAttr) {
private val thumbnailContainer: View by lazy { findViewById(R.id.layout_audio_content_thumbnail) }
private val thumbnail: ImageView by lazy { findViewById(R.id.iv_audio_content_thumbnail) }
private val originalTag: ImageView by lazy { findViewById(R.id.iv_audio_content_original_tag) }
private val pointTag: ImageView by lazy { findViewById(R.id.iv_audio_content_point_tag) }
private val firstTag: ImageView by lazy { findViewById(R.id.iv_audio_content_first_tag) }
private val freeTag: TextView by lazy { findViewById(R.id.tv_audio_content_free_tag) }
private val title: TextView by lazy { findViewById(R.id.tv_audio_content_title) }
private val secondary: TextView by lazy { findViewById(R.id.tv_audio_content_secondary) }
override fun onFinishInflate() {
super.onFinishInflate()
thumbnailContainer.clipToOutline = true
thumbnailContainer.outlineProvider = object : ViewOutlineProvider() {
override fun getOutline(view: View, outline: Outline) {
outline.setRoundRect(0, 0, view.width, view.height, resources.getDimension(R.dimen.radius_14))
}
}
}
fun bind(audioContent: CreatorChannelAudioContentResponse) {
title.text = audioContent.title
secondary.text = listOfNotNull(audioContent.duration, audioContent.seriesName).joinToCreatorChannelAudioText()
thumbnail.loadUrl(audioContent.imageUrl)
originalTag.isVisible = audioContent.isOriginalSeries == true
pointTag.isVisible = audioContent.isPointAvailable
firstTag.isVisible = audioContent.isFirstContent
freeTag.isVisible = audioContent.price <= 0
}
private fun List<String?>.joinToCreatorChannelAudioText(): String =
filterNot { it.isNullOrBlank() }.joinToString(separator = "") { it.orEmpty() }
}