refactor(creator): 라이브 replay item을 공통화한다
This commit is contained in:
@@ -8,7 +8,7 @@ import android.view.ViewOutlineProvider
|
|||||||
import androidx.core.view.isVisible
|
import androidx.core.view.isVisible
|
||||||
import androidx.recyclerview.widget.RecyclerView
|
import androidx.recyclerview.widget.RecyclerView
|
||||||
import kr.co.vividnext.sodalive.R
|
import kr.co.vividnext.sodalive.R
|
||||||
import kr.co.vividnext.sodalive.databinding.ItemCreatorChannelLiveReplayBinding
|
import kr.co.vividnext.sodalive.databinding.ItemCreatorChannelAudioContentBinding
|
||||||
import kr.co.vividnext.sodalive.extensions.loadUrl
|
import kr.co.vividnext.sodalive.extensions.loadUrl
|
||||||
import kr.co.vividnext.sodalive.extensions.moneyFormat
|
import kr.co.vividnext.sodalive.extensions.moneyFormat
|
||||||
import kr.co.vividnext.sodalive.v2.creator.channel.live.model.CreatorChannelLiveReplayStatus
|
import kr.co.vividnext.sodalive.v2.creator.channel.live.model.CreatorChannelLiveReplayStatus
|
||||||
@@ -28,7 +28,7 @@ class CreatorChannelLiveReplayAdapter(
|
|||||||
|
|
||||||
override fun onCreateViewHolder(parent: ViewGroup, viewType: Int): ViewHolder {
|
override fun onCreateViewHolder(parent: ViewGroup, viewType: Int): ViewHolder {
|
||||||
return ViewHolder(
|
return ViewHolder(
|
||||||
ItemCreatorChannelLiveReplayBinding.inflate(LayoutInflater.from(parent.context), parent, false),
|
ItemCreatorChannelAudioContentBinding.inflate(LayoutInflater.from(parent.context), parent, false),
|
||||||
onReplayClick
|
onReplayClick
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
@@ -40,13 +40,13 @@ class CreatorChannelLiveReplayAdapter(
|
|||||||
override fun getItemCount(): Int = items.size
|
override fun getItemCount(): Int = items.size
|
||||||
|
|
||||||
class ViewHolder(
|
class ViewHolder(
|
||||||
private val binding: ItemCreatorChannelLiveReplayBinding,
|
private val binding: ItemCreatorChannelAudioContentBinding,
|
||||||
private val onReplayClick: (CreatorChannelLiveReplayUiModel) -> Unit
|
private val onReplayClick: (CreatorChannelLiveReplayUiModel) -> Unit
|
||||||
) : RecyclerView.ViewHolder(binding.root) {
|
) : RecyclerView.ViewHolder(binding.root) {
|
||||||
|
|
||||||
init {
|
init {
|
||||||
binding.layoutCreatorChannelLiveReplayThumbnail.clipToOutline = true
|
binding.layoutCreatorChannelAudioContentThumbnail.clipToOutline = true
|
||||||
binding.layoutCreatorChannelLiveReplayThumbnail.outlineProvider = object : ViewOutlineProvider() {
|
binding.layoutCreatorChannelAudioContentThumbnail.outlineProvider = object : ViewOutlineProvider() {
|
||||||
override fun getOutline(view: View, outline: Outline) {
|
override fun getOutline(view: View, outline: Outline) {
|
||||||
outline.setRoundRect(
|
outline.setRoundRect(
|
||||||
0,
|
0,
|
||||||
@@ -60,16 +60,16 @@ class CreatorChannelLiveReplayAdapter(
|
|||||||
}
|
}
|
||||||
|
|
||||||
fun bind(item: CreatorChannelLiveReplayUiModel) = with(binding) {
|
fun bind(item: CreatorChannelLiveReplayUiModel) = with(binding) {
|
||||||
ivCreatorChannelLiveReplayThumbnail.loadUrl(item.imageUrl)
|
ivCreatorChannelAudioContentThumbnail.loadUrl(item.imageUrl)
|
||||||
tvCreatorChannelLiveReplayTitle.text = item.title
|
tvCreatorChannelAudioContentTitle.text = item.title
|
||||||
tvCreatorChannelLiveReplayDuration.text = item.secondaryText.orEmpty()
|
tvCreatorChannelAudioContentSecondaryText.text = item.secondaryText.orEmpty()
|
||||||
tvCreatorChannelLiveReplayDuration.isVisible = !item.secondaryText.isNullOrBlank()
|
tvCreatorChannelAudioContentSecondaryText.isVisible = !item.secondaryText.isNullOrBlank()
|
||||||
ivCreatorChannelLiveReplayAdultBadge.setImageResource(R.drawable.ic_new_shield_small)
|
ivCreatorChannelAudioContentAdultBadge.setImageResource(R.drawable.ic_new_shield_small)
|
||||||
ivCreatorChannelLiveReplayAdultBadge.isVisible = item.showAdultBadge
|
ivCreatorChannelAudioContentAdultBadge.isVisible = item.showAdultBadge
|
||||||
bindTag(ivCreatorChannelLiveReplayOriginalTag, AudioContentTag.Original, item.tags)
|
bindTag(ivCreatorChannelAudioContentOriginalTag, AudioContentTag.Original, item.tags)
|
||||||
bindTag(ivCreatorChannelLiveReplayFirstTag, AudioContentTag.First, item.tags)
|
bindTag(ivCreatorChannelAudioContentFirstTag, AudioContentTag.First, item.tags)
|
||||||
bindTag(ivCreatorChannelLiveReplayPointTag, AudioContentTag.Point, item.tags)
|
bindTag(ivCreatorChannelAudioContentPointTag, AudioContentTag.Point, item.tags)
|
||||||
tvCreatorChannelLiveReplayFreeTag.isVisible = AudioContentTag.Free in item.tags
|
tvCreatorChannelAudioContentFreeTag.isVisible = AudioContentTag.Free in item.tags
|
||||||
bindStatus(item.status)
|
bindStatus(item.status)
|
||||||
root.setOnClickListener { onReplayClick(item) }
|
root.setOnClickListener { onReplayClick(item) }
|
||||||
}
|
}
|
||||||
@@ -79,29 +79,29 @@ class CreatorChannelLiveReplayAdapter(
|
|||||||
}
|
}
|
||||||
|
|
||||||
private fun bindStatus(status: CreatorChannelLiveReplayStatus) = with(binding) {
|
private fun bindStatus(status: CreatorChannelLiveReplayStatus) = with(binding) {
|
||||||
ivCreatorChannelLiveReplayPlay.setImageResource(R.drawable.ic_new_player_play)
|
ivCreatorChannelAudioContentPlay.setImageResource(R.drawable.ic_new_player_play)
|
||||||
when (status) {
|
when (status) {
|
||||||
CreatorChannelLiveReplayStatus.Play -> {
|
CreatorChannelLiveReplayStatus.Play -> {
|
||||||
ivCreatorChannelLiveReplayPlay.isVisible = true
|
ivCreatorChannelAudioContentPlay.isVisible = true
|
||||||
ivCreatorChannelLiveReplayCan.isVisible = false
|
ivCreatorChannelAudioContentCan.isVisible = false
|
||||||
layoutCreatorChannelLiveReplayActionText.isVisible = false
|
layoutCreatorChannelAudioContentActionText.isVisible = false
|
||||||
}
|
}
|
||||||
CreatorChannelLiveReplayStatus.Owned -> bindTextStatus(R.string.audio_content_badge_owned)
|
CreatorChannelLiveReplayStatus.Owned -> bindTextStatus(R.string.audio_content_badge_owned)
|
||||||
CreatorChannelLiveReplayStatus.Rented -> bindTextStatus(R.string.audio_content_badge_rented)
|
CreatorChannelLiveReplayStatus.Rented -> bindTextStatus(R.string.audio_content_badge_rented)
|
||||||
is CreatorChannelLiveReplayStatus.Price -> {
|
is CreatorChannelLiveReplayStatus.Price -> {
|
||||||
ivCreatorChannelLiveReplayPlay.isVisible = false
|
ivCreatorChannelAudioContentPlay.isVisible = false
|
||||||
layoutCreatorChannelLiveReplayActionText.isVisible = true
|
layoutCreatorChannelAudioContentActionText.isVisible = true
|
||||||
ivCreatorChannelLiveReplayCan.isVisible = true
|
ivCreatorChannelAudioContentCan.isVisible = true
|
||||||
tvCreatorChannelLiveReplayActionText.text = status.price.moneyFormat()
|
tvCreatorChannelAudioContentActionText.text = status.price.moneyFormat()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private fun bindTextStatus(textResId: Int) = with(binding) {
|
private fun bindTextStatus(textResId: Int) = with(binding) {
|
||||||
ivCreatorChannelLiveReplayPlay.isVisible = true
|
ivCreatorChannelAudioContentPlay.isVisible = true
|
||||||
layoutCreatorChannelLiveReplayActionText.isVisible = true
|
layoutCreatorChannelAudioContentActionText.isVisible = true
|
||||||
ivCreatorChannelLiveReplayCan.isVisible = false
|
ivCreatorChannelAudioContentCan.isVisible = false
|
||||||
tvCreatorChannelLiveReplayActionText.setText(textResId)
|
tvCreatorChannelAudioContentActionText.setText(textResId)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -193,7 +193,7 @@
|
|||||||
app:layout_constraintStart_toStartOf="parent"
|
app:layout_constraintStart_toStartOf="parent"
|
||||||
app:layout_constraintTop_toBottomOf="@id/layout_creator_channel_live_current_card"
|
app:layout_constraintTop_toBottomOf="@id/layout_creator_channel_live_current_card"
|
||||||
tools:itemCount="3"
|
tools:itemCount="3"
|
||||||
tools:listitem="@layout/item_creator_channel_live_replay" />
|
tools:listitem="@layout/item_creator_channel_audio_content" />
|
||||||
|
|
||||||
<FrameLayout
|
<FrameLayout
|
||||||
android:id="@+id/layout_creator_channel_live_empty"
|
android:id="@+id/layout_creator_channel_live_empty"
|
||||||
|
|||||||
@@ -9,7 +9,7 @@
|
|||||||
android:orientation="horizontal">
|
android:orientation="horizontal">
|
||||||
|
|
||||||
<FrameLayout
|
<FrameLayout
|
||||||
android:id="@+id/layout_creator_channel_live_replay_thumbnail"
|
android:id="@+id/layout_creator_channel_audio_content_thumbnail"
|
||||||
android:layout_width="88dp"
|
android:layout_width="88dp"
|
||||||
android:layout_height="88dp"
|
android:layout_height="88dp"
|
||||||
android:background="@drawable/bg_audio_content_card_thumbnail"
|
android:background="@drawable/bg_audio_content_card_thumbnail"
|
||||||
@@ -17,7 +17,7 @@
|
|||||||
android:outlineProvider="background">
|
android:outlineProvider="background">
|
||||||
|
|
||||||
<ImageView
|
<ImageView
|
||||||
android:id="@+id/iv_creator_channel_live_replay_thumbnail"
|
android:id="@+id/iv_creator_channel_audio_content_thumbnail"
|
||||||
android:layout_width="match_parent"
|
android:layout_width="match_parent"
|
||||||
android:layout_height="match_parent"
|
android:layout_height="match_parent"
|
||||||
android:contentDescription="@null"
|
android:contentDescription="@null"
|
||||||
@@ -25,7 +25,7 @@
|
|||||||
tools:src="@drawable/ic_launcher_background" />
|
tools:src="@drawable/ic_launcher_background" />
|
||||||
|
|
||||||
<ImageView
|
<ImageView
|
||||||
android:id="@+id/iv_creator_channel_live_replay_adult_badge"
|
android:id="@+id/iv_creator_channel_audio_content_adult_badge"
|
||||||
android:layout_width="18dp"
|
android:layout_width="18dp"
|
||||||
android:layout_height="18dp"
|
android:layout_height="18dp"
|
||||||
android:layout_gravity="top|end"
|
android:layout_gravity="top|end"
|
||||||
@@ -43,14 +43,14 @@
|
|||||||
android:orientation="horizontal">
|
android:orientation="horizontal">
|
||||||
|
|
||||||
<ImageView
|
<ImageView
|
||||||
android:id="@+id/iv_creator_channel_live_replay_original_tag"
|
android:id="@+id/iv_creator_channel_audio_content_original_tag"
|
||||||
android:layout_width="24dp"
|
android:layout_width="24dp"
|
||||||
android:layout_height="24dp"
|
android:layout_height="24dp"
|
||||||
android:contentDescription="@null"
|
android:contentDescription="@null"
|
||||||
android:src="@drawable/ic_content_tag_original" />
|
android:src="@drawable/ic_content_tag_original" />
|
||||||
|
|
||||||
<ImageView
|
<ImageView
|
||||||
android:id="@+id/iv_creator_channel_live_replay_first_tag"
|
android:id="@+id/iv_creator_channel_audio_content_first_tag"
|
||||||
android:layout_width="24dp"
|
android:layout_width="24dp"
|
||||||
android:layout_height="24dp"
|
android:layout_height="24dp"
|
||||||
android:background="@drawable/bg_audio_content_tag_first"
|
android:background="@drawable/bg_audio_content_tag_first"
|
||||||
@@ -66,14 +66,14 @@
|
|||||||
android:orientation="horizontal">
|
android:orientation="horizontal">
|
||||||
|
|
||||||
<ImageView
|
<ImageView
|
||||||
android:id="@+id/iv_creator_channel_live_replay_point_tag"
|
android:id="@+id/iv_creator_channel_audio_content_point_tag"
|
||||||
android:layout_width="24dp"
|
android:layout_width="24dp"
|
||||||
android:layout_height="24dp"
|
android:layout_height="24dp"
|
||||||
android:contentDescription="@null"
|
android:contentDescription="@null"
|
||||||
android:src="@drawable/ic_content_tag_point" />
|
android:src="@drawable/ic_content_tag_point" />
|
||||||
|
|
||||||
<TextView
|
<TextView
|
||||||
android:id="@+id/tv_creator_channel_live_replay_free_tag"
|
android:id="@+id/tv_creator_channel_audio_content_free_tag"
|
||||||
style="@style/Typography.Body6"
|
style="@style/Typography.Body6"
|
||||||
android:layout_width="wrap_content"
|
android:layout_width="wrap_content"
|
||||||
android:layout_height="24dp"
|
android:layout_height="24dp"
|
||||||
@@ -96,7 +96,7 @@
|
|||||||
android:orientation="vertical">
|
android:orientation="vertical">
|
||||||
|
|
||||||
<TextView
|
<TextView
|
||||||
android:id="@+id/tv_creator_channel_live_replay_title"
|
android:id="@+id/tv_creator_channel_audio_content_title"
|
||||||
style="@style/Typography.Body1"
|
style="@style/Typography.Body1"
|
||||||
android:layout_width="match_parent"
|
android:layout_width="match_parent"
|
||||||
android:layout_height="wrap_content"
|
android:layout_height="wrap_content"
|
||||||
@@ -107,7 +107,7 @@
|
|||||||
tools:text="라이브 다시 듣기 오디오 제목 라이브 다시 듣기 오디오 제목" />
|
tools:text="라이브 다시 듣기 오디오 제목 라이브 다시 듣기 오디오 제목" />
|
||||||
|
|
||||||
<TextView
|
<TextView
|
||||||
android:id="@+id/tv_creator_channel_live_replay_duration"
|
android:id="@+id/tv_creator_channel_audio_content_secondary_text"
|
||||||
style="@style/Typography.Body5"
|
style="@style/Typography.Body5"
|
||||||
android:layout_width="match_parent"
|
android:layout_width="match_parent"
|
||||||
android:layout_height="wrap_content"
|
android:layout_height="wrap_content"
|
||||||
@@ -120,14 +120,14 @@
|
|||||||
</LinearLayout>
|
</LinearLayout>
|
||||||
|
|
||||||
<LinearLayout
|
<LinearLayout
|
||||||
android:id="@+id/layout_creator_channel_live_replay_action"
|
android:id="@+id/layout_creator_channel_audio_content_action"
|
||||||
android:layout_width="wrap_content"
|
android:layout_width="wrap_content"
|
||||||
android:layout_height="match_parent"
|
android:layout_height="match_parent"
|
||||||
android:gravity="center"
|
android:gravity="center"
|
||||||
android:orientation="vertical">
|
android:orientation="vertical">
|
||||||
|
|
||||||
<ImageView
|
<ImageView
|
||||||
android:id="@+id/iv_creator_channel_live_replay_play"
|
android:id="@+id/iv_creator_channel_audio_content_play"
|
||||||
android:layout_width="28dp"
|
android:layout_width="28dp"
|
||||||
android:layout_height="28dp"
|
android:layout_height="28dp"
|
||||||
android:background="@drawable/bg_creator_channel_live_replay_play"
|
android:background="@drawable/bg_creator_channel_live_replay_play"
|
||||||
@@ -136,7 +136,7 @@
|
|||||||
android:src="@drawable/ic_new_player_play" />
|
android:src="@drawable/ic_new_player_play" />
|
||||||
|
|
||||||
<LinearLayout
|
<LinearLayout
|
||||||
android:id="@+id/layout_creator_channel_live_replay_action_text"
|
android:id="@+id/layout_creator_channel_audio_content_action_text"
|
||||||
android:layout_width="wrap_content"
|
android:layout_width="wrap_content"
|
||||||
android:layout_height="wrap_content"
|
android:layout_height="wrap_content"
|
||||||
android:layout_marginTop="@dimen/spacing_8"
|
android:layout_marginTop="@dimen/spacing_8"
|
||||||
@@ -144,14 +144,14 @@
|
|||||||
android:orientation="horizontal">
|
android:orientation="horizontal">
|
||||||
|
|
||||||
<ImageView
|
<ImageView
|
||||||
android:id="@+id/iv_creator_channel_live_replay_can"
|
android:id="@+id/iv_creator_channel_audio_content_can"
|
||||||
android:layout_width="18dp"
|
android:layout_width="18dp"
|
||||||
android:layout_height="18dp"
|
android:layout_height="18dp"
|
||||||
android:contentDescription="@null"
|
android:contentDescription="@null"
|
||||||
android:src="@drawable/ic_bar_cash" />
|
android:src="@drawable/ic_bar_cash" />
|
||||||
|
|
||||||
<TextView
|
<TextView
|
||||||
android:id="@+id/tv_creator_channel_live_replay_action_text"
|
android:id="@+id/tv_creator_channel_audio_content_action_text"
|
||||||
style="@style/Typography.Caption2"
|
style="@style/Typography.Caption2"
|
||||||
android:layout_width="wrap_content"
|
android:layout_width="wrap_content"
|
||||||
android:layout_height="wrap_content"
|
android:layout_height="wrap_content"
|
||||||
Reference in New Issue
Block a user