From 544a67c8ec8197c7cb88247cdef058b6eae1c46e Mon Sep 17 00:00:00 2001 From: klaus Date: Wed, 18 Mar 2026 14:06:17 +0900 Subject: [PATCH] =?UTF-8?q?fix(live-room):=20=EB=9D=BC=EC=9D=B4=EB=B8=8C?= =?UTF-8?q?=EB=A3=B8=20=EC=B1=84=ED=8C=85=20=EB=9E=AD=ED=82=B9=20=EC=99=95?= =?UTF-8?q?=EA=B4=80=20=ED=91=9C=EC=8B=9C=20=EA=B7=9C=EA=B2=A9=EC=9D=84=20?= =?UTF-8?q?=EC=A1=B0=EC=A0=95=ED=95=9C=EB=8B=A4?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../sodalive/live/room/chat/LiveRoomChat.kt | 74 ++++++++++++++-- docs/20260318_라이브룸채팅왕관표시수정.md | 84 +++++++++++++++++++ 2 files changed, 152 insertions(+), 6 deletions(-) create mode 100644 docs/20260318_라이브룸채팅왕관표시수정.md diff --git a/app/src/main/java/kr/co/vividnext/sodalive/live/room/chat/LiveRoomChat.kt b/app/src/main/java/kr/co/vividnext/sodalive/live/room/chat/LiveRoomChat.kt index e2c3563a..1c65ed8d 100644 --- a/app/src/main/java/kr/co/vividnext/sodalive/live/room/chat/LiveRoomChat.kt +++ b/app/src/main/java/kr/co/vividnext/sodalive/live/room/chat/LiveRoomChat.kt @@ -7,6 +7,7 @@ import android.text.Spanned import android.text.style.ForegroundColorSpan import android.text.style.StyleSpan import android.view.View +import android.view.ViewGroup import androidx.annotation.Keep import androidx.core.content.ContextCompat import androidx.core.content.res.ResourcesCompat @@ -111,6 +112,28 @@ data class LiveRoomNormalChat( itemBinding.ivRoulette.visibility = View.GONE itemBinding.tvCreatorOrManager.visibility = View.GONE + val defaultProfileSize = 33.3f.dpToPx().toInt() + val defaultCrownSize = 16.7f.dpToPx().toInt() + val rankProfileWidth = 39.dpToPx().toInt() + val rankProfileHeight = 38.dpToPx().toInt() + + fun setProfileSize(width: Int, height: Int) { + itemBinding.flProfile.layoutParams = itemBinding.flProfile.layoutParams.apply { + this.width = width + this.height = height + } + } + + fun setCrownSize(width: Int, height: Int) { + itemBinding.ivCrown.layoutParams = itemBinding.ivCrown.layoutParams.apply { + this.width = width + this.height = height + } + } + + setProfileSize(defaultProfileSize, defaultProfileSize) + setCrownSize(defaultCrownSize, defaultCrownSize) + when (rank + 1) { -2 -> { itemBinding.ivBg.setImageResource(R.drawable.bg_circle_4999e3) @@ -132,20 +155,35 @@ data class LiveRoomNormalChat( } 1 -> { - itemBinding.ivBg.setImageResource(R.drawable.bg_circle_ffdc00_fdca2f) - itemBinding.ivCrown.setImageResource(R.drawable.ic_crown_1) + itemBinding.ivBg.setImageDrawable(null) + setProfileSize(rankProfileWidth, rankProfileHeight) + setCrownSize( + ViewGroup.LayoutParams.MATCH_PARENT, + ViewGroup.LayoutParams.MATCH_PARENT + ) + itemBinding.ivCrown.setImageResource(R.drawable.img_rank_1) itemBinding.ivCrown.visibility = View.VISIBLE } 2 -> { - itemBinding.ivBg.setImageResource(R.drawable.bg_circle_9f9f9f_dcdcdc) - itemBinding.ivCrown.setImageResource(R.drawable.ic_crown_2) + itemBinding.ivBg.setImageDrawable(null) + setProfileSize(rankProfileWidth, rankProfileHeight) + setCrownSize( + ViewGroup.LayoutParams.MATCH_PARENT, + ViewGroup.LayoutParams.MATCH_PARENT + ) + itemBinding.ivCrown.setImageResource(R.drawable.img_rank_2) itemBinding.ivCrown.visibility = View.VISIBLE } 3 -> { - itemBinding.ivBg.setImageResource(R.drawable.bg_circle_e5a578_c67e4a) - itemBinding.ivCrown.setImageResource(R.drawable.ic_crown_3) + itemBinding.ivBg.setImageDrawable(null) + setProfileSize(rankProfileWidth, rankProfileHeight) + setCrownSize( + ViewGroup.LayoutParams.MATCH_PARENT, + ViewGroup.LayoutParams.MATCH_PARENT + ) + itemBinding.ivCrown.setImageResource(R.drawable.img_rank_3) itemBinding.ivCrown.visibility = View.VISIBLE } @@ -188,6 +226,18 @@ data class LiveRoomDonationChat( ) : LiveRoomChat() { override fun bind(context: Context, binding: ViewBinding, onClickProfile: ((Long) -> Unit)?) { val itemBinding = binding as ItemLiveRoomChatBinding + val defaultProfileSize = 33.3f.dpToPx().toInt() + val defaultCrownSize = 16.7f.dpToPx().toInt() + + itemBinding.flProfile.layoutParams = itemBinding.flProfile.layoutParams.apply { + width = defaultProfileSize + height = defaultProfileSize + } + itemBinding.ivCrown.layoutParams = itemBinding.ivCrown.layoutParams.apply { + width = defaultCrownSize + height = defaultCrownSize + } + val donationText = context.getString( if (isSecret) { R.string.screen_live_room_secret_mission_sent @@ -307,6 +357,18 @@ data class LiveRoomRouletteDonationChat( ) : LiveRoomChat() { override fun bind(context: Context, binding: ViewBinding, onClickProfile: ((Long) -> Unit)?) { val itemBinding = binding as ItemLiveRoomChatBinding + val defaultProfileSize = 33.3f.dpToPx().toInt() + val defaultCrownSize = 16.7f.dpToPx().toInt() + + itemBinding.flProfile.layoutParams = itemBinding.flProfile.layoutParams.apply { + width = defaultProfileSize + height = defaultProfileSize + } + itemBinding.ivCrown.layoutParams = itemBinding.ivCrown.layoutParams.apply { + width = defaultCrownSize + height = defaultCrownSize + } + val chat = context.getString( R.string.screen_live_room_roulette_win, rouletteResult diff --git a/docs/20260318_라이브룸채팅왕관표시수정.md b/docs/20260318_라이브룸채팅왕관표시수정.md new file mode 100644 index 00000000..030b9bdc --- /dev/null +++ b/docs/20260318_라이브룸채팅왕관표시수정.md @@ -0,0 +1,84 @@ +# 20260318_라이브룸채팅왕관표시수정.md + +## 개요 +- 라이브룸 일반 채팅(`LiveRoomNormalChat`)의 랭킹 왕관 표시를 요청사항에 맞게 수정한다. + +## 작업 내용 +- [x] 기존 랭킹 분기(`-2`, `-1`, `1`, `2`, `3`) 및 레이아웃 구조 확인 +- [x] `item_live_room_chat.xml`에서 왕관 parent/자식 크기 제어 구조 반영 +- [x] `LiveRoomChat.kt`에서 `1`, `2`, `3`위 왕관 리소스/배경 처리 로직 반영 +- [x] `-2`, `-1` 표시 및 크기 유지 확인 +- [x] 검증 수행 (`lsp_diagnostics`, `./gradlew :app:testDebugUnitTest`, `./gradlew :app:assembleDebug`) +- [x] 사용자 피드백 반영: `fl_crown` 제거 후 `fl_profile`/`iv_crown` 직접 크기 조절로 재수정 +- [x] `1`, `2`, `3`위에서만 `iv_crown=match_parent`, `fl_profile=39x38dp` 적용 및 나머지 기본 크기 유지 + +## 검증 기록 +- 무엇을: 라이브룸 일반 채팅의 랭킹 왕관 표시에서 `1`, `2`, `3`위 리소스를 `img_rank_1~3`로 변경하고, 해당 경우에만 왕관 parent 크기를 `39dp x 38dp`로 적용 +- 왜: 상위 3위 왕관 표시 규격을 신규 디자인 리소스에 맞추고, `-2`, `-1` 표시 크기는 기존과 동일하게 유지하기 위함 +- 어떻게: + - `item_live_room_chat.xml`에 `iv_crown` 전용 parent(`fl_crown`)를 추가하고 `iv_crown`을 `match_parent`로 변경 + - `LiveRoomChat.kt`에서 기본 왕관 parent 크기를 `16.7dp`로 초기화 후, `1`, `2`, `3`위에서만 `39dp x 38dp`로 변경 + - `1`, `2`, `3`위에서는 `iv_bg`를 `null` 처리하고 `img_rank_1`, `img_rank_2`, `img_rank_3`를 사용 + - `-2`, `-1` 분기의 왕관/배경 리소스는 기존 로직을 유지 + - `lsp_diagnostics` 실행(현재 환경 `.kt`, `.xml` LSP 미구성), Gradle 테스트/빌드 검증 수행 +- 실행 명령: + - `lsp_diagnostics filePath=app/src/main/java/kr/co/vividnext/sodalive/live/room/chat/LiveRoomChat.kt` + - `lsp_diagnostics filePath=app/src/main/res/layout/item_live_room_chat.xml` + - `./gradlew :app:testDebugUnitTest` + - `./gradlew :app:assembleDebug` +- 결과: + - `app/src/main/java/kr/co/vividnext/sodalive/live/room/chat/LiveRoomChat.kt` 반영 완료 + - `app/src/main/res/layout/item_live_room_chat.xml` 반영 완료 + - `./gradlew :app:testDebugUnitTest` 성공 + - `./gradlew :app:assembleDebug` 성공 + - LSP 진단은 `.kt`, `.xml` 서버 미설정으로 미실행(Gradle 검증으로 대체) + +### 추가 검증 (lint) +- 무엇을: 변경 영향 확인을 위해 `:app:lintDebug` 추가 실행 +- 왜: XML/Kotlin 수정 후 정적 분석 경고/오류 여부를 확인하기 위함 +- 실행 명령: + - `./gradlew :app:lintDebug` +- 결과: + - 실패(기존 이슈): `AndroidManifest.xml`의 `com.facebook.FacebookActivity` MissingClass 포함 기존 lint 오류 21건, 경고 593건 + - 이번 변경 파일(`LiveRoomChat.kt`, `item_live_room_chat.xml`) 직접 오류는 로그상 확인되지 않음 + +### 추가 수정 (요청 반영: fl_profile/iv_crown 직접 조절) +- 무엇을: `fl_crown` 방식 대신 `fl_profile`과 `iv_crown`의 크기를 직접 제어하도록 변경 +- 왜: 왕관 전용 container가 프로필 container보다 커져 표시가 깨질 수 있는 문제를 방지하기 위함 +- 어떻게: + - `item_live_room_chat.xml`에서 `fl_crown`을 제거하고 `iv_crown`을 `fl_profile` 직계 자식으로 복원 + - `LiveRoomChat.kt`에서 `LiveRoomNormalChat` 바인딩 시 기본값을 `fl_profile=33.3dp`, `iv_crown=16.7dp`로 초기화 + - `1`, `2`, `3`위일 때만 `fl_profile=39x38dp`, `iv_crown=match_parent`로 변경하고 `img_rank_1~3` 적용 + - `-2`, `-1`, 그 외 분기는 기본 크기를 유지 + - 뷰 재활용 영향 방지를 위해 `LiveRoomDonationChat`, `LiveRoomRouletteDonationChat`에서도 기본 크기 초기화 추가 +- 실행 명령: + - `lsp_diagnostics filePath=app/src/main/java/kr/co/vividnext/sodalive/live/room/chat/LiveRoomChat.kt` + - `lsp_diagnostics filePath=app/src/main/res/layout/item_live_room_chat.xml` + - `./gradlew :app:testDebugUnitTest` + - `./gradlew :app:assembleDebug` +- 결과: + - `app/src/main/java/kr/co/vividnext/sodalive/live/room/chat/LiveRoomChat.kt` 재반영 완료 + - `app/src/main/res/layout/item_live_room_chat.xml` 재반영 완료 + - `LiveRoomDonationChat`, `LiveRoomRouletteDonationChat`의 기본 크기 초기화 반영 완료 + +### 재검증 결과 (요청 반영 후) +- 실행 명령: + - `lsp_diagnostics filePath=app/src/main/java/kr/co/vividnext/sodalive/live/room/chat/LiveRoomChat.kt` + - `lsp_diagnostics filePath=app/src/main/res/layout/item_live_room_chat.xml` + - `./gradlew :app:testDebugUnitTest` + - `./gradlew :app:assembleDebug` +- 결과: + - `lsp_diagnostics`는 현재 환경 `.kt`, `.xml` 서버 미설정으로 미실행 + - `./gradlew :app:testDebugUnitTest` 성공 + - `./gradlew :app:assembleDebug` 성공 + +### 최종 재검증 +- 실행 명령: + - `lsp_diagnostics filePath=app/src/main/java/kr/co/vividnext/sodalive/live/room/chat/LiveRoomChat.kt` + - `lsp_diagnostics filePath=app/src/main/res/layout/item_live_room_chat.xml` + - `./gradlew :app:testDebugUnitTest` + - `./gradlew :app:assembleDebug` +- 결과: + - `lsp_diagnostics`는 현재 환경 `.kt`, `.xml` 서버 미설정으로 미실행 + - `./gradlew :app:testDebugUnitTest` 성공(UP-TO-DATE 포함) + - `./gradlew :app:assembleDebug` 성공(UP-TO-DATE 포함)