탐색 - 크리에이터 랭킹 UI 추가
This commit is contained in:
parent
41d175a19f
commit
2f17e04e1e
|
@ -67,7 +67,10 @@ class ExplorerAdapter(
|
|||
}
|
||||
|
||||
private fun setCreatorList(item: GetExplorerSectionResponse) {
|
||||
val adapter = ExplorerSectionAdapter(onClickItem = onClickItem)
|
||||
val adapter = ExplorerSectionAdapter(
|
||||
onClickItem = onClickItem,
|
||||
isVisibleRanking = item.desc != null
|
||||
)
|
||||
|
||||
binding.rvExplorerSection.layoutManager = LinearLayoutManager(
|
||||
context,
|
||||
|
|
|
@ -85,17 +85,17 @@ class ExplorerFragment : BaseFragment<FragmentExplorerBinding>(
|
|||
when (parent.getChildAdapterPosition(view)) {
|
||||
0 -> {
|
||||
outRect.top = 0
|
||||
outRect.bottom = 30f.dpToPx().toInt()
|
||||
outRect.bottom = 15f.dpToPx().toInt()
|
||||
}
|
||||
|
||||
adapter.itemCount - 1 -> {
|
||||
outRect.top = 30f.dpToPx().toInt()
|
||||
outRect.top = 15f.dpToPx().toInt()
|
||||
outRect.bottom = 0
|
||||
}
|
||||
|
||||
else -> {
|
||||
outRect.top = 30f.dpToPx().toInt()
|
||||
outRect.bottom = 30f.dpToPx().toInt()
|
||||
outRect.top = 15f.dpToPx().toInt()
|
||||
outRect.bottom = 15f.dpToPx().toInt()
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -2,6 +2,7 @@ package kr.co.vividnext.sodalive.explorer
|
|||
|
||||
import android.annotation.SuppressLint
|
||||
import android.view.LayoutInflater
|
||||
import android.view.View
|
||||
import android.view.ViewGroup
|
||||
import androidx.recyclerview.widget.RecyclerView
|
||||
import coil.load
|
||||
|
@ -10,7 +11,8 @@ import kr.co.vividnext.sodalive.R
|
|||
import kr.co.vividnext.sodalive.databinding.ItemExplorerSectionBinding
|
||||
|
||||
class ExplorerSectionAdapter(
|
||||
private val onClickItem: (Long) -> Unit
|
||||
private val onClickItem: (Long) -> Unit,
|
||||
private val isVisibleRanking: Boolean
|
||||
) : RecyclerView.Adapter<ExplorerSectionAdapter.ViewHolder>() {
|
||||
|
||||
private val items = mutableListOf<GetExplorerSectionCreatorResponse>()
|
||||
|
@ -18,7 +20,8 @@ class ExplorerSectionAdapter(
|
|||
inner class ViewHolder(
|
||||
private val binding: ItemExplorerSectionBinding
|
||||
) : RecyclerView.ViewHolder(binding.root) {
|
||||
fun bind(item: GetExplorerSectionCreatorResponse) {
|
||||
fun bind(item: GetExplorerSectionCreatorResponse, index: Int) {
|
||||
binding.root.setOnClickListener { onClickItem(item.id) }
|
||||
binding.tvNickname.text = item.nickname
|
||||
binding.tvTags.text = item.tags
|
||||
|
||||
|
@ -28,7 +31,39 @@ class ExplorerSectionAdapter(
|
|||
crossfade(true)
|
||||
}
|
||||
|
||||
binding.root.setOnClickListener { onClickItem(item.id) }
|
||||
if (isVisibleRanking) {
|
||||
when (index) {
|
||||
0 -> {
|
||||
binding.ivBg.setImageResource(R.drawable.bg_circle_ffdc00_ffb600)
|
||||
binding.ivBg.visibility = View.VISIBLE
|
||||
|
||||
binding.ivCrown.setImageResource(R.drawable.ic_crown_1)
|
||||
binding.ivCrown.visibility = View.VISIBLE
|
||||
}
|
||||
|
||||
1 -> {
|
||||
binding.ivBg.setImageResource(R.drawable.bg_circle_ffffff_9f9f9f)
|
||||
binding.ivBg.visibility = View.VISIBLE
|
||||
|
||||
binding.ivCrown.setImageResource(R.drawable.ic_crown_2)
|
||||
binding.ivCrown.visibility = View.VISIBLE
|
||||
}
|
||||
|
||||
2 -> {
|
||||
binding.ivBg.setImageResource(R.drawable.bg_circle_e6a77a_c67e4a)
|
||||
binding.ivBg.visibility = View.VISIBLE
|
||||
|
||||
binding.ivCrown.setImageResource(R.drawable.ic_crown_3)
|
||||
binding.ivCrown.visibility = View.VISIBLE
|
||||
}
|
||||
|
||||
else -> {
|
||||
binding.ivBg.setImageResource(0)
|
||||
binding.ivBg.visibility = View.GONE
|
||||
binding.ivCrown.visibility = View.GONE
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -41,7 +76,7 @@ class ExplorerSectionAdapter(
|
|||
)
|
||||
|
||||
override fun onBindViewHolder(holder: ViewHolder, position: Int) {
|
||||
holder.bind(items[position])
|
||||
holder.bind(items[position], index = position)
|
||||
}
|
||||
|
||||
override fun getItemCount() = items.size
|
||||
|
|
|
@ -5,14 +5,35 @@
|
|||
android:layout_width="93.3dp"
|
||||
android:layout_height="wrap_content">
|
||||
|
||||
<ImageView
|
||||
android:id="@+id/iv_profile"
|
||||
android:layout_width="0dp"
|
||||
<RelativeLayout
|
||||
android:id="@+id/rl_profile"
|
||||
android:layout_width="93.3dp"
|
||||
android:layout_height="93.3dp"
|
||||
android:contentDescription="@null"
|
||||
app:layout_constraintEnd_toEndOf="parent"
|
||||
app:layout_constraintStart_toStartOf="parent"
|
||||
app:layout_constraintTop_toTopOf="parent" />
|
||||
app:layout_constraintTop_toTopOf="parent">
|
||||
|
||||
<ImageView
|
||||
android:id="@+id/iv_bg"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"
|
||||
android:contentDescription="@null" />
|
||||
|
||||
<ImageView
|
||||
android:id="@+id/iv_profile"
|
||||
android:layout_width="90dp"
|
||||
android:layout_height="90dp"
|
||||
android:layout_centerInParent="true"
|
||||
android:contentDescription="@null" />
|
||||
|
||||
<ImageView
|
||||
android:id="@+id/iv_crown"
|
||||
android:layout_width="37dp"
|
||||
android:layout_height="37dp"
|
||||
android:layout_alignParentEnd="true"
|
||||
android:layout_alignParentBottom="true"
|
||||
android:contentDescription="@null" />
|
||||
</RelativeLayout>
|
||||
|
||||
<TextView
|
||||
android:id="@+id/tv_nickname"
|
||||
|
@ -27,7 +48,7 @@
|
|||
android:textSize="11.3sp"
|
||||
app:layout_constraintEnd_toEndOf="parent"
|
||||
app:layout_constraintStart_toStartOf="parent"
|
||||
app:layout_constraintTop_toBottomOf="@+id/iv_profile"
|
||||
app:layout_constraintTop_toBottomOf="@+id/rl_profile"
|
||||
tools:text="상남자12039" />
|
||||
|
||||
<TextView
|
||||
|
@ -44,7 +65,7 @@
|
|||
app:layout_constraintEnd_toEndOf="parent"
|
||||
app:layout_constraintStart_toStartOf="parent"
|
||||
app:layout_constraintTop_toBottomOf="@+id/tv_nickname"
|
||||
tools:text="#연애 #일상 #훈련"
|
||||
tools:ignore="SmallSp" />
|
||||
tools:ignore="SmallSp"
|
||||
tools:text="#연애 #일상 #훈련" />
|
||||
|
||||
</androidx.constraintlayout.widget.ConstraintLayout>
|
||||
|
|
Loading…
Reference in New Issue