feat(character-main): 최근 대화한 캐릭터
- 이미지 표시 및 클릭 이벤트 적용
This commit is contained in:
		@@ -11,6 +11,7 @@ import androidx.core.content.ContextCompat
 | 
				
			|||||||
import androidx.media3.common.util.UnstableApi
 | 
					import androidx.media3.common.util.UnstableApi
 | 
				
			||||||
import androidx.recyclerview.widget.LinearLayoutManager
 | 
					import androidx.recyclerview.widget.LinearLayoutManager
 | 
				
			||||||
import androidx.recyclerview.widget.RecyclerView
 | 
					import androidx.recyclerview.widget.RecyclerView
 | 
				
			||||||
 | 
					import com.google.gson.Gson
 | 
				
			||||||
import com.zhpan.bannerview.BaseBannerAdapter
 | 
					import com.zhpan.bannerview.BaseBannerAdapter
 | 
				
			||||||
import com.zhpan.indicator.enums.IndicatorSlideMode
 | 
					import com.zhpan.indicator.enums.IndicatorSlideMode
 | 
				
			||||||
import com.zhpan.indicator.enums.IndicatorStyle
 | 
					import com.zhpan.indicator.enums.IndicatorStyle
 | 
				
			||||||
@@ -19,8 +20,8 @@ import kr.co.vividnext.sodalive.base.BaseFragment
 | 
				
			|||||||
import kr.co.vividnext.sodalive.chat.character.curation.CurationSectionAdapter
 | 
					import kr.co.vividnext.sodalive.chat.character.curation.CurationSectionAdapter
 | 
				
			||||||
import kr.co.vividnext.sodalive.chat.character.detail.CharacterDetailActivity
 | 
					import kr.co.vividnext.sodalive.chat.character.detail.CharacterDetailActivity
 | 
				
			||||||
import kr.co.vividnext.sodalive.chat.character.detail.CharacterDetailActivity.Companion.EXTRA_CHARACTER_ID
 | 
					import kr.co.vividnext.sodalive.chat.character.detail.CharacterDetailActivity.Companion.EXTRA_CHARACTER_ID
 | 
				
			||||||
import kr.co.vividnext.sodalive.chat.character.recent.RecentCharacter
 | 
					 | 
				
			||||||
import kr.co.vividnext.sodalive.chat.character.recent.RecentCharacterAdapter
 | 
					import kr.co.vividnext.sodalive.chat.character.recent.RecentCharacterAdapter
 | 
				
			||||||
 | 
					import kr.co.vividnext.sodalive.chat.talk.room.ChatRoomActivity
 | 
				
			||||||
import kr.co.vividnext.sodalive.common.LoadingDialog
 | 
					import kr.co.vividnext.sodalive.common.LoadingDialog
 | 
				
			||||||
import kr.co.vividnext.sodalive.common.SharedPreferenceManager
 | 
					import kr.co.vividnext.sodalive.common.SharedPreferenceManager
 | 
				
			||||||
import kr.co.vividnext.sodalive.databinding.FragmentCharacterTabBinding
 | 
					import kr.co.vividnext.sodalive.databinding.FragmentCharacterTabBinding
 | 
				
			||||||
@@ -30,7 +31,6 @@ import kr.co.vividnext.sodalive.mypage.MyPageViewModel
 | 
				
			|||||||
import kr.co.vividnext.sodalive.mypage.auth.Auth
 | 
					import kr.co.vividnext.sodalive.mypage.auth.Auth
 | 
				
			||||||
import kr.co.vividnext.sodalive.mypage.auth.AuthVerifyRequest
 | 
					import kr.co.vividnext.sodalive.mypage.auth.AuthVerifyRequest
 | 
				
			||||||
import kr.co.vividnext.sodalive.splash.SplashActivity
 | 
					import kr.co.vividnext.sodalive.splash.SplashActivity
 | 
				
			||||||
import com.google.gson.Gson
 | 
					 | 
				
			||||||
import org.koin.android.ext.android.inject
 | 
					import org.koin.android.ext.android.inject
 | 
				
			||||||
 | 
					
 | 
				
			||||||
// 캐릭터 탭 프래그먼트
 | 
					// 캐릭터 탭 프래그먼트
 | 
				
			||||||
@@ -412,8 +412,8 @@ class CharacterTabFragment : BaseFragment<FragmentCharacterTabBinding>(
 | 
				
			|||||||
        }
 | 
					        }
 | 
				
			||||||
    }
 | 
					    }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    private fun onRecentCharacterClick(character: RecentCharacter) {
 | 
					    private fun onRecentCharacterClick(roomId: Long) {
 | 
				
			||||||
        // TODO: 최근 대화한 캐릭터 클릭 처리
 | 
					        startActivity(ChatRoomActivity.newIntent(requireContext(), roomId))
 | 
				
			||||||
    }
 | 
					    }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    private fun onCharacterClick(characterId: Long) {
 | 
					    private fun onCharacterClick(characterId: Long) {
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -137,8 +137,6 @@ class CharacterDetailActivity : BaseActivity<ActivityCharacterDetailBinding>(
 | 
				
			|||||||
 | 
					
 | 
				
			||||||
            // 2-1) 채팅방 생성 성공 처리 (이벤트)
 | 
					            // 2-1) 채팅방 생성 성공 처리 (이벤트)
 | 
				
			||||||
            state.chatRoomId?.let { roomId ->
 | 
					            state.chatRoomId?.let { roomId ->
 | 
				
			||||||
                showToast("채팅방이 생성되었습니다. (ID: $roomId)")
 | 
					 | 
				
			||||||
                // 생성된 채팅방으로 이동 처리
 | 
					 | 
				
			||||||
                startActivity(ChatRoomActivity.newIntent(this, roomId))
 | 
					                startActivity(ChatRoomActivity.newIntent(this, roomId))
 | 
				
			||||||
                viewModel.consumeChatRoomCreated()
 | 
					                viewModel.consumeChatRoomCreated()
 | 
				
			||||||
            }
 | 
					            }
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -5,7 +5,7 @@ import com.google.gson.annotations.SerializedName
 | 
				
			|||||||
 | 
					
 | 
				
			||||||
@Keep
 | 
					@Keep
 | 
				
			||||||
data class RecentCharacter(
 | 
					data class RecentCharacter(
 | 
				
			||||||
    @SerializedName("id") val id: String,
 | 
					    @SerializedName("roomId") val roomId: Long,
 | 
				
			||||||
    @SerializedName("name") val name: String,
 | 
					    @SerializedName("name") val name: String,
 | 
				
			||||||
    @SerializedName("profileImageUrl") val profileImageUrl: String
 | 
					    @SerializedName("imageUrl") val imageUrl: String
 | 
				
			||||||
)
 | 
					)
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -13,7 +13,7 @@ import kr.co.vividnext.sodalive.extensions.dpToPx
 | 
				
			|||||||
 | 
					
 | 
				
			||||||
class RecentCharacterAdapter(
 | 
					class RecentCharacterAdapter(
 | 
				
			||||||
    private var characters: List<RecentCharacter> = emptyList(),
 | 
					    private var characters: List<RecentCharacter> = emptyList(),
 | 
				
			||||||
    private val onCharacterClick: (RecentCharacter) -> Unit = {}
 | 
					    private val onCharacterClick: (Long) -> Unit = {}
 | 
				
			||||||
) : RecyclerView.Adapter<RecentCharacterAdapter.ViewHolder>() {
 | 
					) : RecyclerView.Adapter<RecentCharacterAdapter.ViewHolder>() {
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    inner class ViewHolder(
 | 
					    inner class ViewHolder(
 | 
				
			||||||
@@ -23,7 +23,7 @@ class RecentCharacterAdapter(
 | 
				
			|||||||
        fun bind(character: RecentCharacter) {
 | 
					        fun bind(character: RecentCharacter) {
 | 
				
			||||||
            binding.tvName.text = character.name
 | 
					            binding.tvName.text = character.name
 | 
				
			||||||
            Glide.with(context)
 | 
					            Glide.with(context)
 | 
				
			||||||
                .load(character.profileImageUrl)
 | 
					                .load(character.imageUrl)
 | 
				
			||||||
                .apply(
 | 
					                .apply(
 | 
				
			||||||
                    RequestOptions().transform(
 | 
					                    RequestOptions().transform(
 | 
				
			||||||
                        RoundedCorners(
 | 
					                        RoundedCorners(
 | 
				
			||||||
@@ -33,7 +33,7 @@ class RecentCharacterAdapter(
 | 
				
			|||||||
                )
 | 
					                )
 | 
				
			||||||
                .into(binding.ivProfile)
 | 
					                .into(binding.ivProfile)
 | 
				
			||||||
 | 
					
 | 
				
			||||||
            binding.root.setOnClickListener { onCharacterClick(character) }
 | 
					            binding.root.setOnClickListener { onCharacterClick(character.roomId) }
 | 
				
			||||||
        }
 | 
					        }
 | 
				
			||||||
    }
 | 
					    }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -9,7 +9,6 @@
 | 
				
			|||||||
        android:id="@+id/iv_profile"
 | 
					        android:id="@+id/iv_profile"
 | 
				
			||||||
        android:layout_width="76dp"
 | 
					        android:layout_width="76dp"
 | 
				
			||||||
        android:layout_height="76dp"
 | 
					        android:layout_height="76dp"
 | 
				
			||||||
        android:background="@color/color_777777"
 | 
					 | 
				
			||||||
        android:contentDescription="@null"
 | 
					        android:contentDescription="@null"
 | 
				
			||||||
        android:scaleType="centerCrop" />
 | 
					        android:scaleType="centerCrop" />
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 
 | 
				
			|||||||
		Reference in New Issue
	
	Block a user