feat(creator-channel): 커뮤니티 목록 클릭을 연결한다
This commit is contained in:
@@ -13,7 +13,9 @@ import kr.co.vividnext.sodalive.extensions.moneyFormat
|
||||
import kr.co.vividnext.sodalive.v2.creator.channel.community.model.CreatorChannelCommunityImageMode
|
||||
import kr.co.vividnext.sodalive.v2.creator.channel.community.model.CreatorChannelCommunityPostUiModel
|
||||
|
||||
class CreatorChannelCommunityGridAdapter : RecyclerView.Adapter<CreatorChannelCommunityGridAdapter.ViewHolder>() {
|
||||
class CreatorChannelCommunityGridAdapter(
|
||||
private val onPostClick: (CreatorChannelCommunityPostUiModel) -> Unit = {}
|
||||
) : RecyclerView.Adapter<CreatorChannelCommunityGridAdapter.ViewHolder>() {
|
||||
|
||||
private var items: List<CreatorChannelCommunityPostUiModel> = emptyList()
|
||||
private var itemSizePx: Int = 0
|
||||
@@ -31,7 +33,10 @@ class CreatorChannelCommunityGridAdapter : RecyclerView.Adapter<CreatorChannelCo
|
||||
}
|
||||
|
||||
override fun onCreateViewHolder(parent: ViewGroup, viewType: Int): ViewHolder {
|
||||
return ViewHolder(ItemCreatorChannelCommunityGridBinding.inflate(LayoutInflater.from(parent.context), parent, false))
|
||||
return ViewHolder(
|
||||
ItemCreatorChannelCommunityGridBinding.inflate(LayoutInflater.from(parent.context), parent, false),
|
||||
onPostClick
|
||||
)
|
||||
}
|
||||
|
||||
override fun onBindViewHolder(holder: ViewHolder, position: Int) {
|
||||
@@ -41,10 +46,12 @@ class CreatorChannelCommunityGridAdapter : RecyclerView.Adapter<CreatorChannelCo
|
||||
override fun getItemCount(): Int = items.size
|
||||
|
||||
class ViewHolder(
|
||||
private val binding: ItemCreatorChannelCommunityGridBinding
|
||||
private val binding: ItemCreatorChannelCommunityGridBinding,
|
||||
private val onPostClick: (CreatorChannelCommunityPostUiModel) -> Unit
|
||||
) : RecyclerView.ViewHolder(binding.root) {
|
||||
|
||||
fun bind(item: CreatorChannelCommunityPostUiModel, itemSizePx: Int) = with(binding) {
|
||||
root.setOnClickListener { onPostClick(item) }
|
||||
if (itemSizePx > 0) {
|
||||
root.layoutParams = root.layoutParams.apply {
|
||||
width = itemSizePx
|
||||
|
||||
@@ -17,6 +17,7 @@ import kr.co.vividnext.sodalive.extensions.moneyFormat
|
||||
import kr.co.vividnext.sodalive.v2.creator.channel.community.model.CreatorChannelCommunityPostUiModel
|
||||
|
||||
class CreatorChannelCommunityListAdapter(
|
||||
private val onPostClick: (CreatorChannelCommunityPostUiModel) -> Unit = {},
|
||||
private val onPlayClick: (CreatorChannelCommunityPostUiModel) -> Unit = {},
|
||||
private val onOwnerMoreClick: (CreatorChannelCommunityPostUiModel) -> Unit = {},
|
||||
private val isPlayingContent: (Long) -> Boolean = { false }
|
||||
@@ -32,6 +33,7 @@ class CreatorChannelCommunityListAdapter(
|
||||
override fun onCreateViewHolder(parent: ViewGroup, viewType: Int): ViewHolder {
|
||||
return ViewHolder(
|
||||
ItemCreatorChannelCommunityListBinding.inflate(LayoutInflater.from(parent.context), parent, false),
|
||||
onPostClick,
|
||||
onPlayClick,
|
||||
onOwnerMoreClick,
|
||||
isPlayingContent
|
||||
@@ -46,12 +48,14 @@ class CreatorChannelCommunityListAdapter(
|
||||
|
||||
class ViewHolder(
|
||||
private val binding: ItemCreatorChannelCommunityListBinding,
|
||||
private val onPostClick: (CreatorChannelCommunityPostUiModel) -> Unit,
|
||||
private val onPlayClick: (CreatorChannelCommunityPostUiModel) -> Unit,
|
||||
private val onOwnerMoreClick: (CreatorChannelCommunityPostUiModel) -> Unit,
|
||||
private val isPlayingContent: (Long) -> Boolean
|
||||
) : RecyclerView.ViewHolder(binding.root) {
|
||||
|
||||
fun bind(item: CreatorChannelCommunityPostUiModel) = with(binding) {
|
||||
root.setOnClickListener { onPostClick(item) }
|
||||
ivCreatorChannelCommunityListProfile.loadUrl(item.creatorProfileUrl) {
|
||||
crossfade(true)
|
||||
placeholder(R.drawable.bg_placeholder)
|
||||
|
||||
Reference in New Issue
Block a user