diff --git a/app/src/main/java/kr/co/vividnext/sodalive/live/room/LiveRoomActivity.kt b/app/src/main/java/kr/co/vividnext/sodalive/live/room/LiveRoomActivity.kt index 655b79d8..9fd4f1d2 100644 --- a/app/src/main/java/kr/co/vividnext/sodalive/live/room/LiveRoomActivity.kt +++ b/app/src/main/java/kr/co/vividnext/sodalive/live/room/LiveRoomActivity.kt @@ -1692,7 +1692,8 @@ class LiveRoomActivity : BaseActivity(ActivityLiveRoomB nickname, message.message, message.can, - message.donationMessage ?: "" + message.donationMessage ?: "", + isSecret = false ) ) invalidateChat() @@ -1754,7 +1755,8 @@ class LiveRoomActivity : BaseActivity(ActivityLiveRoomB nickname, message.message, message.can, - message.donationMessage ?: "" + message.donationMessage ?: "", + isSecret = true ) ) invalidateChat() 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 db0cd649..7675f9b9 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 @@ -52,27 +52,31 @@ data class LiveRoomJoinChat( (binding as ItemLiveRoomJoinChatBinding).tvJoin.setTextColor( ContextCompat.getColor(context, R.color.color_eeeeee) ) - val str = "'$nickname'님이 입장하셨습니다." - val spStr = SpannableString(str) + val joinText = context.getString(R.string.screen_live_room_join, nickname) + val spStr = SpannableString(joinText) + val nicknameStart = joinText.indexOf(nickname).takeIf { it >= 0 } + val nicknameEnd = nicknameStart?.plus(nickname.length) - spStr.setSpan( - ForegroundColorSpan( - ContextCompat.getColor( - context, - R.color.color_ffdc00 - ) - ), - str.indexOf("'") + 1, - str.indexOf("'님"), - Spanned.SPAN_EXCLUSIVE_EXCLUSIVE - ) + if (nicknameStart != null && nicknameEnd != null) { + spStr.setSpan( + ForegroundColorSpan( + ContextCompat.getColor( + context, + R.color.color_ffdc00 + ) + ), + nicknameStart, + nicknameEnd, + Spanned.SPAN_EXCLUSIVE_EXCLUSIVE + ) - spStr.setSpan( - StyleSpan(Typeface.BOLD), - str.indexOf("'"), - str.indexOf("'님"), - Spanned.SPAN_EXCLUSIVE_EXCLUSIVE - ) + spStr.setSpan( + StyleSpan(Typeface.BOLD), + nicknameStart, + nicknameEnd, + Spanned.SPAN_EXCLUSIVE_EXCLUSIVE + ) + } (binding as ItemLiveRoomJoinChatBinding).tvJoin.text = spStr binding.root.setBackgroundResource(R.drawable.bg_round_corner_4_7_cc004462) @@ -115,7 +119,8 @@ data class LiveRoomNormalChat( itemBinding.tvCreatorOrManager.setBackgroundResource( R.drawable.bg_round_corner_2_4999e3 ) - itemBinding.tvCreatorOrManager.text = "스탭" + itemBinding.tvCreatorOrManager.text = + context.getString(R.string.screen_live_room_staff_label) itemBinding.ivCrown.visibility = View.VISIBLE itemBinding.tvCreatorOrManager.visibility = View.VISIBLE @@ -179,25 +184,43 @@ data class LiveRoomDonationChat( @SerializedName("nickname") val nickname: String, @SerializedName("chat") val chat: String, @SerializedName("can") val can: Int, - @SerializedName("donationMessage") val donationMessage: String + @SerializedName("donationMessage") val donationMessage: String, + val isSecret: Boolean = false ) : LiveRoomChat() { - @SuppressLint("SetTextI18n") override fun bind(context: Context, binding: ViewBinding, onClickProfile: ((Long) -> Unit)?) { val itemBinding = binding as ItemLiveRoomChatBinding - val spChat = SpannableString(chat) - spChat.setSpan( - ForegroundColorSpan( - ContextCompat.getColor( - context, - R.color.color_fdca2f - ) - ), - 0, - chat.indexOf("캔", 0, true) + 1, - Spanned.SPAN_EXCLUSIVE_EXCLUSIVE + val donationText = context.getString( + if (isSecret) { + R.string.screen_live_room_secret_mission_sent + } else { + R.string.screen_live_room_donation_sent + }, + can.toString() ) + val spChat = SpannableString(donationText) + val unit = context.getString(R.string.screen_live_room_can_unit) + val amountStart = donationText.indexOf(can.toString()).takeIf { it >= 0 } + val amountEnd = amountStart?.let { start -> + donationText.indexOf(unit, start).takeIf { it >= 0 }?.plus(unit.length) + ?: start + can.toString().length + } + if (amountStart != null && amountEnd != null) { + spChat.setSpan( + ForegroundColorSpan( + ContextCompat.getColor( + context, + R.color.color_fdca2f + ) + ), + amountStart, + amountEnd, + Spanned.SPAN_EXCLUSIVE_EXCLUSIVE + ) + } - val spNickname = SpannableString("${nickname}님이") + val spNickname = SpannableString( + context.getString(R.string.screen_live_room_donation_sender, nickname) + ) spNickname.setSpan( CustomTypefaceSpan( ResourcesCompat.getFont( @@ -226,7 +249,10 @@ data class LiveRoomDonationChat( itemBinding.tvCreatorOrManager.visibility = View.GONE if (donationMessage.isNotBlank()) { - itemBinding.tvDonationMessage.text = "\"$donationMessage\"" + itemBinding.tvDonationMessage.text = context.getString( + R.string.screen_live_room_donation_message_format, + donationMessage + ) itemBinding.tvDonationMessage.visibility = View.VISIBLE } else { itemBinding.tvDonationMessage.visibility = View.GONE @@ -235,7 +261,7 @@ data class LiveRoomDonationChat( itemBinding.llMessageBg.setPadding(0) itemBinding.llMessageBg.background = null - if (spChat.contains("비밀")) { + if (isSecret) { itemBinding.root.setBackgroundResource(R.drawable.bg_round_corner_6_7_cc59548f) } else { itemBinding.root.setBackgroundResource( @@ -282,7 +308,10 @@ data class LiveRoomRouletteDonationChat( ) : LiveRoomChat() { override fun bind(context: Context, binding: ViewBinding, onClickProfile: ((Long) -> Unit)?) { val itemBinding = binding as ItemLiveRoomChatBinding - val chat = "[$rouletteResult] 당첨!" + val chat = context.getString( + R.string.screen_live_room_roulette_win, + rouletteResult + ) val spChat = SpannableString(chat) spChat.setSpan( ForegroundColorSpan( @@ -296,7 +325,12 @@ data class LiveRoomRouletteDonationChat( Spanned.SPAN_EXCLUSIVE_EXCLUSIVE ) - val spNickname = SpannableString("${nickname}님의 룰렛 결과?") + val spNickname = SpannableString( + context.getString( + R.string.screen_live_room_roulette_sender, + nickname + ) + ) spNickname.setSpan( StyleSpan(Typeface.NORMAL), 0, diff --git a/app/src/main/java/kr/co/vividnext/sodalive/live/room/donation/LiveRoomDonationDialog.kt b/app/src/main/java/kr/co/vividnext/sodalive/live/room/donation/LiveRoomDonationDialog.kt index 77f5fd26..fefc3c1a 100644 --- a/app/src/main/java/kr/co/vividnext/sodalive/live/room/donation/LiveRoomDonationDialog.kt +++ b/app/src/main/java/kr/co/vividnext/sodalive/live/room/donation/LiveRoomDonationDialog.kt @@ -59,13 +59,13 @@ class LiveRoomDonationDialog( if (isSecret && can < 10) { Toast.makeText( activity, - "비밀 미션은 최소 10캔 이상부터 이용이 가능합니다.", + activity.getString(R.string.screen_live_room_secret_mission_minimum), Toast.LENGTH_LONG ).show() } else if (can < 1) { Toast.makeText( activity, - "1캔 이상 후원하실 수 있습니다.", + activity.getString(R.string.screen_live_room_donation_minimum), Toast.LENGTH_LONG ).show() } else { @@ -79,7 +79,7 @@ class LiveRoomDonationDialog( } else { Toast.makeText( activity, - "1캔 이상 후원하실 수 있습니다.", + activity.getString(R.string.screen_live_room_donation_minimum), Toast.LENGTH_LONG ).show() } @@ -87,7 +87,7 @@ class LiveRoomDonationDialog( } catch (e: NumberFormatException) { Toast.makeText( activity, - "1캔 이상 후원하실 수 있습니다.", + activity.getString(R.string.screen_live_room_donation_minimum), Toast.LENGTH_LONG ).show() } @@ -99,14 +99,14 @@ class LiveRoomDonationDialog( val isSelected = dialogView.tvSecret.isSelected dialogView.tvSecret.isSelected = !isSelected dialogView.etDonationMessage.hint = if (!isSelected) { - "비밀 미션을 입력하세요(최대 1000자)" + activity.getString(R.string.screen_live_room_secret_mission_hint) } else { - "함께 보낼 메시지 입력(최대 1000자)" + activity.getString(R.string.screen_live_room_donation_message_hint) } dialogView.etDonationCan.hint = if (!isSelected) { - "10캔 이상 입력하세요" + activity.getString(R.string.screen_live_room_secret_mission_input_min) } else { - "1캔 이상 입력하세요" + activity.getString(R.string.screen_live_room_donation_input_min) } } dialogView.tvSecret.isSelected = false diff --git a/app/src/main/java/kr/co/vividnext/sodalive/live/room/donation/LiveRoomDonationMessageAdapter.kt b/app/src/main/java/kr/co/vividnext/sodalive/live/room/donation/LiveRoomDonationMessageAdapter.kt index a2211b3b..3700ac30 100644 --- a/app/src/main/java/kr/co/vividnext/sodalive/live/room/donation/LiveRoomDonationMessageAdapter.kt +++ b/app/src/main/java/kr/co/vividnext/sodalive/live/room/donation/LiveRoomDonationMessageAdapter.kt @@ -26,7 +26,10 @@ class LiveRoomDonationMessageAdapter( @SuppressLint("SetTextI18n") fun bind(item: LiveRoomDonationMessage) { if (item.canMessage.isNotBlank()) { - binding.tvNickname.text = "${item.nickname}님이" + binding.tvNickname.text = binding.root.context.getString( + R.string.screen_live_room_donation_sender, + item.nickname + ) binding.tvCanMessage.text = item.canMessage binding.tvCanMessage.visibility = View.VISIBLE binding.root.setBackgroundResource( @@ -37,11 +40,17 @@ class LiveRoomDonationMessageAdapter( } ) } else { - binding.tvNickname.text = "${item.nickname}님의 룰렛 결과?" + binding.tvNickname.text = binding.root.context.getString( + R.string.screen_live_room_roulette_sender, + item.nickname + ) binding.tvCanMessage.visibility = View.GONE binding.root.setBackgroundResource(R.drawable.bg_round_corner_5_3_ccc25264) } - binding.tvDonationMessage.text = "\"${item.donationMessage}\"" + binding.tvDonationMessage.text = binding.root.context.getString( + R.string.screen_live_room_donation_message_format, + item.donationMessage + ) if ( creatorId == SharedPreferenceManager.userId && diff --git a/app/src/main/java/kr/co/vividnext/sodalive/live/room/profile/LiveRoomProfileAdapter.kt b/app/src/main/java/kr/co/vividnext/sodalive/live/room/profile/LiveRoomProfileAdapter.kt index 03993ea4..4dcda8a3 100644 --- a/app/src/main/java/kr/co/vividnext/sodalive/live/room/profile/LiveRoomProfileAdapter.kt +++ b/app/src/main/java/kr/co/vividnext/sodalive/live/room/profile/LiveRoomProfileAdapter.kt @@ -5,6 +5,7 @@ import android.view.LayoutInflater import android.view.ViewGroup import androidx.recyclerview.widget.RecyclerView import androidx.viewbinding.ViewBinding +import kr.co.vividnext.sodalive.R import kr.co.vividnext.sodalive.databinding.ItemLiveRoomListProfileBinding import kr.co.vividnext.sodalive.databinding.ItemLiveRoomProfileHeaderBinding import kr.co.vividnext.sodalive.databinding.ItemLiveRoomProfileManagerBinding @@ -55,7 +56,7 @@ class LiveRoomProfileAdapter( items.add( 1, LiveRoomProfileItemSpeakerTitle( - "스피커", + R.string.screen_live_room_speaker_label, speakerCount = speakers.size - 1, totalUserCount = totalUserCount ) @@ -64,7 +65,7 @@ class LiveRoomProfileAdapter( items.add( 1, LiveRoomProfileItemManagerTitle( - "스탭", + R.string.screen_live_room_staff_label, managerCount = managers.size ) ) @@ -79,7 +80,11 @@ class LiveRoomProfileAdapter( items.add(index = index + 2, item) } - items.add(LiveRoomProfileItemListenerTitle("리스너")) + items.add( + LiveRoomProfileItemListenerTitle( + R.string.screen_live_room_listener_label + ) + ) listeners.forEach { val item = LiveRoomProfileItemUser( diff --git a/app/src/main/java/kr/co/vividnext/sodalive/live/room/profile/LiveRoomProfileItem.kt b/app/src/main/java/kr/co/vividnext/sodalive/live/room/profile/LiveRoomProfileItem.kt index 649a6e73..7300ebb5 100644 --- a/app/src/main/java/kr/co/vividnext/sodalive/live/room/profile/LiveRoomProfileItem.kt +++ b/app/src/main/java/kr/co/vividnext/sodalive/live/room/profile/LiveRoomProfileItem.kt @@ -2,6 +2,7 @@ package kr.co.vividnext.sodalive.live.room.profile import android.view.View import androidx.annotation.Keep +import androidx.annotation.StringRes import androidx.recyclerview.widget.RecyclerView import androidx.viewbinding.ViewBinding import coil.load @@ -51,14 +52,14 @@ abstract class LiveRoomProfileItem { @Keep data class LiveRoomProfileItemSpeakerTitle( - val title: String, + @StringRes val titleResId: Int, val speakerCount: Int, val totalUserCount: Int ) : LiveRoomProfileItem() { override var type = LiveRoomProfileItemType.SPEAKER_TITLE override fun bind(binding: ViewBinding) { val itemBinding = binding as ItemLiveRoomProfileHeaderBinding - itemBinding.tvTitle.text = title + itemBinding.tvTitle.setText(titleResId) itemBinding.tvSpeakerCount.text = "$speakerCount" itemBinding.tvSpeakerTotalCount.text = if (totalUserCount > 5) { "/5" @@ -77,12 +78,12 @@ data class LiveRoomProfileItemSpeakerTitle( @Keep data class LiveRoomProfileItemListenerTitle( - val title: String + @StringRes val titleResId: Int ) : LiveRoomProfileItem() { override var type = LiveRoomProfileItemType.LISTENER_TITLE override fun bind(binding: ViewBinding) { val itemBinding = binding as ItemLiveRoomProfileHeaderBinding - itemBinding.tvTitle.text = title + itemBinding.tvTitle.setText(titleResId) itemBinding.tvSpeakerCount.visibility = View.GONE itemBinding.tvSpeakerTotalCount.visibility = View.GONE @@ -95,13 +96,13 @@ data class LiveRoomProfileItemListenerTitle( @Keep data class LiveRoomProfileItemManagerTitle( - val title: String, + @StringRes val titleResId: Int, val managerCount: Int ) : LiveRoomProfileItem() { override var type = LiveRoomProfileItemType.MANAGER_TITLE override fun bind(binding: ViewBinding) { val itemBinding = binding as ItemLiveRoomProfileHeaderBinding - itemBinding.tvTitle.text = title + itemBinding.tvTitle.setText(titleResId) itemBinding.tvSpeakerCount.text = "$managerCount" itemBinding.tvSpeakerCount.visibility = View.VISIBLE itemBinding.tvSpeakerTotalCount.visibility = View.GONE diff --git a/app/src/main/java/kr/co/vividnext/sodalive/live/room/profile/LiveRoomUserProfileDialog.kt b/app/src/main/java/kr/co/vividnext/sodalive/live/room/profile/LiveRoomUserProfileDialog.kt index 4c40a7c3..13273206 100644 --- a/app/src/main/java/kr/co/vividnext/sodalive/live/room/profile/LiveRoomUserProfileDialog.kt +++ b/app/src/main/java/kr/co/vividnext/sodalive/live/room/profile/LiveRoomUserProfileDialog.kt @@ -99,13 +99,17 @@ class LiveRoomUserProfileDialog( dialogView.tvInviteSpeaker.visibility = View.VISIBLE if (userProfile.isSpeaker) { - dialogView.tvInviteSpeaker.text = "리스너 변경" + dialogView.tvInviteSpeaker.setText( + R.string.screen_live_room_change_to_listener + ) dialogView.tvInviteSpeaker.setOnClickListener { onClickChangeListener(userProfile.userId) alertDialog.dismiss() } } else { - dialogView.tvInviteSpeaker.text = "스피커 초대" + dialogView.tvInviteSpeaker.setText( + R.string.screen_live_room_invite_speaker + ) dialogView.tvInviteSpeaker.setOnClickListener { onClickInviteSpeaker(userProfile.userId) alertDialog.dismiss() @@ -121,13 +125,13 @@ class LiveRoomUserProfileDialog( dialogView.tvNoChatting.visibility = View.VISIBLE if (userProfile.isManager) { - dialogView.tvSetManager.text = "스탭 해제" + dialogView.tvSetManager.setText(R.string.screen_live_room_unset_manager) dialogView.tvSetManager.setOnClickListener { onClickReleaseManager(userProfile.userId) alertDialog.dismiss() } } else { - dialogView.tvSetManager.text = "스탭 지정" + dialogView.tvSetManager.setText(R.string.screen_live_room_set_manager) dialogView.tvSetManager.setOnClickListener { onClickSetManager(userProfile.userId) alertDialog.dismiss() diff --git a/app/src/main/res/layout/item_live_room_donation_ranking.xml b/app/src/main/res/layout/item_live_room_donation_ranking.xml index d1e09f24..0460a5a1 100644 --- a/app/src/main/res/layout/item_live_room_donation_ranking.xml +++ b/app/src/main/res/layout/item_live_room_donation_ranking.xml @@ -102,7 +102,7 @@ android:layout_height="wrap_content" android:fontFamily="@font/gmarket_sans_medium" android:gravity="end" - android:text="캔" + android:text="@string/screen_live_room_can_unit" android:textColor="@color/color_eeeeee" android:textSize="10.7sp" tools:ignore="SmallSp" /> @@ -124,7 +124,7 @@ android:gravity="end" android:paddingHorizontal="3.33dp" android:paddingVertical="2.67dp" - android:text="비밀" + android:text="@string/screen_live_room_secret_label" android:textColor="@color/color_111111" android:textSize="12sp" tools:ignore="SmallSp" /> @@ -145,7 +145,7 @@ android:layout_height="wrap_content" android:fontFamily="@font/gmarket_sans_medium" android:gravity="end" - android:text="캔" + android:text="@string/screen_live_room_can_unit" android:textColor="@color/color_eeeeee" android:textSize="10.7sp" tools:ignore="SmallSp" /> diff --git a/app/src/main/res/layout/item_live_room_heart_ranking.xml b/app/src/main/res/layout/item_live_room_heart_ranking.xml index 1ec0d499..3fd0c724 100644 --- a/app/src/main/res/layout/item_live_room_heart_ranking.xml +++ b/app/src/main/res/layout/item_live_room_heart_ranking.xml @@ -98,7 +98,7 @@ android:layout_height="wrap_content" android:fontFamily="@font/gmarket_sans_medium" android:gravity="end" - android:text="하트" + android:text="@string/screen_live_room_heart_label" android:textColor="@color/color_eeeeee" android:textSize="10.7sp" tools:ignore="SmallSp" /> diff --git a/app/src/main/res/layout/item_live_room_list_profile.xml b/app/src/main/res/layout/item_live_room_list_profile.xml index 379f29bb..85ae9789 100644 --- a/app/src/main/res/layout/item_live_room_list_profile.xml +++ b/app/src/main/res/layout/item_live_room_list_profile.xml @@ -49,7 +49,7 @@ android:fontFamily="@font/gmarket_sans_medium" android:paddingHorizontal="5.5dp" android:paddingVertical="12dp" - android:text="리스너로 변경" + android:text="@string/screen_live_room_change_to_listener" android:textColor="@color/white" android:textSize="10sp" android:visibility="gone" @@ -63,7 +63,7 @@ android:fontFamily="@font/gmarket_sans_medium" android:paddingHorizontal="5.5dp" android:paddingVertical="12dp" - android:text="스피커로 초대" + android:text="@string/screen_live_room_invite_speaker" android:textColor="@color/white" android:textSize="10sp" android:visibility="gone" @@ -78,7 +78,7 @@ android:fontFamily="@font/gmarket_sans_medium" android:paddingHorizontal="5.5dp" android:paddingVertical="12dp" - android:text="채금" + android:text="@string/screen_live_room_chat_ban_short" android:textColor="@color/white" android:textSize="10sp" android:visibility="gone" diff --git a/app/src/main/res/values-en/strings.xml b/app/src/main/res/values-en/strings.xml index c9599e5f..2739696d 100644 --- a/app/src/main/res/values-en/strings.xml +++ b/app/src/main/res/values-en/strings.xml @@ -394,6 +394,26 @@ Participants New chat Enter a message + %1$s joined. + Staff + cans + "%1$s" + %1$s + %1$s\u2019s roulette result? + [%1$s] Win! + Hearts + Secret + Change to listener + Invite to speaker + Mute + Set as staff + Remove staff + Speaker + Listener + Enter a secret mission (up to 1000 chars) + Enter a message to send (up to 1000 chars) + Enter 10 or more cans + Enter at least 1 can Details Login Edit profile diff --git a/app/src/main/res/values-ja/strings.xml b/app/src/main/res/values-ja/strings.xml index eb764dde..03407f41 100644 --- a/app/src/main/res/values-ja/strings.xml +++ b/app/src/main/res/values-ja/strings.xml @@ -394,6 +394,26 @@ 参加者 新しいチャット チャットを入力してください + %1$sさんが入場しました。 + スタッフ + CAN + "%1$s" + %1$sさんが + %1$sさんのルーレット結果? + [%1$s] 当選! + ハート + シークレット + リスナーに変更 + スピーカー招待 + チャ禁 + スタッフに設定 + スタッフ解除 + スピーカー + リスナー + シークレットミッションを入力(最大1000文字) + 一緒に送るメッセージを入力(最大1000文字) + 10CAN以上を入力してください + 1CAN以上を入力してください 詳細 ログイン プロフィール編集 diff --git a/app/src/main/res/values/strings.xml b/app/src/main/res/values/strings.xml index d2f9896b..cf4eaf32 100644 --- a/app/src/main/res/values/strings.xml +++ b/app/src/main/res/values/strings.xml @@ -393,6 +393,26 @@ 참여자 새로운 채팅 채팅을 입력하세요 + %1$s님이 입장하셨습니다. + 스탭 + + "%1$s" + %1$s님이 + %1$s님의 룰렛 결과? + [%1$s] 당첨! + 하트 + 비밀 + 리스너로 변경 + 스피커로 초대 + 채금 + 스탭 지정 + 스탭 해제 + 스피커 + 리스너 + 비밀 미션을 입력하세요(최대 1000자) + 함께 보낼 메시지 입력(최대 1000자) + 10캔 이상 입력하세요 + 1캔 이상 입력하세요 자세히 LOGIN 프로필 수정