탐색 - 섹션 제목 아래에 description 추가
This commit is contained in:
@@ -12,7 +12,6 @@ import android.view.View
|
||||
import android.view.ViewGroup
|
||||
import androidx.recyclerview.widget.LinearLayoutManager
|
||||
import androidx.recyclerview.widget.RecyclerView
|
||||
import com.google.android.gms.ads.AdRequest
|
||||
import kr.co.vividnext.sodalive.databinding.ItemExplorerBinding
|
||||
import kr.co.vividnext.sodalive.extensions.dpToPx
|
||||
|
||||
@@ -26,21 +25,10 @@ class ExplorerAdapter(
|
||||
private val context: Context,
|
||||
private val binding: ItemExplorerBinding
|
||||
) : RecyclerView.ViewHolder(binding.root) {
|
||||
fun bind(item: GetExplorerSectionResponse, index: Int) {
|
||||
fun bind(item: GetExplorerSectionResponse) {
|
||||
setTitle(item)
|
||||
setDesc(item)
|
||||
setCreatorList(item)
|
||||
|
||||
if (index == 1) {
|
||||
setupAdMob()
|
||||
} else {
|
||||
binding.adView.visibility = View.GONE
|
||||
}
|
||||
}
|
||||
|
||||
private fun setupAdMob() {
|
||||
val adRequest = AdRequest.Builder().build()
|
||||
binding.adView.visibility = View.VISIBLE
|
||||
binding.adView.loadAd(adRequest)
|
||||
}
|
||||
|
||||
private fun setTitle(item: GetExplorerSectionResponse) {
|
||||
@@ -69,6 +57,15 @@ class ExplorerAdapter(
|
||||
}
|
||||
}
|
||||
|
||||
private fun setDesc(item: GetExplorerSectionResponse) {
|
||||
if (item.desc != null) {
|
||||
binding.tvDesc.visibility = View.VISIBLE
|
||||
binding.tvDesc.text = item.desc
|
||||
} else {
|
||||
binding.tvDesc.visibility = View.GONE
|
||||
}
|
||||
}
|
||||
|
||||
private fun setCreatorList(item: GetExplorerSectionResponse) {
|
||||
val adapter = ExplorerSectionAdapter(onClickItem = onClickItem)
|
||||
|
||||
@@ -121,7 +118,7 @@ class ExplorerAdapter(
|
||||
)
|
||||
|
||||
override fun onBindViewHolder(holder: ViewHolder, position: Int) {
|
||||
holder.bind(items[position], index = position)
|
||||
holder.bind(items[position])
|
||||
}
|
||||
|
||||
override fun getItemCount() = items.size
|
||||
|
@@ -10,6 +10,7 @@ data class GetExplorerSectionResponse(
|
||||
@SerializedName("title") val title: String,
|
||||
@SerializedName("coloredTitle") val coloredTitle: String?,
|
||||
@SerializedName("color") val color: String?,
|
||||
@SerializedName("desc") val desc: String?,
|
||||
@SerializedName("creators") val creators: List<GetExplorerSectionCreatorResponse>
|
||||
)
|
||||
|
||||
|
Reference in New Issue
Block a user