feat(home): 팔로잉 스케줄 카드를 추가한다

This commit is contained in:
2026-06-25 23:34:02 +09:00
parent 8f5012fe2a
commit ccd2398a7c
2 changed files with 178 additions and 0 deletions

View File

@@ -0,0 +1,70 @@
package kr.co.vividnext.sodalive.v2.main.home.ui
import android.view.LayoutInflater
import android.view.View
import android.view.ViewGroup
import android.widget.ImageView
import android.widget.TextView
import androidx.core.content.ContextCompat
import androidx.recyclerview.widget.RecyclerView
import kr.co.vividnext.sodalive.R
import kr.co.vividnext.sodalive.v2.creator.channel.ui.formatCreatorChannelScheduleDate
import kr.co.vividnext.sodalive.v2.creator.channel.ui.formatCreatorChannelScheduleDayOfWeek
import kr.co.vividnext.sodalive.v2.creator.channel.ui.formatCreatorChannelScheduleTime
import kr.co.vividnext.sodalive.v2.main.home.model.HomeFollowingScheduleUiItem
class HomeFollowingScheduleAdapter(
private val onClickItem: (HomeFollowingScheduleUiItem) -> Unit = {}
) : RecyclerView.Adapter<HomeFollowingScheduleAdapter.ScheduleViewHolder>() {
private var items: List<HomeFollowingScheduleUiItem> = emptyList()
fun submitItems(items: List<HomeFollowingScheduleUiItem>) {
this.items = items
notifyDataSetChanged()
}
override fun onCreateViewHolder(parent: ViewGroup, viewType: Int): ScheduleViewHolder {
val view = LayoutInflater.from(parent.context).inflate(R.layout.item_home_following_schedule, parent, false)
view.layoutParams = RecyclerView.LayoutParams(
ViewGroup.LayoutParams.MATCH_PARENT,
ViewGroup.LayoutParams.WRAP_CONTENT
).apply { bottomMargin = parent.resources.getDimensionPixelSize(R.dimen.spacing_8) }
return ScheduleViewHolder(view, onClickItem)
}
override fun onBindViewHolder(holder: ScheduleViewHolder, position: Int) {
holder.bind(items[position])
}
override fun getItemCount(): Int = items.size
class ScheduleViewHolder(
itemView: View,
private val onClickItem: (HomeFollowingScheduleUiItem) -> Unit
) : RecyclerView.ViewHolder(itemView) {
private val dayText = itemView.findViewById<TextView>(R.id.tv_home_following_schedule_day)
private val weekdayText = itemView.findViewById<TextView>(R.id.tv_home_following_schedule_weekday)
private val titleText = itemView.findViewById<TextView>(R.id.tv_home_following_schedule_title)
private val profileImage = itemView.findViewById<ImageView>(R.id.iv_home_following_schedule_creator_profile)
private val nicknameText = itemView.findViewById<TextView>(R.id.tv_home_following_schedule_creator_nickname)
private val typeText = itemView.findViewById<TextView>(R.id.tv_home_following_schedule_type)
private val timeText = itemView.findViewById<TextView>(R.id.tv_home_following_schedule_time)
fun bind(item: HomeFollowingScheduleUiItem) {
dayText.text = formatCreatorChannelScheduleDate(item.scheduledAtUtc)
weekdayText.text = formatCreatorChannelScheduleDayOfWeek(item.scheduledAtUtc)
titleText.text = item.title
profileImage.loadHomeCreatorProfileImage(item.creatorProfileImageUrl)
nicknameText.text = item.creatorNickname
typeText.setText(item.typeLabelResId)
if (item.isOnAir) {
timeText.setText(R.string.screen_home_following_on_air)
timeText.setTextColor(ContextCompat.getColor(itemView.context, R.color.green_400))
} else {
timeText.text = formatCreatorChannelScheduleTime(item.scheduledAtUtc)
timeText.setTextColor(ContextCompat.getColor(itemView.context, R.color.gray_500))
}
itemView.setOnClickListener { onClickItem(item) }
}
}
}

View File

@@ -0,0 +1,108 @@
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:background="@drawable/bg_feed_card"
android:gravity="center_vertical"
android:orientation="horizontal"
android:padding="@dimen/spacing_14">
<LinearLayout
android:layout_width="52dp"
android:layout_height="52dp"
android:background="@drawable/bg_round_corner_999_263238"
android:gravity="center"
android:orientation="vertical">
<TextView
android:id="@+id/tv_home_following_schedule_day"
style="@style/Typography.Heading3"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:includeFontPadding="false"
android:textColor="@color/white"
tools:text="25" />
<TextView
android:id="@+id/tv_home_following_schedule_weekday"
style="@style/Typography.Caption3"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:includeFontPadding="true"
android:textColor="@color/gray_500"
tools:text="THU" />
</LinearLayout>
<LinearLayout
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_marginStart="@dimen/spacing_12"
android:layout_weight="1"
android:orientation="vertical">
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:gravity="center_vertical"
android:orientation="horizontal">
<ImageView
android:id="@+id/iv_home_following_schedule_creator_profile"
android:layout_width="20dp"
android:layout_height="20dp"
android:background="@drawable/bg_round_corner_999_263238"
android:contentDescription="@null"
android:scaleType="centerCrop"
tools:src="@drawable/ic_placeholder_profile" />
<TextView
android:id="@+id/tv_home_following_schedule_creator_nickname"
style="@style/Typography.Body6"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_marginStart="@dimen/spacing_4"
android:layout_weight="1"
android:ellipsize="end"
android:includeFontPadding="false"
android:maxLines="1"
android:textColor="@color/gray_500"
tools:text="크리에이터 이름" />
</LinearLayout>
<TextView
android:id="@+id/tv_home_following_schedule_title"
style="@style/Typography.Body4"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginTop="@dimen/spacing_6"
android:ellipsize="end"
android:includeFontPadding="false"
android:maxLines="1"
android:textColor="@color/white"
tools:text="스케줄 제목" />
<TextView
android:id="@+id/tv_home_following_schedule_type"
style="@style/Typography.Caption3"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginTop="@dimen/spacing_6"
android:background="@drawable/bg_feed_category_tag"
android:includeFontPadding="false"
android:paddingHorizontal="@dimen/spacing_4"
android:paddingVertical="2dp"
android:textColor="@color/gray_100"
tools:text="라이브" />
</LinearLayout>
<TextView
android:id="@+id/tv_home_following_schedule_time"
style="@style/Typography.Body5"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginStart="@dimen/spacing_8"
android:includeFontPadding="false"
android:textColor="@color/green_400"
tools:text="20:00" />
</LinearLayout>