사용하지 않는 함수 삭제
This commit is contained in:
@@ -294,24 +294,6 @@ class ChatMessageAdapter : RecyclerView.Adapter<RecyclerView.ViewHolder>() {
|
||||
return (p != null && c != null && p == c)
|
||||
}
|
||||
|
||||
/**
|
||||
* 현재(position)와 다음 항목이 동일 발신자인지
|
||||
*/
|
||||
fun isSameSenderWithNext(position: Int): Boolean {
|
||||
if (position < 0 || position >= items.size - 1) return false
|
||||
val curr = items[position]
|
||||
val next = items[position + 1]
|
||||
fun mineOf(item: ChatListItem): Boolean? = when (item) {
|
||||
is ChatListItem.UserMessage -> item.data.mine
|
||||
is ChatListItem.AiMessage -> item.data.mine
|
||||
else -> null
|
||||
}
|
||||
|
||||
val c = mineOf(curr)
|
||||
val n = mineOf(next)
|
||||
return (c != null && n != null && c == n)
|
||||
}
|
||||
|
||||
override fun getItemViewType(position: Int): Int {
|
||||
return when (items[position]) {
|
||||
is ChatListItem.UserMessage -> VIEW_TYPE_USER_MESSAGE
|
||||
|
||||
@@ -606,7 +606,11 @@ class ChatRoomActivity : BaseActivity<ActivityChatRoomBinding>(
|
||||
// 2) 서버 통합 API로 동기화 및 UI 갱신
|
||||
val token = "Bearer ${SharedPreferenceManager.token}"
|
||||
val bgImageId = getSavedBackgroundImageId()
|
||||
val networkDisposable = chatRepository.enterChatRoom(token = token, roomId = roomId, characterImageId = bgImageId)
|
||||
val networkDisposable = chatRepository.enterChatRoom(
|
||||
token = token,
|
||||
roomId = roomId,
|
||||
characterImageId = bgImageId
|
||||
)
|
||||
.observeOn(AndroidSchedulers.mainThread())
|
||||
.subscribe({ response ->
|
||||
// 캐릭터 정보 바인딩
|
||||
@@ -846,8 +850,6 @@ class ChatRoomActivity : BaseActivity<ActivityChatRoomBinding>(
|
||||
binding.viewCharacterDim.isVisible = visible
|
||||
}
|
||||
|
||||
private fun bgUrlPrefKey(): String = "chat_bg_url_room_$roomId"
|
||||
|
||||
fun setChatBackground(url: String) {
|
||||
binding.ivBackgroundProfile.load(url) {
|
||||
placeholder(R.drawable.ic_placeholder_profile)
|
||||
@@ -855,24 +857,6 @@ class ChatRoomActivity : BaseActivity<ActivityChatRoomBinding>(
|
||||
}
|
||||
}
|
||||
|
||||
private fun applyBackgroundFromPrefsOrProfile(profileUrl: String) {
|
||||
val key = bgUrlPrefKey()
|
||||
val saved = prefs.getString(key, null)
|
||||
val target = when {
|
||||
!saved.isNullOrBlank() -> saved
|
||||
profileUrl.isNotBlank() -> {
|
||||
prefs.edit { putString(key, profileUrl) }
|
||||
profileUrl
|
||||
}
|
||||
else -> null
|
||||
}
|
||||
if (!target.isNullOrBlank()) {
|
||||
setChatBackground(target)
|
||||
} else {
|
||||
binding.ivBackgroundProfile.setImageResource(R.drawable.ic_placeholder_profile)
|
||||
}
|
||||
}
|
||||
|
||||
fun getCharacterId(): Long = characterInfo?.characterId ?: 0L
|
||||
|
||||
fun getCharacterProfileUrl(): String = characterInfo?.profileImageUrl ?: ""
|
||||
|
||||
Reference in New Issue
Block a user