feat(chat): 톡 목록 스키마 반영 및 채팅방 진입 연결
- TalkRoom 필드 변경 및 신규 스키마 적용 - 어댑터 바인딩/DiffUtil 수정, 프로필 이미지 28dp 라운드 처리 - 아이템 클릭 시 ChatRoomActivity로 이동(roomId 전달) - item_talk 배경 제거, 최근 캐릭터 썸네일 모서리 28dp로 통일
This commit is contained in:
		@@ -27,7 +27,7 @@ class RecentCharacterAdapter(
 | 
			
		||||
                .apply(
 | 
			
		||||
                    RequestOptions().transform(
 | 
			
		||||
                        RoundedCorners(
 | 
			
		||||
                            16f.dpToPx().toInt()
 | 
			
		||||
                            28f.dpToPx().toInt()
 | 
			
		||||
                        )
 | 
			
		||||
                    )
 | 
			
		||||
                )
 | 
			
		||||
 
 | 
			
		||||
@@ -5,10 +5,10 @@ import com.google.gson.annotations.SerializedName
 | 
			
		||||
 | 
			
		||||
@Keep
 | 
			
		||||
data class TalkRoom(
 | 
			
		||||
    @SerializedName("id") val id: Long,
 | 
			
		||||
    @SerializedName("profileImageUrl") val profileImageUrl: String,
 | 
			
		||||
    @SerializedName("characterName") val characterName: String,
 | 
			
		||||
    @SerializedName("characterType") val characterType: String,
 | 
			
		||||
    @SerializedName("lastMessageTime") val lastMessageTime: String,
 | 
			
		||||
    @SerializedName("lastMessage") val lastMessage: String
 | 
			
		||||
    @SerializedName("chatRoomId") val chatRoomId: Long,
 | 
			
		||||
    @SerializedName("title") val title: String,
 | 
			
		||||
    @SerializedName("imageUrl") val imageUrl: String,
 | 
			
		||||
    @SerializedName("opponentType") val opponentType: String,
 | 
			
		||||
    @SerializedName("lastMessagePreview") val lastMessagePreview: String?,
 | 
			
		||||
    @SerializedName("lastMessageTimeLabel") val lastMessageTimeLabel: String
 | 
			
		||||
)
 | 
			
		||||
 
 | 
			
		||||
@@ -6,7 +6,11 @@ import androidx.recyclerview.widget.DiffUtil
 | 
			
		||||
import androidx.recyclerview.widget.ListAdapter
 | 
			
		||||
import androidx.recyclerview.widget.RecyclerView
 | 
			
		||||
import com.bumptech.glide.Glide
 | 
			
		||||
import com.bumptech.glide.load.resource.bitmap.RoundedCorners
 | 
			
		||||
import com.bumptech.glide.request.RequestOptions
 | 
			
		||||
import com.orhanobut.logger.Logger
 | 
			
		||||
import kr.co.vividnext.sodalive.databinding.ItemTalkBinding
 | 
			
		||||
import kr.co.vividnext.sodalive.extensions.dpToPx
 | 
			
		||||
 | 
			
		||||
class TalkTabAdapter(
 | 
			
		||||
    private val onItemClick: (TalkRoom) -> Unit
 | 
			
		||||
@@ -36,19 +40,27 @@ class TalkTabAdapter(
 | 
			
		||||
 | 
			
		||||
        fun bind(talkRoom: TalkRoom) {
 | 
			
		||||
            binding.apply {
 | 
			
		||||
                Logger.d("bind talkRoom: $talkRoom")
 | 
			
		||||
                // 프로필 이미지 로드
 | 
			
		||||
                Glide.with(ivProfile.context)
 | 
			
		||||
                    .load(talkRoom.profileImageUrl)
 | 
			
		||||
                    .load(talkRoom.imageUrl)
 | 
			
		||||
                    .apply(
 | 
			
		||||
                        RequestOptions().transform(
 | 
			
		||||
                            RoundedCorners(
 | 
			
		||||
                                28f.dpToPx().toInt()
 | 
			
		||||
                            )
 | 
			
		||||
                        )
 | 
			
		||||
                    )
 | 
			
		||||
                    .into(ivProfile)
 | 
			
		||||
 | 
			
		||||
                // 텍스트 설정
 | 
			
		||||
                tvCharacterName.text = talkRoom.characterName
 | 
			
		||||
                tvCharacterType.text = talkRoom.characterType
 | 
			
		||||
                tvLastTime.text = talkRoom.lastMessageTime
 | 
			
		||||
                tvLastMessage.text = talkRoom.lastMessage
 | 
			
		||||
                tvCharacterName.text = talkRoom.title
 | 
			
		||||
                tvCharacterType.text = talkRoom.opponentType
 | 
			
		||||
                tvLastTime.text = talkRoom.lastMessageTimeLabel
 | 
			
		||||
                tvLastMessage.text = talkRoom.lastMessagePreview ?: ""
 | 
			
		||||
 | 
			
		||||
                // 캐릭터 유형에 따른 배경 설정
 | 
			
		||||
                val backgroundResId = when (talkRoom.characterType.lowercase()) {
 | 
			
		||||
                val backgroundResId = when (talkRoom.opponentType.lowercase()) {
 | 
			
		||||
                    "character" -> kr.co.vividnext.sodalive.R.drawable.bg_character_type_badge_character
 | 
			
		||||
                    "clone" -> kr.co.vividnext.sodalive.R.drawable.bg_character_type_badge_clone
 | 
			
		||||
                    "creator" -> kr.co.vividnext.sodalive.R.drawable.bg_character_type_badge_creator
 | 
			
		||||
@@ -61,7 +73,7 @@ class TalkTabAdapter(
 | 
			
		||||
 | 
			
		||||
    private class TalkDiffCallback : DiffUtil.ItemCallback<TalkRoom>() {
 | 
			
		||||
        override fun areItemsTheSame(oldItem: TalkRoom, newItem: TalkRoom): Boolean {
 | 
			
		||||
            return oldItem.id == newItem.id
 | 
			
		||||
            return oldItem.chatRoomId == newItem.chatRoomId
 | 
			
		||||
        }
 | 
			
		||||
 | 
			
		||||
        override fun areContentsTheSame(oldItem: TalkRoom, newItem: TalkRoom): Boolean {
 | 
			
		||||
 
 | 
			
		||||
@@ -5,6 +5,7 @@ import android.view.View
 | 
			
		||||
import android.widget.Toast
 | 
			
		||||
import androidx.recyclerview.widget.LinearLayoutManager
 | 
			
		||||
import kr.co.vividnext.sodalive.base.BaseFragment
 | 
			
		||||
import kr.co.vividnext.sodalive.chat.talk.room.ChatRoomActivity
 | 
			
		||||
import kr.co.vividnext.sodalive.common.LoadingDialog
 | 
			
		||||
import kr.co.vividnext.sodalive.databinding.FragmentTalkTabBinding
 | 
			
		||||
import org.koin.android.ext.android.inject
 | 
			
		||||
@@ -30,14 +31,13 @@ class TalkTabFragment : BaseFragment<FragmentTalkTabBinding>(
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    private fun setupRecyclerView() {
 | 
			
		||||
        adapter = TalkTabAdapter { talkRoom ->
 | 
			
		||||
            // 대화방 클릭 이벤트 처리
 | 
			
		||||
            // TODO: 대화방 상세 화면으로 이동
 | 
			
		||||
            Toast.makeText(
 | 
			
		||||
                requireContext(),
 | 
			
		||||
                "대화방 ${talkRoom.characterName} 클릭됨",
 | 
			
		||||
                Toast.LENGTH_SHORT
 | 
			
		||||
            ).show()
 | 
			
		||||
        adapter = TalkTabAdapter {
 | 
			
		||||
            startActivity(
 | 
			
		||||
                ChatRoomActivity.newIntent(
 | 
			
		||||
                    context = requireContext(),
 | 
			
		||||
                    roomId = it.chatRoomId
 | 
			
		||||
                )
 | 
			
		||||
            )
 | 
			
		||||
        }
 | 
			
		||||
 | 
			
		||||
        binding.rvTalk.apply {
 | 
			
		||||
 
 | 
			
		||||
@@ -12,7 +12,6 @@
 | 
			
		||||
        android:id="@+id/iv_profile"
 | 
			
		||||
        android:layout_width="76dp"
 | 
			
		||||
        android:layout_height="76dp"
 | 
			
		||||
        android:background="@color/color_777777"
 | 
			
		||||
        android:contentDescription="@null"
 | 
			
		||||
        android:scaleType="centerCrop" />
 | 
			
		||||
 | 
			
		||||
 
 | 
			
		||||
		Reference in New Issue
	
	Block a user