한정판 콘텐츠 상세
- 해당 콘텐츠를 업로드 한 크리에이터가 콘텐츠 구매자를 볼 수 있는 UI 추가
This commit is contained in:
@@ -0,0 +1,56 @@
|
||||
package kr.co.vividnext.sodalive.audio_content.detail
|
||||
|
||||
import android.annotation.SuppressLint
|
||||
import android.view.LayoutInflater
|
||||
import android.view.ViewGroup
|
||||
import androidx.recyclerview.widget.RecyclerView
|
||||
import coil.load
|
||||
import coil.transform.CircleCropTransformation
|
||||
import kr.co.vividnext.sodalive.R
|
||||
import kr.co.vividnext.sodalive.databinding.ItemLiveRoomDetailUserBinding
|
||||
|
||||
class AudioContentBuyerAdapter : RecyclerView.Adapter<AudioContentBuyerAdapter.ViewHolder>() {
|
||||
|
||||
private val items = mutableListOf<ContentBuyer>()
|
||||
|
||||
inner class ViewHolder(
|
||||
private val binding: ItemLiveRoomDetailUserBinding
|
||||
) : RecyclerView.ViewHolder(binding.root) {
|
||||
fun bind(item: ContentBuyer) {
|
||||
binding.tvNickname.text = item.nickname
|
||||
binding.ivProfile.load(item.profileImageUrl) {
|
||||
crossfade(true)
|
||||
placeholder(R.drawable.ic_place_holder)
|
||||
transformations(CircleCropTransformation())
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
override fun onCreateViewHolder(
|
||||
parent: ViewGroup,
|
||||
viewType: Int
|
||||
): ViewHolder {
|
||||
return ViewHolder(
|
||||
ItemLiveRoomDetailUserBinding.inflate(
|
||||
LayoutInflater.from(parent.context),
|
||||
parent,
|
||||
false
|
||||
)
|
||||
)
|
||||
}
|
||||
|
||||
override fun onBindViewHolder(
|
||||
holder: ViewHolder,
|
||||
position: Int
|
||||
) {
|
||||
holder.bind(items[position])
|
||||
}
|
||||
|
||||
override fun getItemCount() = items.count()
|
||||
|
||||
@SuppressLint("NotifyDataSetChanged")
|
||||
fun addItems(buyerList: List<ContentBuyer>) {
|
||||
items.addAll(buyerList)
|
||||
notifyDataSetChanged()
|
||||
}
|
||||
}
|
||||
@@ -81,6 +81,7 @@ class AudioContentDetailActivity : BaseActivity<ActivityAudioContentDetailBindin
|
||||
private var title = ""
|
||||
|
||||
private lateinit var activityResultLauncher: ActivityResultLauncher<Intent>
|
||||
private lateinit var contentBuyerAdapter: AudioContentBuyerAdapter
|
||||
private lateinit var audioContent: GetAudioContentDetailResponse
|
||||
private lateinit var orderType: OrderType
|
||||
private lateinit var imm: InputMethodManager
|
||||
@@ -298,6 +299,36 @@ class AudioContentDetailActivity : BaseActivity<ActivityAudioContentDetailBindin
|
||||
|
||||
dialog.show(screenWidth - 26.7f.dpToPx().toInt())
|
||||
}
|
||||
|
||||
setupBuyerList()
|
||||
}
|
||||
|
||||
private fun setupBuyerList() {
|
||||
val recyclerView = binding.rvBuyer
|
||||
contentBuyerAdapter = AudioContentBuyerAdapter()
|
||||
|
||||
recyclerView.layoutManager = LinearLayoutManager(
|
||||
this,
|
||||
LinearLayoutManager.HORIZONTAL,
|
||||
false
|
||||
)
|
||||
|
||||
recyclerView.addItemDecoration(object : RecyclerView.ItemDecoration() {
|
||||
override fun getItemOffsets(
|
||||
outRect: Rect,
|
||||
view: View,
|
||||
parent: RecyclerView,
|
||||
state: RecyclerView.State
|
||||
) {
|
||||
super.getItemOffsets(outRect, view, parent, state)
|
||||
|
||||
outRect.top = 6.7f.dpToPx().toInt()
|
||||
outRect.bottom = 6.7f.dpToPx().toInt()
|
||||
outRect.left = 6.7f.dpToPx().toInt()
|
||||
outRect.right = 6.7f.dpToPx().toInt()
|
||||
}
|
||||
})
|
||||
recyclerView.adapter = contentBuyerAdapter
|
||||
}
|
||||
|
||||
private fun donation(can: Int, message: String) {
|
||||
@@ -924,8 +955,16 @@ class AudioContentDetailActivity : BaseActivity<ActivityAudioContentDetailBindin
|
||||
|
||||
binding.tvRemainingCount.text = "${response.remainingContentCount}"
|
||||
}
|
||||
|
||||
if (response.buyerList.isNotEmpty()) {
|
||||
binding.rvBuyer.visibility = View.VISIBLE
|
||||
binding.tvBuyerTitle.visibility = View.VISIBLE
|
||||
contentBuyerAdapter.addItems(response.buyerList)
|
||||
}
|
||||
} else {
|
||||
binding.rlLimitedEdition.visibility = View.GONE
|
||||
binding.rvBuyer.visibility = View.GONE
|
||||
binding.tvBuyerTitle.visibility = View.GONE
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -41,7 +41,8 @@ data class GetAudioContentDetailResponse(
|
||||
@SerializedName("isAvailablePin") val isAvailablePin: Boolean,
|
||||
@SerializedName("creator") val creator: AudioContentCreator,
|
||||
@SerializedName("previousContent") val previousContent: OtherContentResponse?,
|
||||
@SerializedName("nextContent") val nextContent: OtherContentResponse?
|
||||
@SerializedName("nextContent") val nextContent: OtherContentResponse?,
|
||||
@SerializedName("buyerList") val buyerList: List<ContentBuyer>
|
||||
)
|
||||
|
||||
@Keep
|
||||
@@ -60,3 +61,9 @@ data class AudioContentCreator(
|
||||
@SerializedName("isFollow") var isFollow: Boolean,
|
||||
@SerializedName("isNotify") var isNotify: Boolean
|
||||
)
|
||||
|
||||
@Keep
|
||||
data class ContentBuyer(
|
||||
@SerializedName("nickname") val nickname: String,
|
||||
@SerializedName("profileImageUrl") val profileImageUrl: String
|
||||
)
|
||||
|
||||
Reference in New Issue
Block a user