fix(home): 팔로잉 크리에이터 전체 버튼을 고정한다
This commit is contained in:
@@ -115,8 +115,7 @@ class HomeMainFragment : BaseFragment<FragmentV2MainHomeBinding>(
|
||||
private val popularCommunityAdapter = HomePopularCommunityAdapter { openPopularCommunityPost(it) }
|
||||
private val creatorRankingAdapter = CreatorRankingAdapter { openCreatorRankingProfile(it) }
|
||||
private val followingCreatorAdapter = HomeFollowingCreatorAdapter(
|
||||
onClickItem = { openCreatorProfile(it.creatorId) },
|
||||
onClickAll = { openFollowingCreatorAll() }
|
||||
onClickItem = { openCreatorProfile(it.creatorId) }
|
||||
)
|
||||
private val followingLiveAdapter = HomeFollowingLiveAdapter { onFollowingLiveClick(it) }
|
||||
private val followingChatAdapter = HomeFollowingChatAdapter { openFollowingChat(it) }
|
||||
@@ -264,6 +263,7 @@ class HomeMainFragment : BaseFragment<FragmentV2MainHomeBinding>(
|
||||
}
|
||||
|
||||
private fun setUpFollowingAdapters() {
|
||||
binding.tvHomeFollowingCreatorAll.setOnClickListener { openFollowingCreatorAll() }
|
||||
binding.rvHomeFollowingCreators.apply {
|
||||
layoutManager = LinearLayoutManager(requireContext(), LinearLayoutManager.HORIZONTAL, false)
|
||||
adapter = followingCreatorAdapter
|
||||
|
||||
+9
-35
@@ -10,9 +10,8 @@ import kr.co.vividnext.sodalive.R
|
||||
import kr.co.vividnext.sodalive.v2.main.home.model.HomeFollowingCreatorUiItem
|
||||
|
||||
class HomeFollowingCreatorAdapter(
|
||||
private val onClickItem: (HomeFollowingCreatorUiItem) -> Unit = {},
|
||||
private val onClickAll: () -> Unit = {}
|
||||
) : RecyclerView.Adapter<RecyclerView.ViewHolder>() {
|
||||
private val onClickItem: (HomeFollowingCreatorUiItem) -> Unit = {}
|
||||
) : RecyclerView.Adapter<HomeFollowingCreatorAdapter.CreatorViewHolder>() {
|
||||
private var items: List<HomeFollowingCreatorUiItem> = emptyList()
|
||||
|
||||
fun submitItems(items: List<HomeFollowingCreatorUiItem>) {
|
||||
@@ -20,29 +19,18 @@ class HomeFollowingCreatorAdapter(
|
||||
notifyDataSetChanged()
|
||||
}
|
||||
|
||||
override fun onCreateViewHolder(parent: ViewGroup, viewType: Int): RecyclerView.ViewHolder {
|
||||
val layoutResId = when (viewType) {
|
||||
VIEW_TYPE_ALL -> R.layout.item_home_following_creator_all
|
||||
else -> R.layout.item_home_following_creator
|
||||
}
|
||||
val view = LayoutInflater.from(parent.context).inflate(layoutResId, parent, false)
|
||||
override fun onCreateViewHolder(parent: ViewGroup, viewType: Int): CreatorViewHolder {
|
||||
val view = LayoutInflater.from(parent.context)
|
||||
.inflate(R.layout.item_home_following_creator, parent, false)
|
||||
view.layoutParams = recyclerItemLayoutParams(parent)
|
||||
return when (viewType) {
|
||||
VIEW_TYPE_ALL -> AllViewHolder(view, onClickAll)
|
||||
else -> CreatorViewHolder(view, onClickItem)
|
||||
}
|
||||
return CreatorViewHolder(view, onClickItem)
|
||||
}
|
||||
|
||||
override fun onBindViewHolder(holder: RecyclerView.ViewHolder, position: Int) {
|
||||
when (holder) {
|
||||
is AllViewHolder -> holder.bind()
|
||||
is CreatorViewHolder -> holder.bind(items[position])
|
||||
}
|
||||
override fun onBindViewHolder(holder: CreatorViewHolder, position: Int) {
|
||||
holder.bind(items[position])
|
||||
}
|
||||
|
||||
override fun getItemCount(): Int = items.size + if (items.isNotEmpty()) 1 else 0
|
||||
|
||||
override fun getItemViewType(position: Int): Int = if (position < items.size) VIEW_TYPE_CREATOR else VIEW_TYPE_ALL
|
||||
override fun getItemCount(): Int = items.size
|
||||
|
||||
class CreatorViewHolder(
|
||||
itemView: View,
|
||||
@@ -57,18 +45,4 @@ class HomeFollowingCreatorAdapter(
|
||||
itemView.setOnClickListener { onClickItem(item) }
|
||||
}
|
||||
}
|
||||
|
||||
class AllViewHolder(
|
||||
itemView: View,
|
||||
private val onClickAll: () -> Unit
|
||||
) : RecyclerView.ViewHolder(itemView) {
|
||||
fun bind() {
|
||||
itemView.setOnClickListener { onClickAll() }
|
||||
}
|
||||
}
|
||||
|
||||
private companion object {
|
||||
private const val VIEW_TYPE_CREATOR = 0
|
||||
private const val VIEW_TYPE_ALL = 1
|
||||
}
|
||||
}
|
||||
|
||||
@@ -276,17 +276,29 @@
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginTop="@dimen/spacing_12"
|
||||
android:orientation="vertical">
|
||||
android:orientation="horizontal">
|
||||
|
||||
<androidx.recyclerview.widget.RecyclerView
|
||||
android:id="@+id/rv_home_following_creators"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_width="0dp"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_weight="1"
|
||||
android:clipToPadding="false"
|
||||
android:orientation="horizontal"
|
||||
android:paddingHorizontal="@dimen/spacing_14"
|
||||
android:paddingHorizontal="@dimen/spacing_20"
|
||||
app:layoutManager="androidx.recyclerview.widget.LinearLayoutManager"
|
||||
tools:listitem="@layout/item_home_following_creator" />
|
||||
|
||||
<TextView
|
||||
android:id="@+id/tv_home_following_creator_all"
|
||||
style="@style/Typography.Body5"
|
||||
android:layout_width="@dimen/home_live_more_width"
|
||||
android:layout_height="@dimen/home_live_row_height"
|
||||
android:layout_marginEnd="@dimen/spacing_20"
|
||||
android:background="@color/black"
|
||||
android:gravity="center"
|
||||
android:text="@string/screen_home_theme_all"
|
||||
android:textColor="@color/soda_400" />
|
||||
</LinearLayout>
|
||||
|
||||
<LinearLayout
|
||||
|
||||
@@ -1,28 +0,0 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:gravity="center_horizontal"
|
||||
android:orientation="vertical"
|
||||
android:paddingHorizontal="16dp">
|
||||
|
||||
<TextView
|
||||
android:id="@+id/tv_home_following_creator_all"
|
||||
style="@style/Typography.Body5"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="75dp"
|
||||
android:gravity="center"
|
||||
android:includeFontPadding="false"
|
||||
android:text="@string/screen_home_theme_all"
|
||||
android:textColor="@color/soda_400" />
|
||||
|
||||
<TextView
|
||||
style="@style/Typography.Body5"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginTop="@dimen/spacing_6"
|
||||
android:includeFontPadding="false"
|
||||
android:maxLines="1"
|
||||
android:text="@string/screen_home_theme_all"
|
||||
android:visibility="invisible" />
|
||||
</LinearLayout>
|
||||
Reference in New Issue
Block a user